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
@@ -76,6 +76,5 @@ pub mod fetch {
/// A module for re-exports of items used in unit tests.
pub mod test {
pub use chrome_loader::resolve_chrome_url;
pub use http_loader::{HttpRequest, HttpRequestFactory, HttpResponse, HttpState};
pub use http_loader::{LoadError, LoadErrorType, UIProvider, load};
pub use http_loader::HttpState;
}
@@ -162,6 +162,26 @@ fn test_fetch_file() {
}
}

#[test]
fn test_fetch_ftp() {
let url = ServoUrl::parse("ftp://not-supported").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_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";
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.