mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-18 15:55:36 +00:00
Bug 1495513 - [wdspec] Add tests for file protocol. r=ato
Differential Revision: https://phabricator.services.mozilla.com/D20488 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
8a5ac6985a
commit
944e06dfff
@ -1,4 +0,0 @@
|
||||
[get.py]
|
||||
expected:
|
||||
if (os == "win"): TIMEOUT
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1495513
|
@ -1,7 +1,4 @@
|
||||
import json
|
||||
import pytest
|
||||
import types
|
||||
|
||||
from tests.support import platform_name
|
||||
from tests.support.inline import inline
|
||||
from tests.support.asserts import assert_error, assert_success
|
||||
from tests.support.sync import Poll
|
||||
@ -25,33 +22,36 @@ def test_no_browsing_context(session, closed_window):
|
||||
def test_get_current_url_matches_location(session):
|
||||
url = session.execute_script("return window.location.href")
|
||||
|
||||
result = get_current_url(session)
|
||||
assert_success(result, url)
|
||||
response = get_current_url(session)
|
||||
assert_success(response, url)
|
||||
|
||||
|
||||
def test_get_current_url_payload(session):
|
||||
session.start()
|
||||
|
||||
result = get_current_url(session)
|
||||
assert result.status == 200
|
||||
assert isinstance(result.body["value"], basestring)
|
||||
response = get_current_url(session)
|
||||
assert response.status == 200
|
||||
assert isinstance(response.body["value"], basestring)
|
||||
|
||||
|
||||
def test_get_current_url_special_pages(session):
|
||||
session.url = "about:blank"
|
||||
|
||||
result = get_current_url(session)
|
||||
assert_success(result, "about:blank")
|
||||
response = get_current_url(session)
|
||||
assert_success(response, "about:blank")
|
||||
|
||||
|
||||
# TODO(ato): This test requires modification to pass on Windows
|
||||
def test_get_current_url_file_protocol(session):
|
||||
def test_get_current_url_file_protocol(session, server_config):
|
||||
# tests that the browsing context remains the same
|
||||
# when navigated privileged documents
|
||||
session.url = "file:///"
|
||||
path = server_config["doc_root"]
|
||||
if platform_name == "windows":
|
||||
path = path.replace("\\", "/")
|
||||
url = u"file:///{}".format(path)
|
||||
session.url = url
|
||||
|
||||
result = get_current_url(session)
|
||||
assert_success(result, "file:///")
|
||||
response = get_current_url(session)
|
||||
assert_success(response, url)
|
||||
|
||||
|
||||
# TODO(ato): Test for http:// and https:// protocols.
|
||||
@ -60,27 +60,30 @@ def test_get_current_url_file_protocol(session):
|
||||
|
||||
|
||||
def test_set_malformed_url(session):
|
||||
result = session.transport.send("POST",
|
||||
"session/%s/url" % session.session_id,
|
||||
{"url": "foo"})
|
||||
response = session.transport.send(
|
||||
"POST",
|
||||
"session/%s/url" % session.session_id, {"url": "foo"})
|
||||
|
||||
assert_error(response, "invalid argument")
|
||||
|
||||
assert_error(result, "invalid argument")
|
||||
|
||||
def test_get_current_url_after_modified_location(session):
|
||||
start = get_current_url(session)
|
||||
session.execute_script("window.location.href = 'about:blank#wd_test_modification'")
|
||||
Poll(session, message="URL did not change").until(
|
||||
lambda s: get_current_url(s).body["value"] != start.body["value"])
|
||||
lambda s: get_current_url(s).body["value"] != start.body["value"])
|
||||
|
||||
response = get_current_url(session)
|
||||
assert_success(response, "about:blank#wd_test_modification")
|
||||
|
||||
result = get_current_url(session)
|
||||
assert_success(result, "about:blank#wd_test_modification")
|
||||
|
||||
def test_get_current_url_nested_browsing_context(session, create_frame):
|
||||
session.url = "about:blank#wd_from_within_frame"
|
||||
session.switch_frame(create_frame())
|
||||
|
||||
result = get_current_url(session)
|
||||
assert_success(result, "about:blank#wd_from_within_frame")
|
||||
response = get_current_url(session)
|
||||
assert_success(response, "about:blank#wd_from_within_frame")
|
||||
|
||||
|
||||
def test_get_current_url_nested_browsing_contexts(session):
|
||||
session.url = two_frames_doc
|
||||
@ -92,5 +95,5 @@ def test_get_current_url_nested_browsing_contexts(session):
|
||||
inner_frame = session.find.css("iframe", all=False)
|
||||
session.switch_frame(inner_frame)
|
||||
|
||||
result = get_current_url(session)
|
||||
assert_success(result, top_level_url)
|
||||
response = get_current_url(session)
|
||||
assert_success(response, top_level_url)
|
||||
|
@ -1,3 +1,4 @@
|
||||
from tests.support import platform_name
|
||||
from webdriver.transport import Response
|
||||
|
||||
from tests.support.asserts import assert_error, assert_success
|
||||
@ -25,3 +26,17 @@ def test_null_response_value(session):
|
||||
def test_no_browsing_context(session, closed_window):
|
||||
response = navigate_to(session, "foo")
|
||||
assert_error(response, "no such window")
|
||||
|
||||
|
||||
def test_file_protocol(session, server_config):
|
||||
# tests that the browsing context remains the same
|
||||
# when navigated privileged documents
|
||||
path = server_config["doc_root"]
|
||||
if platform_name == "windows":
|
||||
path = path.replace("\\", "/")
|
||||
url = u"file:///{}".format(path)
|
||||
|
||||
response = navigate_to(session, url)
|
||||
assert_success(response)
|
||||
|
||||
assert session.url == url
|
||||
|
Loading…
Reference in New Issue
Block a user