mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Auto merge of #6793 - notriddle:hsts-preload, r=jdm
Add basic unit test for `preload_hsts_domains`. Closes #6789. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6793) <!-- Reviewable:end -->
This commit is contained in:
commit
2df88ee4b9
1 changed files with 7 additions and 1 deletions
|
@ -5,7 +5,7 @@
|
||||||
use net::hsts::HSTSList;
|
use net::hsts::HSTSList;
|
||||||
use net::hsts::HSTSEntry;
|
use net::hsts::HSTSEntry;
|
||||||
use net_traits::IncludeSubdomains;
|
use net_traits::IncludeSubdomains;
|
||||||
use net::hsts::secure_url;
|
use net::hsts::{secure_url, preload_hsts_domains};
|
||||||
use net::resource_task::ResourceManager;
|
use net::resource_task::ResourceManager;
|
||||||
use std::sync::mpsc::channel;
|
use std::sync::mpsc::channel;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
@ -271,6 +271,12 @@ fn test_hsts_list_with_expired_entry_is_not_is_host_secure() {
|
||||||
assert!(!hsts_list.is_host_secure("mozilla.org"));
|
assert!(!hsts_list.is_host_secure("mozilla.org"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_preload_hsts_domains_well_formed() {
|
||||||
|
let hsts_list = preload_hsts_domains().unwrap();
|
||||||
|
assert!(hsts_list.entries.len() != 0);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_secure_url_does_not_change_explicit_port() {
|
fn test_secure_url_does_not_change_explicit_port() {
|
||||||
let url = Url::parse("http://mozilla.org:8080/").unwrap();
|
let url = Url::parse("http://mozilla.org:8080/").unwrap();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue