Skip to content

Commit de9d58b

Browse files
committed
Bug 1987935 - [wdspec] Fix tests for "emulation.setUserAgentOverride" command. r=webdriver-reviewers,jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D265765
1 parent caf132b commit de9d58b

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

testing/web-platform/tests/webdriver/tests/bidi/emulation/set_user_agent_override/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ async def assert_fetch_user_agent(bidi_session, url):
5757
Helper to assert the right `user-agent` header sent in fetch.
5858
"""
5959

60-
async def assert_navigation_user_agent(context, expected_user_agent):
60+
async def assert_fetch_user_agent(context, expected_user_agent):
6161
echo_link = url("webdriver/tests/support/http_handlers/headers_echo.py")
6262
await bidi_session.browsing_context.navigate(context=context["context"],
6363
url=echo_link,
@@ -75,7 +75,7 @@ async def assert_navigation_user_agent(context, expected_user_agent):
7575
assert user_agent == expected_user_agent, \
7676
f"Fetch expected to send user agent '{expected_user_agent}' but sent '{user_agent}'"
7777

78-
return assert_navigation_user_agent
78+
return assert_fetch_user_agent
7979

8080

8181
@pytest_asyncio.fixture

testing/web-platform/tests/webdriver/tests/bidi/emulation/set_user_agent_override/global.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ async def test_user_agent_set_override_and_reset_globally_and_per_context(
6868

6969
# Reset global override.
7070
await bidi_session.emulation.set_user_agent_override(
71-
user_agent=ANOTHER_USER_AGENT
71+
user_agent=None
7272
)
7373

7474
# The override should be disabled.

testing/web-platform/tests/webdriver/tests/bidi/emulation/set_user_agent_override/user_contexts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ async def test_set_to_user_context_and_then_to_context(bidi_session,
136136

137137
# Remove user context override.
138138
await bidi_session.emulation.set_user_agent_override(
139-
contexts=[context_in_user_context["context"]],
139+
user_contexts=[user_context],
140140
user_agent=None,
141141
)
142142

@@ -147,4 +147,4 @@ async def test_set_to_user_context_and_then_to_context(bidi_session,
147147
await bidi_session.browsing_context.reload(
148148
context=context_in_user_context["context"], wait="complete"
149149
)
150-
await assert_user_agent(context_in_user_context, SOME_USER_AGENT)
150+
await assert_user_agent(context_in_user_context, default_user_agent)

testing/web-platform/tests/webdriver/tests/support/http_handlers/headers_echo.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ def main(request, response):
55
"""Simple handler that returns a response with Cache-Control max-age=3600.
66
"""
77

8-
response.headers.set(b"Content-Type", b"application/json")
8+
response.headers.set(b"Content-Type", b"text/plain")
99

1010
headers_dict = {}
1111
for key, value in request.headers.items():
@@ -24,4 +24,3 @@ def main(request, response):
2424
response.content = json.dumps({
2525
"headers": headers_dict
2626
})
27-

0 commit comments

Comments
 (0)