Bug 1456996 - [wdspec] Fix test_duplicated_cookie for invalid domain usage. r=maja_zf
authorHenrik Skupin <mail@hskupin.info>
Thu, 26 Apr 2018 08:06:02 +0200
changeset 471996 9833513330b4f3468b50ffd9f9ee77a9e5f25449
parent 471995 1f4ce46796fc2e003c0fa58391f39f3fdf35a944
child 471997 9edd64fc07d3d7034c00cf1aa41b9203ecd8bb29
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmaja_zf
bugs1456996
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1456996 - [wdspec] Fix test_duplicated_cookie for invalid domain usage. r=maja_zf MozReview-Commit-ID: 9JDmCxxJvAt
testing/web-platform/meta/webdriver/tests/cookies/get_named_cookie.py.ini
testing/web-platform/tests/webdriver/tests/cookies/get_named_cookie.py
deleted file mode 100644
--- a/testing/web-platform/meta/webdriver/tests/cookies/get_named_cookie.py.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[get_named_cookie.py]
-  [test_duplicated_cookie]
-    expected: FAIL
-
--- a/testing/web-platform/tests/webdriver/tests/cookies/get_named_cookie.py
+++ b/testing/web-platform/tests/webdriver/tests/cookies/get_named_cookie.py
@@ -65,38 +65,39 @@ def test_get_named_cookie(session, url):
     assert cookie["name"] == "foo"
     assert cookie["value"] == "bar"
     # convert from seconds since epoch
     assert datetime.utcfromtimestamp(
         cookie["expiry"]).strftime(utc_string_format) == a_year_from_now
 
 
 def test_duplicated_cookie(session, url, server_config):
+    new_cookie = {
+        "name": "hello",
+        "value": "world",
+        "domain": server_config["browser_host"],
+        "path": "/",
+        "http_only": False,
+        "secure": False
+    }
+
     session.url = url("/common/blank.html")
     clear_all_cookies(session)
-    create_cookie_request = {
-        "cookie": {
-            "name": "hello",
-            "value": "world",
-            "domain": server_config["domains"][""],
-            "path": "/",
-            "httpOnly": False,
-            "secure": False
-        }
-    }
-    result = session.transport.send("POST", "session/%s/cookie" % session.session_id, create_cookie_request)
-    assert result.status == 200
-    assert "value" in result.body
-    assert result.body["value"] is None
 
-    session.url = inline("<script>document.cookie = 'hello=newworld; domain=%s; path=/';</script>" % server_config["domains"][""])
+    session.set_cookie(**new_cookie)
+    session.url = inline("""
+      <script>
+        document.cookie = '{name}=newworld; domain={domain}; path=/';
+      </script>""".format(
+        name=new_cookie["name"],
+        domain=server_config["browser_host"]))
 
-    result = get_named_cookie(session, "hello")
+    result = get_named_cookie(session, new_cookie["name"])
     cookie = assert_success(result)
     assert isinstance(cookie, dict)
 
     assert "name" in cookie
     assert isinstance(cookie["name"], basestring)
     assert "value" in cookie
     assert isinstance(cookie["value"], basestring)
 
-    assert cookie["name"] == "hello"
+    assert cookie["name"] == new_cookie["name"]
     assert cookie["value"] == "newworld"