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

Unified Diff: LayoutTests/http/tests/loading/state-object-few-arguements-exception.html

Issue 1007113002: The history.pushState/replaceState should check for minimum arity exception. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | LayoutTests/http/tests/loading/state-object-few-arguements-exception-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/loading/state-object-few-arguements-exception.html
diff --git a/LayoutTests/http/tests/loading/state-object-few-arguements-exception.html b/LayoutTests/http/tests/loading/state-object-few-arguements-exception.html
new file mode 100644
index 0000000000000000000000000000000000000000..61f7696a497090e444d21550cb3030b55fbde8b7
--- /dev/null
+++ b/LayoutTests/http/tests/loading/state-object-few-arguements-exception.html
@@ -0,0 +1,90 @@
+<html>
vivekg 2015/03/16 14:37:28 Please use <!DOCTYPE html>
Abhijeet Kandalkar Slow 2015/03/18 10:46:58 Done.
+<head>
+<script>
+
+if (window.testRunner) {
+ testRunner.clearBackForwardList();
+ testRunner.dumpAsText();
+}
+
+function log(txt)
+{
+ document.getElementById("logger").innerText += txt + "\n";
vivekg 2015/03/16 14:37:28 nit: Prefer using ' over " for string literals in
Abhijeet Kandalkar Slow 2015/03/18 10:46:58 Done.
+}
+
+function runPushStateTest()
+{
+ try {
+ history.pushState();
vivekg 2015/03/16 14:37:28 Consider using shouldThrow/shouldNotThrow dialects
vivekg 2015/03/16 14:37:28 Consider using shouldThrow/shouldNotThrow dialects
Abhijeet Kandalkar Slow 2015/03/18 10:46:58 Done.
Abhijeet Kandalkar Slow 2015/03/18 10:46:58 Done.
+ log("Trying to invoke pushState() with 0 arguments succeeded, but should've failed.");
+ } catch(e) {
+ log("Trying to invoke pushState() with 0 arguments failed with exception " + e);
+ }
+
+ try {
+ history.pushState(null);
+ log("Trying to invoke pushState() with 1 arguments succeeded, but should've failed.");
+ } catch(e) {
+ log("Trying to invoke pushState() with 1 arguments failed with exception " + e);
+ }
+
+ try {
+ history.pushState(null, null);
+ log("Trying to invoke pushState() with 2 arguments should've succeeded.");
+ } catch(e) {
+ log("Trying to invoke pushState() with 2 arguments failed with exception " + e);
+ }
+
+ try {
+ history.pushState(null, null, null);
+ log("Trying to invoke pushState() with 3 arguments should've succeeded.");
+ } catch(e) {
+ log("Trying to invoke pushState() with 3 arguments failed with exception " + e);
+ }
+}
+
+function runReplaceStateTest()
+{
+ try {
+ history.replaceState();
+ log("Trying to invoke replaceState() with 0 arguments succeeded, but should've failed.");
+ } catch(e) {
+ log("Trying to invoke replaceState() with 0 arguments failed with exception " + e);
+ }
+
+ try {
+ history.replaceState(null);
+ log("Trying to invoke replaceState() with 1 arguments succeeded, but should've failed.");
+ } catch(e) {
+ log("Trying to invoke replaceState() with 1 arguments failed with exception " + e);
+ }
+
+ try {
+ history.replaceState(null, null);
+ log("Trying to invoke replaceState() with 2 arguments should've succeeded.");
+ } catch(e) {
+ log("Trying to invoke replaceState() with 2 arguments failed with exception " + e);
+ }
+
+ try {
+ history.replaceState(null, null, null);
+ log("Trying to invoke replaceState() with 3 arguments should've succeeded.");
+ } catch(e) {
+ log("Trying to invoke replaceState() with 3 arguments failed with exception " + e);
+ }
+}
+
+function runTest()
+{
+ runPushStateTest();
+ runReplaceStateTest();
vivekg 2015/03/16 14:37:28 bad indentation.
Abhijeet Kandalkar Slow 2015/03/18 10:46:58 Done.
+}
+
+</script>
+<body onload="runTest();">
+<pre>
+This test makes sure that calls to pushState() and replaceState() with less than 2 arguments fail as expected.
+</pre><br>
+<pre id="logger"></pre>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/http/tests/loading/state-object-few-arguements-exception-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698