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> |