Bug 1381876 - Correct WPT maximize window tests. r?automatedtester draft
authorAndreas Tolfsen <ato@sny.no>
Tue, 01 Aug 2017 18:25:05 +0100
changeset 619941 da9ab3724243386018465c2255f16753b0de58e0
parent 619651 f685d15e719e7c48b4ffa9d38c82e2909564b72d
child 619942 f695cf4a2382af2e06cf97f409553a3200c4f41b
push id71876
push userbmo:ato@sny.no
push dateWed, 02 Aug 2017 21:47:32 +0000
reviewersautomatedtester
bugs1381876
milestone57.0a1
Bug 1381876 - Correct WPT maximize window tests. r?automatedtester Also adds a test for when the window has been resized to the available dimensions of the screen, and then maximised. MozReview-Commit-ID: CroUe1Kze0P
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/webdriver/tests/maximize_window.py
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -402877,27 +402877,27 @@
     ]
    ],
    "webdriver/tests/element_click/select.py": [
     [
      "/webdriver/tests/element_click/select.py",
      {}
     ]
    ],
+   "webdriver/tests/maximize_window.py": [
+    [
+     "/webdriver/tests/maximize_window.py",
+     {}
+    ]
+   ],
    "webdriver/tests/navigation.py": [
     [
      "/webdriver/tests/navigation.py",
      {}
     ]
-   ],
-   "webdriver/tests/window_maximizing.py": [
-    [
-     "/webdriver/tests/window_maximizing.py",
-     {}
-    ]
    ]
   }
  },
  "paths": {
   "./.codecov.yml": [
    "e2322808739a5977e90896b4755cfc20f4ab2046",
    "support"
   ],
@@ -491873,17 +491873,17 @@
    "6b3d7b9ae7d5b28510385cccaaade09268409cab",
    "testharness"
   ],
   "css/css-align-3/content-distribution/place-content-shorthand-006.html": [
    "016c2ff7902fc01d8368645b7177e3932aa64d42",
    "testharness"
   ],
   "css/css-align-3/default-alignment/justify-items-legacy-001.html": [
-   "31e799b7f436952f136efbab01f1b648d108b3cc",
+   "bcf17f709a9b87ef728262b658d1dfa65afc93bb",
    "testharness"
   ],
   "css/css-align-3/default-alignment/place-items-shorthand-001.html": [
    "cc69bbbee852e6cd203d3f39dac2a1e05a428361",
    "testharness"
   ],
   "css/css-align-3/default-alignment/place-items-shorthand-002.html": [
    "77bb21f97a9448b03da8b97adc3accf1308eb647",
@@ -588921,17 +588921,17 @@
    "3763f117f8973ca9a994354ccbf22cb7114ece7a",
    "testharness"
   ],
   "html/semantics/forms/textfieldselection/selection-start-end.html": [
    "e38a79075e27780327f49e7ae9cadd2558165eac",
    "testharness"
   ],
   "html/semantics/forms/textfieldselection/selection-value-interactions.html": [
-   "0f93258e5237c49fa24efe5180409e48721e8025",
+   "c568d7fe10cb4c2071b5d38530ad601988a789ea",
    "testharness"
   ],
   "html/semantics/forms/textfieldselection/selection.html": [
    "7f3969423e86313ec20846c84f8deecc95048b82",
    "testharness"
   ],
   "html/semantics/forms/textfieldselection/textfieldselection-setRangeText.html": [
    "f824af3b23cc1d0412783dbcbcbdee818a501d56",
@@ -593161,17 +593161,17 @@
    "c1d1054447e116becb50aaf96aad00a25f0a6752",
    "testharness"
   ],
   "intersection-observer/shadow-content.html": [
    "11681640d5c8b2c62229ed5a717172f917d75ba4",
    "testharness"
   ],
   "intersection-observer/timestamp.html": [
-   "cf4e91716ed1d02935c3c73ee639e566cf5b60a4",
+   "b26e1b4b295722e8def9a2d6870465fe4140873c",
    "testharness"
   ],
   "intersection-observer/unclipped-root.html": [
    "67dab96304c745f1b5462bb1074753b09d77fbd1",
    "testharness"
   ],
   "intersection-observer/zero-area-element-hidden.html": [
    "59d854e89ca0d7b035a87376566775ca2f3420e5",
@@ -621680,26 +621680,30 @@
   "webdriver/tests/element_click/__init__.py": [
    "da39a3ee5e6b4b0d3255bfef95601890afd80709",
    "support"
   ],
   "webdriver/tests/element_click/select.py": [
    "5ba51b660c7203bba3ada597c2f56fe094358e1f",
    "wdspec"
   ],
+  "webdriver/tests/maximize_window.py": [
+   "827b3a3e1a3ef628dae1480af029fc01ef5e9388",
+   "wdspec"
+  ],
   "webdriver/tests/navigation.py": [
    "cec2987258d9c807a247da9e0216b3af1f171484",
    "wdspec"
   ],
   "webdriver/tests/support/__init__.py": [
    "5a31a3917a5157516c10951a3b3d5ffb43b992d9",
    "support"
   ],
   "webdriver/tests/support/asserts.py": [
-   "cf1d298a9dc61b07eb9efe1ff3ed98a318d48bc4",
+   "693c848df03b46e7b4f5e17e49fd0879a29a0d1c",
    "support"
   ],
   "webdriver/tests/support/fixtures.py": [
    "6ceec11f42cd9be53a92ad88aa07657c78779ce3",
    "support"
   ],
   "webdriver/tests/support/http_request.py": [
    "01c4b525c27f77d253c75031a9cee3f17aca8df0",
@@ -621712,20 +621716,16 @@
   "webdriver/tests/support/merge_dictionaries.py": [
    "84a6d3c6f8f4afded0f21264bbaeebec38a7f827",
    "support"
   ],
   "webdriver/tests/support/wait.py": [
    "a4b0c9c340ea7055139d9fcab3246ee836d6a441",
    "support"
   ],
-  "webdriver/tests/window_maximizing.py": [
-   "ba6b9109f5baaf6eb300a3f89f984753e9d5adb9",
-   "wdspec"
-  ],
   "webgl/OWNERS": [
    "f8e0703fe2cc88edd21ef2c94fcb2e1a8889f5ae",
    "support"
   ],
   "webgl/bufferSubData.html": [
    "526612470551a0eb157b310c587d50080087808d",
    "testharness"
   ],
--- a/testing/web-platform/tests/webdriver/tests/maximize_window.py
+++ b/testing/web-platform/tests/webdriver/tests/maximize_window.py
@@ -4,35 +4,72 @@ from tests.support.asserts import assert
 alert_doc = inline("<script>window.alert()</script>")
 
 # 10.7.3 Maximize Window
 def test_maximize_no_browsing_context(session, create_window):
     # Step 1
     session.window_handle = create_window()
     session.close()
     result = session.transport.send("POST", "session/%s/window/maximize" % session.session_id)
-
     assert_error(result, "no such window")
 
 
-def test_maximize_rect_alert_prompt(session):
+def test_handle_user_prompt(session):
     # Step 2
     session.url = alert_doc
-
     result = session.transport.send("POST", "session/%s/window/maximize" % session.session_id)
-
     assert_error(result, "unexpected alert open")
 
 
-def test_maximize_payload(session):
-    # step 5
+def test_maximize(session):
+    before = session.window.size
+
+    # step 4
+    result = session.transport.send("POST", "session/%s/window/maximize" % session.session_id)
+    assert_success(result)
+
+    after = session.window.size
+    assert before != after
+
+
+def test_payload(session):
+    before = session.window.size
+
     result = session.transport.send("POST", "session/%s/window/maximize" % session.session_id)
 
+    # step 5
     assert result.status == 200
     assert isinstance(result.body["value"], dict)
-    assert "width" in result.body["value"]
-    assert "height" in result.body["value"]
-    assert "x" in result.body["value"]
-    assert "y" in result.body["value"]
-    assert isinstance(result.body["value"]["width"], float)
-    assert isinstance(result.body["value"]["height"], float)
-    assert isinstance(result.body["value"]["x"], float)
-    assert isinstance(result.body["value"]["y"], float)
+
+    rect = result.body["value"]
+    assert "width" in rect
+    assert "height" in rect
+    assert "x" in rect
+    assert "y" in rect
+    assert isinstance(rect["width"], float)
+    assert isinstance(rect["height"], float)
+    assert isinstance(rect["x"], float)
+    assert isinstance(rect["y"], float)
+
+    after = session.window.size
+    assert before != after
+
+
+def test_maximize_when_resized_to_max_size(session):
+    # Determine the largest available window size by first maximising
+    # the window and getting the window rect dimensions.
+    #
+    # Then resize the window to the maximum available size.
+    session.end()
+    available = session.window.maximize()
+    session.end()
+
+    session.window.size = (int(available["width"]), int(available["height"]))
+
+    # In certain window managers a window extending to the full available
+    # dimensions of the screen may not imply that the window is maximised,
+    # since this is often a special state.  If a remote end expects a DOM
+    # resize event, this may not fire if the window has already reached
+    # its expected dimensions.
+    before = session.window.size
+    session.window.maximize()
+    after = session.window.size
+    assert before == after