-
-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
64 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod navigator; |
17 changes: 17 additions & 0 deletions
17
integration_tests/rust_builder/rust/src/navigator/navigator.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use webf_sys::ExecutingContext; | ||
|
||
pub fn test_hardware_concurrency(context: ExecutingContext) { | ||
let navigator = context.navigator(); | ||
let exception_state = context.create_exception_state(); | ||
let hardware_concurrency = navigator.hardware_concurrency(&exception_state); | ||
|
||
assert!(hardware_concurrency > 0); | ||
} | ||
|
||
pub fn test_user_agent(context: ExecutingContext) { | ||
let navigator = context.navigator(); | ||
let exception_state = context.create_exception_state(); | ||
let ua_string = navigator.user_agent(&exception_state); | ||
|
||
assert!(ua_string.contains("WebF")); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod set; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use webf_sys::ExecutingContext; | ||
|
||
pub fn test_local_storage_method_access(context: ExecutingContext) { | ||
let storage = context.local_storage(); | ||
let exception_state = context.create_exception_state(); | ||
storage.clear(&exception_state); | ||
|
||
let keys = storage.get_all_keys(&exception_state); | ||
assert_eq!(keys.len(), 0); | ||
|
||
storage.set_item("name", "user1", &exception_state).unwrap(); | ||
|
||
let keys = storage.get_all_keys(&exception_state); | ||
assert_eq!(keys.len(), 1); | ||
|
||
storage.remove_item("name", &exception_state).unwrap(); | ||
|
||
let keys = storage.get_all_keys(&exception_state); | ||
assert_eq!(keys.len(), 0); | ||
} | ||
|
||
pub fn test_session_storage_method_access(context: ExecutingContext) { | ||
let storage = context.session_storage(); | ||
let exception_state = context.create_exception_state(); | ||
storage.clear(&exception_state); | ||
|
||
let keys = storage.get_all_keys(&exception_state); | ||
assert_eq!(keys.len(), 0); | ||
|
||
storage.set_item("name", "user1", &exception_state).unwrap(); | ||
|
||
let keys = storage.get_all_keys(&exception_state); | ||
assert_eq!(keys.len(), 1); | ||
|
||
storage.remove_item("name", &exception_state).unwrap(); | ||
|
||
let keys = storage.get_all_keys(&exception_state); | ||
assert_eq!(keys.len(), 0); | ||
} |