Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /webdriver/classic/protocol/allow_origins.py - WPT Dashboard Interop Dashboard
from copy import deepcopy
import pytest
from support.network import http_request, websocket_request
pytestmark = pytest.mark.asyncio
@pytest.mark.parametrize(
"allow_origins, origin, status",
[
# Valid origins
# Invalid origins
],
)
def test_allow_hosts(configuration, geckodriver, allow_origins, origin, status):
extra_args = ["--allow-origins"] + allow_origins
driver = geckodriver(extra_args=extra_args)
response = http_request(driver.hostname, driver.port, origin=origin)
assert response.status == status
@pytest.mark.parametrize(
"allow_origins, origin, status",
[
(
101,
),
],
ids=["allowed", "not allowed"],
)
async def test_allow_origins_passed_to_remote_agent(
configuration, geckodriver, allow_origins, origin, status
):
config = deepcopy(configuration)
config["capabilities"]["webSocketUrl"] = True
extra_args = ["--allow-origins"] + allow_origins
driver = geckodriver(config=config, extra_args=extra_args)
driver.new_session()
response = websocket_request("127.0.0.1", driver.remote_agent_port, origin=origin)
assert response.status == status
await driver.delete_session()