mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Move the test_fetch_data test.
There is no longer any point in keeping it apart from the other data URL tests.
This commit is contained in:
parent
f304151fe2
commit
bb9b0b3467
2 changed files with 9 additions and 25 deletions
|
@ -77,6 +77,15 @@ fn plain_ct() {
|
||||||
Some(b"hello"));
|
Some(b"hello"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn plain_html() {
|
||||||
|
assert_parse(
|
||||||
|
"data:text/html,<p>Servo</p>",
|
||||||
|
Some(ContentType(Mime(TopLevel::Text, SubLevel::Html, vec!()))),
|
||||||
|
None,
|
||||||
|
Some(b"<p>Servo</p>"));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn plain_charset() {
|
fn plain_charset() {
|
||||||
assert_parse(
|
assert_parse(
|
||||||
|
|
|
@ -103,31 +103,6 @@ fn test_fetch_aboutblank() {
|
||||||
assert!(*fetch_response.body.lock().unwrap() == ResponseBody::Done(vec![]));
|
assert!(*fetch_response.body.lock().unwrap() == ResponseBody::Done(vec![]));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_fetch_data() {
|
|
||||||
let url = Url::parse("data:text/html,<p>Servo</p>").unwrap();
|
|
||||||
let origin = Origin::Origin(url.origin());
|
|
||||||
let request = Request::new(url, Some(origin), false, None);
|
|
||||||
let expected_resp_body = "<p>Servo</p>".to_owned();
|
|
||||||
let fetch_response = fetch_sync(request, None);
|
|
||||||
|
|
||||||
assert!(!fetch_response.is_network_error());
|
|
||||||
assert_eq!(fetch_response.headers.len(), 1);
|
|
||||||
let content_type: &ContentType = fetch_response.headers.get().unwrap();
|
|
||||||
assert!(**content_type == Mime(TopLevel::Text, SubLevel::Html, vec![]));
|
|
||||||
let resp_body = fetch_response.body.lock().unwrap();
|
|
||||||
|
|
||||||
match *resp_body {
|
|
||||||
ResponseBody::Done(ref val) => {
|
|
||||||
assert_eq!(val, &expected_resp_body.into_bytes());
|
|
||||||
}
|
|
||||||
ResponseBody::Receiving(_) => {
|
|
||||||
panic!();
|
|
||||||
},
|
|
||||||
ResponseBody::Empty => panic!(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_fetch_blob() {
|
fn test_fetch_blob() {
|
||||||
use ipc_channel::ipc;
|
use ipc_channel::ipc;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue