1. Add an Option<Pipeline_id> field to the LoadData struct, and a corresponding parameter to LoadData::new()

2. Change addEvent in the NetworkEventActor to add_request and add_response
This commit is contained in:
Himaja 2015-04-27 15:31:21 -04:00 committed by Josh Matthews
parent 6e91ebb1fe
commit 01eb31ae8a
18 changed files with 152 additions and 151 deletions

View file

@ -20,7 +20,7 @@ fn assert_parse(url: &'static str,
use net::data_loader::load;
let (start_chan, start_port) = channel();
load(LoadData::new(Url::parse(url).unwrap()), Channel(start_chan));
load(LoadData::new(Url::parse(url).unwrap(), None), Channel(start_chan));
let response = start_port.recv().unwrap();
assert_eq!(&response.metadata.content_type, &content_type);

View file

@ -14,16 +14,16 @@ use url::Url;
#[test]
fn test_exit() {
let resource_task = new_resource_task(None);
let resource_task = new_resource_task(None, None);
resource_task.send(ControlMsg::Exit).unwrap();
}
#[test]
fn test_bad_scheme() {
let resource_task = new_resource_task(None);
let resource_task = new_resource_task(None, None);
let (start_chan, start) = channel();
let url = Url::parse("bogus://whatever").unwrap();
resource_task.send(ControlMsg::Load(LoadData::new(url), LoadConsumer::Channel(start_chan))).unwrap();
resource_task.send(ControlMsg::Load(LoadData::new(url, None), LoadConsumer::Channel(start_chan))).unwrap();
let response = start.recv().unwrap();
match response.progress_port.recv().unwrap() {
ProgressMsg::Done(result) => { assert!(result.is_err()) }
@ -170,10 +170,10 @@ fn test_replace_hosts() {
let port = listener.local_addr().unwrap().port();
//Start the resource task and make a request to our TCP server
let resource_task = new_resource_task(None);
let resource_task = new_resource_task(None, None);
let (start_chan, _) = channel();
let url = Url::parse(&format!("http://foo.bar.com:{}", port)).unwrap();
resource_task.send(ControlMsg::Load(replace_hosts(LoadData::new(url), host_table), LoadConsumer::Channel(start_chan))).unwrap();
resource_task.send(ControlMsg::Load(replace_hosts(LoadData::new(url, None), host_table), LoadConsumer::Channel(start_chan))).unwrap();
match listener.accept() {
Ok(..) => assert!(true, "received request"),