mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Translate a test for ftp URLs to fetch.
This commit is contained in:
parent
fc26aaf807
commit
621ca6190a
2 changed files with 10 additions and 19 deletions
|
@ -162,6 +162,16 @@ 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();
|
||||
|
|
|
@ -1222,25 +1222,6 @@ impl HttpRequestFactory for DontConnectFactory {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_load_errors_when_scheme_is_not_http_or_https() {
|
||||
let url = ServoUrl::parse("ftp://not-supported").unwrap();
|
||||
let load_data = LoadData::new(LoadContext::Browsing, url.clone(), &HttpTest);
|
||||
|
||||
let http_state = HttpState::new();
|
||||
let ui_provider = TestProvider::new();
|
||||
|
||||
match load(&load_data,
|
||||
&ui_provider, &http_state,
|
||||
None,
|
||||
&DontConnectFactory,
|
||||
DEFAULT_USER_AGENT.into(),
|
||||
&CancellationListener::new(None), None) {
|
||||
Err(ref load_err) if load_err.error == LoadErrorType::UnsupportedScheme { scheme: "ftp".into() } => (),
|
||||
_ => panic!("expected ftp scheme to be unsupported")
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_load_errors_when_viewing_source_and_inner_url_scheme_is_not_http_or_https() {
|
||||
let url = ServoUrl::parse("view-source:ftp://not-supported").unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue