diff options
Diffstat (limited to 'tests/unit/net')
-rw-r--r-- | tests/unit/net/Cargo.toml | 7 | ||||
-rw-r--r-- | tests/unit/net/data_loader.rs | 5 | ||||
-rw-r--r-- | tests/unit/net/http_loader.rs | 9 | ||||
-rw-r--r-- | tests/unit/net/lib.rs | 1 |
4 files changed, 15 insertions, 7 deletions
diff --git a/tests/unit/net/Cargo.toml b/tests/unit/net/Cargo.toml index 3f87e8fe429..1c9a275e445 100644 --- a/tests/unit/net/Cargo.toml +++ b/tests/unit/net/Cargo.toml @@ -10,12 +10,13 @@ path = "lib.rs" doctest = false [dependencies] -content-blocker = "0.2" +content-blocker = "0.2.1" cookie = "0.2" devtools_traits = {path = "../../../components/devtools_traits"} flate2 = "0.2.0" hyper = "0.9.9" -ipc-channel = "0.4.0" +hyper_serde = "0.1.4" +ipc-channel = "0.5" msg = {path = "../../../components/msg"} net = {path = "../../../components/net"} net_traits = {path = "../../../components/net_traits"} @@ -23,5 +24,5 @@ plugins = {path = "../../../components/plugins"} profile_traits = {path = "../../../components/profile_traits"} time = "0.1" unicase = "1.0" -url = {version = "1.0.0", features = ["heap_size"]} +url = {version = "1.2", features = ["heap_size"]} util = {path = "../../../components/util"} diff --git a/tests/unit/net/data_loader.rs b/tests/unit/net/data_loader.rs index f73331a53be..2916cb7e30c 100644 --- a/tests/unit/net/data_loader.rs +++ b/tests/unit/net/data_loader.rs @@ -3,7 +3,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ extern crate hyper; +extern crate hyper_serde; +use hyper_serde::Serde; use ipc_channel::ipc; use msg::constellation_msg::{PipelineId, ReferrerPolicy}; use net_traits::LoadConsumer::Channel; @@ -44,7 +46,8 @@ fn assert_parse(url: &'static str, classifier, CancellationListener::new(None)); let response = start_port.recv().unwrap(); - assert_eq!(&response.metadata.content_type, &content_type); + assert_eq!(&response.metadata.content_type.map(Serde::into_inner), + &content_type); assert_eq!(&response.metadata.charset, &charset); let progress = response.progress_port.recv().unwrap(); diff --git a/tests/unit/net/http_loader.rs b/tests/unit/net/http_loader.rs index 53f79178aab..e8e44789cf0 100644 --- a/tests/unit/net/http_loader.rs +++ b/tests/unit/net/http_loader.rs @@ -18,6 +18,7 @@ use hyper::http::RawStatus; use hyper::method::Method; use hyper::mime::{Mime, SubLevel, TopLevel}; use hyper::status::StatusCode; +use hyper_serde::Serde; use msg::constellation_msg::{PipelineId, ReferrerPolicy}; use net::cookie::Cookie; use net::cookie_storage::CookieStorage; @@ -1584,7 +1585,8 @@ fn test_auth_ui_sets_header_on_401() { }, DEFAULT_USER_AGENT.to_owned(), &CancellationListener::new(None), None) { Err(e) => panic!("response contained error {:?}", e), Ok(response) => { - assert_eq!(response.metadata.status, Some(RawStatus(200, Cow::Borrowed("Ok")))); + assert_eq!(response.metadata.status, + Some(Serde(RawStatus(200, Cow::Borrowed("Ok"))))); } } } @@ -1618,7 +1620,8 @@ fn test_auth_ui_needs_www_auth() { match response { Err(e) => panic!("response contained error {:?}", e), Ok(response) => { - assert_eq!(response.metadata.status, Some(RawStatus(401, Cow::Borrowed("Unauthorized")))); + assert_eq!(response.metadata.status, + Some(Serde(RawStatus(401, Cow::Borrowed("Unauthorized"))))); } } } @@ -1944,7 +1947,7 @@ fn load_request_for_custom_response(expected_body: Vec<u8>) -> (Metadata, String fn test_custom_response() { let expected_body = b"Yay!".to_vec(); let (metadata, body) = load_request_for_custom_response(expected_body.clone()); - assert_eq!(metadata.status, Some(RawStatus(200, Cow::Borrowed("OK")))); + assert_eq!(metadata.status, Some(Serde(RawStatus(200, Cow::Borrowed("OK"))))); assert_eq!(body, String::from_utf8(expected_body).unwrap()); } diff --git a/tests/unit/net/lib.rs b/tests/unit/net/lib.rs index 7923ede897d..1acdb9bb6ae 100644 --- a/tests/unit/net/lib.rs +++ b/tests/unit/net/lib.rs @@ -10,6 +10,7 @@ extern crate cookie as cookie_rs; extern crate devtools_traits; extern crate flate2; extern crate hyper; +extern crate hyper_serde; extern crate ipc_channel; extern crate msg; extern crate net; |