mirror of
https://github.com/servo/servo.git
synced 2025-06-06 08:35:43 +00:00
Fix broken unit-test of webview (#36238)
This PR fixes the broken unit-test after [#35662](https://github.com/servo/servo/pull/35662) Testing: Verified locally and CI confirms too. Fixes: Migrate the test to use new API cc: @xiaochengh Signed-off-by: Shubham Gupta <shubham13297@gmail.com>
This commit is contained in:
parent
4402b7cf8f
commit
520a7f7bc5
2 changed files with 11 additions and 9 deletions
|
@ -946,7 +946,7 @@ mod test {
|
|||
BrowsingContextId, BrowsingContextIndex, PipelineNamespace, PipelineNamespaceId, WebViewId,
|
||||
};
|
||||
|
||||
use crate::webview::{UnknownWebView, WebViewAlreadyExists, WebViewManager};
|
||||
use crate::webview::{UnknownWebView, WebViewManager};
|
||||
|
||||
fn top_level_id(namespace_id: u32, index: u32) -> WebViewId {
|
||||
WebViewId(BrowsingContextId {
|
||||
|
@ -970,10 +970,13 @@ mod test {
|
|||
PipelineNamespace::install(PipelineNamespaceId(0));
|
||||
let mut webviews = WebViewManager::default();
|
||||
|
||||
// add() adds the webview to the map, but not the painting order.
|
||||
assert!(webviews.add(WebViewId::new(), 'a').is_ok());
|
||||
assert!(webviews.add(WebViewId::new(), 'b').is_ok());
|
||||
assert!(webviews.add(WebViewId::new(), 'c').is_ok());
|
||||
// entry() adds the webview to the map, but not the painting order.
|
||||
webviews.entry(WebViewId::new()).or_insert('a');
|
||||
webviews.entry(WebViewId::new()).or_insert('b');
|
||||
webviews.entry(WebViewId::new()).or_insert('c');
|
||||
assert!(webviews.get(top_level_id(0, 1)).is_some());
|
||||
assert!(webviews.get(top_level_id(0, 2)).is_some());
|
||||
assert!(webviews.get(top_level_id(0, 3)).is_some());
|
||||
assert_eq!(
|
||||
webviews_sorted(&webviews),
|
||||
vec![
|
||||
|
@ -985,10 +988,8 @@ mod test {
|
|||
assert!(webviews.painting_order.is_empty());
|
||||
|
||||
// add() returns WebViewAlreadyExists if the webview id already exists.
|
||||
assert_eq!(
|
||||
webviews.add(top_level_id(0, 3), 'd'),
|
||||
Err(WebViewAlreadyExists(top_level_id(0, 3)))
|
||||
);
|
||||
webviews.entry(top_level_id(0, 3)).or_insert('d');
|
||||
assert!(webviews.get(top_level_id(0, 3)).is_some());
|
||||
|
||||
// Other methods return UnknownWebView or None if the webview id doesn’t exist.
|
||||
assert_eq!(
|
||||
|
|
|
@ -162,6 +162,7 @@ class MachCommands(CommandBase):
|
|||
self_contained_tests = [
|
||||
"background_hang_monitor",
|
||||
"base",
|
||||
"compositing",
|
||||
"constellation",
|
||||
"devtools",
|
||||
"fonts",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue