Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/location-new-window-no-crash.html

Issue 2667393002: Stop using script-tests in fast/dom/. (Closed)
Patch Set: . Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/dom/location-new-window-no-crash.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/location-new-window-no-crash.html b/third_party/WebKit/LayoutTests/fast/dom/location-new-window-no-crash.html
index 22fcde2c0616ec6d0b0d5bcca7f38a81e75226c0..d26ab8c6ba5d6979d06e1907cd626a380e2349a8 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/location-new-window-no-crash.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/location-new-window-no-crash.html
@@ -4,6 +4,66 @@
<script src="../../resources/js-test.js"></script>
</head>
<body>
-<script src="script-tests/location-new-window-no-crash.js"></script>
+<script>
+description("Tests that manipulating location properties in a just-created window object does not crash. Note: Turn off pop-up blocking to run this in-browser.");
+
+if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.setCanOpenWindows();
+}
+
+var testWindow = open("data:text/plain,a");
+
+// Note that the window does not navigate to the new URL right away, and that is a crucial element
+// of the test. We're checking behavior when the object was just created and is not yet at its new
+// location.
+
+shouldBe("testWindow.location.toString()", "'about:blank'");
+shouldBe("testWindow.location.href", "'about:blank'");
+shouldBe("testWindow.location.protocol", "'about:'");
+shouldBe("testWindow.location.host", "''"); // Firefox throws an exception
+shouldBe("testWindow.location.hostname", "''"); // Firefox throws an exception
+shouldBe("testWindow.location.port", "''");
+shouldBe("testWindow.location.pathname", "'blank'"); // Firefox returns the empty string
+shouldBe("testWindow.location.search", "''");
+shouldBe("testWindow.location.hash", "''");
+
+shouldBe("testWindow.location.href = 'data:text/plain,b'", "'data:text/plain,b'");
+shouldBe("testWindow.location.protocol = 'data'", "'data'"); // Firefox throws an exception
+shouldBe("testWindow.location.host = 'c'", "'c'"); // Firefox throws an exception
+shouldBe("testWindow.location.hostname = 'd'", "'d'"); // Firefox throws an exception
+shouldBe("testWindow.location.port = 'e'", "'e'"); // Firefox throws an exception
+shouldBe("testWindow.location.pathname = 'f'", "'f'"); // Firefox throws an exception
+shouldBe("testWindow.location.search = 'g'", "'g'");
+shouldBe("testWindow.location.hash = 'h'", "'h'");
+
+shouldBe("testWindow.location.assign('data:text/plain,i')", "undefined");
+shouldBe("testWindow.location.replace('data:text/plain,j')", "undefined");
+shouldBe("testWindow.location.reload()", "undefined");
+
+shouldBe("testWindow.location.toString()", "'about:blank'");
+shouldBe("testWindow.location.href", "'about:blank'");
+shouldBe("testWindow.location.protocol", "'about:'");
+shouldBe("testWindow.location.host", "''"); // Firefox throws an exception
+shouldBe("testWindow.location.hostname", "''"); // Firefox throws an exception
+shouldBe("testWindow.location.port", "''");
+shouldBe("testWindow.location.pathname", "'blank'"); // Firefox returns the empty string
+shouldBe("testWindow.location.search", "''");
+shouldBe("testWindow.location.hash", "''");
+
+testWindow.close();
+
+if (window.testRunner) {
+ function doneHandler()
+ {
+ if (testWindow.closed) {
+ testRunner.notifyDone();
+ return;
+ }
+ setTimeout(doneHandler, 0);
+ }
+ doneHandler();
+}
+</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698