aboutsummaryrefslogtreecommitdiffstats
path: root/components/net/tests
diff options
context:
space:
mode:
authorwebbeef <me@webbeef.org>2024-08-21 21:11:16 -0700
committerGitHub <noreply@github.com>2024-08-22 04:11:16 +0000
commit663a92a5df39f5daef091624b6e29c228dcecbc3 (patch)
treedbcf67d033768d91ed585623c816410f0267d34d /components/net/tests
parent562d32c0519d58052cea681a696546fd4818bd3a (diff)
downloadservo-663a92a5df39f5daef091624b6e29c228dcecbc3.tar.gz
servo-663a92a5df39f5daef091624b6e29c228dcecbc3.zip
make protocol handlers registrable (#33104)
Signed-off-by: webbeef <me@webbeef.org>
Diffstat (limited to 'components/net/tests')
-rw-r--r--components/net/tests/fetch.rs4
-rw-r--r--components/net/tests/main.rs2
-rw-r--r--components/net/tests/resource_thread.rs2
3 files changed, 8 insertions, 0 deletions
diff --git a/components/net/tests/fetch.rs b/components/net/tests/fetch.rs
index 62631706b15..9ffe6817d81 100644
--- a/components/net/tests/fetch.rs
+++ b/components/net/tests/fetch.rs
@@ -27,6 +27,7 @@ use net::fetch::cors_cache::CorsCache;
use net::fetch::methods::{self, CancellationListener, FetchContext};
use net::filemanager_thread::FileManager;
use net::hsts::HstsEntry;
+use net::protocols::ProtocolRegistry;
use net::resource_thread::CoreResourceThreadPool;
use net::test::HttpState;
use net_traits::filemanager_thread::FileTokenCheck;
@@ -769,6 +770,7 @@ fn test_fetch_with_hsts() {
timing: ServoArc::new(Mutex::new(ResourceFetchTiming::new(
ResourceTimingType::Navigation,
))),
+ protocols: Arc::new(ProtocolRegistry::default()),
};
// The server certificate is self-signed, so we need to add an override
@@ -828,6 +830,7 @@ fn test_load_adds_host_to_hsts_list_when_url_is_https() {
timing: ServoArc::new(Mutex::new(ResourceFetchTiming::new(
ResourceTimingType::Navigation,
))),
+ protocols: Arc::new(ProtocolRegistry::default()),
};
// The server certificate is self-signed, so we need to add an override
@@ -885,6 +888,7 @@ fn test_fetch_self_signed() {
timing: ServoArc::new(Mutex::new(ResourceFetchTiming::new(
ResourceTimingType::Navigation,
))),
+ protocols: Arc::new(ProtocolRegistry::default()),
};
let mut request = RequestBuilder::new(url.clone(), Referrer::NoReferrer)
diff --git a/components/net/tests/main.rs b/components/net/tests/main.rs
index dc9c859b82b..ae86c749d10 100644
--- a/components/net/tests/main.rs
+++ b/components/net/tests/main.rs
@@ -37,6 +37,7 @@ use hyper::{Body, Request as HyperRequest, Response as HyperResponse};
use net::fetch::cors_cache::CorsCache;
use net::fetch::methods::{self, CancellationListener, FetchContext};
use net::filemanager_thread::FileManager;
+use net::protocols::ProtocolRegistry;
use net::resource_thread::CoreResourceThreadPool;
use net::test::HttpState;
use net_traits::filemanager_thread::FileTokenCheck;
@@ -114,6 +115,7 @@ fn new_fetch_context(
timing: ServoArc::new(Mutex::new(ResourceFetchTiming::new(
ResourceTimingType::Navigation,
))),
+ protocols: Arc::new(ProtocolRegistry::with_internal_protocols()),
}
}
impl FetchTaskTarget for FetchResponseCollector {
diff --git a/components/net/tests/resource_thread.rs b/components/net/tests/resource_thread.rs
index 3e33a117bb3..0de76fd5dd1 100644
--- a/components/net/tests/resource_thread.rs
+++ b/components/net/tests/resource_thread.rs
@@ -6,6 +6,7 @@ use std::net::IpAddr;
use ipc_channel::ipc;
use net::connector::CACertificates;
+use net::protocols::ProtocolRegistry;
use net::resource_thread::new_core_resource_thread;
use net::test::parse_hostsfile;
use net_traits::CoreResourceMsg;
@@ -32,6 +33,7 @@ fn test_exit() {
None,
CACertificates::Default,
false, /* ignore_certificate_errors */
+ std::sync::Arc::new(ProtocolRegistry::default()),
);
resource_thread.send(CoreResourceMsg::Exit(sender)).unwrap();
receiver.recv().unwrap();