summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webdriver/tests/bidi/network/add_intercept/invalid.py
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/webdriver/tests/bidi/network/add_intercept/invalid.py')
-rw-r--r--testing/web-platform/tests/webdriver/tests/bidi/network/add_intercept/invalid.py36
1 files changed, 35 insertions, 1 deletions
diff --git a/testing/web-platform/tests/webdriver/tests/bidi/network/add_intercept/invalid.py b/testing/web-platform/tests/webdriver/tests/bidi/network/add_intercept/invalid.py
index ac7b273854..0821ba7782 100644
--- a/testing/web-platform/tests/webdriver/tests/bidi/network/add_intercept/invalid.py
+++ b/testing/web-platform/tests/webdriver/tests/bidi/network/add_intercept/invalid.py
@@ -147,7 +147,8 @@ async def test_params_url_patterns_pattern_protocol_file_invalid_value(bidi_sess
with pytest.raises(error.InvalidArgumentException):
await bidi_session.network.add_intercept(
phases=["beforeRequestSent"],
- url_patterns=[{"type": "pattern", "protocol": value, "hostname": "example.com"}],
+ url_patterns=[
+ {"type": "pattern", "protocol": value, "hostname": "example.com"}],
)
@@ -185,3 +186,36 @@ async def test_params_url_patterns_pattern_search_invalid_value(bidi_session, va
phases=["beforeRequestSent"],
url_patterns=[{"type": "pattern", "search": value}],
)
+
+
+@pytest.mark.parametrize("value", [False, 42, {}, ""])
+async def test_params_contexts_invalid_type(bidi_session, value):
+ with pytest.raises(error.InvalidArgumentException):
+ await bidi_session.network.add_intercept(phases=["beforeRequestSent"], contexts=value)
+
+
+async def test_params_contexts_empty_list(bidi_session):
+ with pytest.raises(error.InvalidArgumentException):
+ await bidi_session.network.add_intercept(phases=["beforeRequestSent"], contexts=[])
+
+
+async def test_params_contexts_context_invalid_value(bidi_session):
+ with pytest.raises(error.NoSuchFrameException):
+ await bidi_session.network.add_intercept(phases=["beforeRequestSent"], contexts=["does not exist"])
+
+
+async def test_params_contexts_context_non_top_level(bidi_session, new_tab, test_page_same_origin_frame):
+ await bidi_session.browsing_context.navigate(
+ context=new_tab["context"],
+ url=test_page_same_origin_frame,
+ wait="complete",
+ )
+
+ contexts = await bidi_session.browsing_context.get_tree(root=new_tab["context"])
+
+ assert len(contexts) == 1
+ assert len(contexts[0]["children"]) == 1
+ child_info = contexts[0]["children"][0]
+
+ with pytest.raises(error.InvalidArgumentException):
+ await bidi_session.network.add_intercept(phases=["beforeRequestSent"], contexts=[child_info['context']])