Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite and remove most unit tests for the legacy fetch stack. #14315

Merged
merged 14 commits into from Nov 24, 2016

Translate a unit test for bogus schemes to fetch.

  • Loading branch information
Ms2ger committed Nov 23, 2016
commit fc26aaf8072fb8526256ce0a7d54eef860564b0e
@@ -162,6 +162,16 @@ fn test_fetch_file() {
}
}

#[test]
fn test_fetch_bogus_scheme() {
let url = ServoUrl::parse("bogus://whatever").unwrap();
let origin = Origin::Origin(url.origin());
let request = Request::new(url, Some(origin), false, None);
*request.referrer.borrow_mut() = Referrer::NoReferrer;
let fetch_response = fetch_sync(request, None);
assert!(fetch_response.is_network_error());
}

#[test]
fn test_cors_preflight_fetch() {
static ACK: &'static [u8] = b"ACK";
@@ -43,26 +43,6 @@ fn test_exit() {
receiver.recv().unwrap();
}

#[test]
fn test_bad_scheme() {
let (tx, _rx) = ipc::channel().unwrap();
let (sender, receiver) = ipc::channel().unwrap();
let (resource_thread, _) = new_core_resource_thread(
"".into(), None, ProfilerChan(tx), None);
let (start_chan, start) = ipc::channel().unwrap();
let url = ServoUrl::parse("bogus://whatever").unwrap();
resource_thread.send(CoreResourceMsg::Load(LoadData::new(LoadContext::Browsing, url, &ResourceTest),

LoadConsumer::Channel(start_chan), None)).unwrap();
let response = start.recv().unwrap();
match response.progress_port.recv().unwrap() {
ProgressMsg::Done(result) => { assert!(result.is_err()) }
_ => panic!("bleh")
}
resource_thread.send(CoreResourceMsg::Exit(sender)).unwrap();
receiver.recv().unwrap();
}

#[test]
fn test_parse_hostsfile() {
let mock_hosts_file_content = "127.0.0.1 foo.bar.com\n127.0.0.2 servo.test.server";
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.