Merge net and net_tests
22
Cargo.lock
generated
|
@ -1952,28 +1952,6 @@ dependencies = [
|
||||||
"ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "net_tests"
|
|
||||||
version = "0.0.1"
|
|
||||||
dependencies = [
|
|
||||||
"cookie 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"devtools_traits 0.0.1",
|
|
||||||
"flate2 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"hyper-openssl 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"hyper_serde 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"ipc-channel 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"msg 0.0.1",
|
|
||||||
"net 0.0.1",
|
|
||||||
"net_traits 0.0.1",
|
|
||||||
"profile_traits 0.0.1",
|
|
||||||
"servo_config 0.0.1",
|
|
||||||
"servo_url 0.0.1",
|
|
||||||
"time 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "net_traits"
|
name = "net_traits"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
|
|
|
@ -8,6 +8,8 @@ publish = false
|
||||||
[lib]
|
[lib]
|
||||||
name = "net"
|
name = "net"
|
||||||
path = "lib.rs"
|
path = "lib.rs"
|
||||||
|
test = false
|
||||||
|
doctest = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
base64 = "0.6"
|
base64 = "0.6"
|
||||||
|
@ -43,3 +45,7 @@ webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]}
|
||||||
|
|
||||||
[target.'cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))'.dependencies]
|
[target.'cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))'.dependencies]
|
||||||
tinyfiledialogs = "2.5.9"
|
tinyfiledialogs = "2.5.9"
|
||||||
|
|
||||||
|
[[test]]
|
||||||
|
name = "main"
|
||||||
|
path = "tests/main.rs"
|
||||||
|
|
|
@ -8,7 +8,7 @@ use url::Url;
|
||||||
#[test]
|
#[test]
|
||||||
fn load_htm() {
|
fn load_htm() {
|
||||||
let mut path = env::current_dir().expect("didn't get working dir");
|
let mut path = env::current_dir().expect("didn't get working dir");
|
||||||
path.push("test.jpeg");
|
path.push("tests/test.jpeg");
|
||||||
|
|
||||||
let canon_path = path.canonicalize().expect("file path doesn't exist");
|
let canon_path = path.canonicalize().expect("file path doesn't exist");
|
||||||
let url = Url::from_file_path(canon_path);
|
let url = Url::from_file_path(canon_path);
|
|
@ -16,11 +16,11 @@ pub struct TestProvider;
|
||||||
|
|
||||||
impl UIProvider for TestProvider {
|
impl UIProvider for TestProvider {
|
||||||
fn open_file_dialog(&self, _path: &str, _patterns: Vec<FilterPattern>) -> Option<String> {
|
fn open_file_dialog(&self, _path: &str, _patterns: Vec<FilterPattern>) -> Option<String> {
|
||||||
Some("test.jpeg".to_string())
|
Some("tests/test.jpeg".to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn open_file_dialog_multi(&self, _path: &str, _patterns: Vec<FilterPattern>) -> Option<Vec<String>> {
|
fn open_file_dialog_multi(&self, _path: &str, _patterns: Vec<FilterPattern>) -> Option<Vec<String>> {
|
||||||
Some(vec!["test.jpeg".to_string()])
|
Some(vec!["tests/test.jpeg".to_string()])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,18 +28,18 @@ impl UIProvider for TestProvider {
|
||||||
fn test_filemanager() {
|
fn test_filemanager() {
|
||||||
let filemanager = FileManager::new();
|
let filemanager = FileManager::new();
|
||||||
|
|
||||||
// Try to open a dummy file "tests/unit/net/test.jpeg" in tree
|
// Try to open a dummy file "components/net/tests/test.jpeg" in tree
|
||||||
let mut handler = File::open("test.jpeg").expect("test.jpeg is stolen");
|
let mut handler = File::open("tests/test.jpeg").expect("test.jpeg is stolen");
|
||||||
let mut test_file_content = vec![];
|
let mut test_file_content = vec![];
|
||||||
|
|
||||||
handler.read_to_end(&mut test_file_content)
|
handler.read_to_end(&mut test_file_content)
|
||||||
.expect("Read tests/unit/net/test.jpeg error");
|
.expect("Read components/net/tests/test.jpeg error");
|
||||||
|
|
||||||
let patterns = vec![FilterPattern(".txt".to_string())];
|
let patterns = vec![FilterPattern(".txt".to_string())];
|
||||||
let origin = "test.com".to_string();
|
let origin = "test.com".to_string();
|
||||||
|
|
||||||
{
|
{
|
||||||
// Try to select a dummy file "tests/unit/net/test.jpeg"
|
// Try to select a dummy file "components/net/tests/test.jpeg"
|
||||||
let (tx, rx) = ipc::channel().unwrap();
|
let (tx, rx) = ipc::channel().unwrap();
|
||||||
filemanager.handle(FileManagerThreadMsg::SelectFile(patterns.clone(), tx, origin.clone(), None),
|
filemanager.handle(FileManagerThreadMsg::SelectFile(patterns.clone(), tx, origin.clone(), None),
|
||||||
TEST_PROVIDER);
|
TEST_PROVIDER);
|
|
@ -23,7 +23,7 @@ fn read_file(path: &path::Path) -> io::Result<Vec<u8>> {
|
||||||
fn test_sniff_mp4_matcher() {
|
fn test_sniff_mp4_matcher() {
|
||||||
let matcher = Mp4Matcher;
|
let matcher = Mp4Matcher;
|
||||||
|
|
||||||
let p = PathBuf::from("parsable_mime/video/mp4/test.mp4");
|
let p = PathBuf::from("tests/parsable_mime/video/mp4/test.mp4");
|
||||||
let read_result = read_file(&p);
|
let read_result = read_file(&p);
|
||||||
|
|
||||||
match read_result {
|
match read_result {
|
||||||
|
@ -66,7 +66,7 @@ fn test_sniff_with_flags(filename_orig: &path::Path,
|
||||||
let current_working_directory = env::current_dir().unwrap();
|
let current_working_directory = env::current_dir().unwrap();
|
||||||
println!("The current directory is {}", current_working_directory.display());
|
println!("The current directory is {}", current_working_directory.display());
|
||||||
|
|
||||||
let mut filename = PathBuf::from("parsable_mime/");
|
let mut filename = PathBuf::from("tests/parsable_mime/");
|
||||||
filename.push(filename_orig);
|
filename.push(filename_orig);
|
||||||
|
|
||||||
let classifier = MimeClassifier::new();
|
let classifier = MimeClassifier::new();
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 14 B After Width: | Height: | Size: 14 B |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |