OLD | NEW |
---|---|
(Empty) | |
1 <html> | |
vivekg
2015/03/16 14:37:28
Please use <!DOCTYPE html>
Abhijeet Kandalkar Slow
2015/03/18 10:46:58
Done.
| |
2 <head> | |
3 <script> | |
4 | |
5 if (window.testRunner) { | |
6 testRunner.clearBackForwardList(); | |
7 testRunner.dumpAsText(); | |
8 } | |
9 | |
10 function log(txt) | |
11 { | |
12 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.
| |
13 } | |
14 | |
15 function runPushStateTest() | |
16 { | |
17 try { | |
18 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.
| |
19 log("Trying to invoke pushState() with 0 arguments succeeded, but should 've failed."); | |
20 } catch(e) { | |
21 log("Trying to invoke pushState() with 0 arguments failed with exception " + e); | |
22 } | |
23 | |
24 try { | |
25 history.pushState(null); | |
26 log("Trying to invoke pushState() with 1 arguments succeeded, but should 've failed."); | |
27 } catch(e) { | |
28 log("Trying to invoke pushState() with 1 arguments failed with exception " + e); | |
29 } | |
30 | |
31 try { | |
32 history.pushState(null, null); | |
33 log("Trying to invoke pushState() with 2 arguments should've succeeded." ); | |
34 } catch(e) { | |
35 log("Trying to invoke pushState() with 2 arguments failed with exception " + e); | |
36 } | |
37 | |
38 try { | |
39 history.pushState(null, null, null); | |
40 log("Trying to invoke pushState() with 3 arguments should've succeeded." ); | |
41 } catch(e) { | |
42 log("Trying to invoke pushState() with 3 arguments failed with exception " + e); | |
43 } | |
44 } | |
45 | |
46 function runReplaceStateTest() | |
47 { | |
48 try { | |
49 history.replaceState(); | |
50 log("Trying to invoke replaceState() with 0 arguments succeeded, but sho uld've failed."); | |
51 } catch(e) { | |
52 log("Trying to invoke replaceState() with 0 arguments failed with except ion " + e); | |
53 } | |
54 | |
55 try { | |
56 history.replaceState(null); | |
57 log("Trying to invoke replaceState() with 1 arguments succeeded, but sho uld've failed."); | |
58 } catch(e) { | |
59 log("Trying to invoke replaceState() with 1 arguments failed with except ion " + e); | |
60 } | |
61 | |
62 try { | |
63 history.replaceState(null, null); | |
64 log("Trying to invoke replaceState() with 2 arguments should've succeede d."); | |
65 } catch(e) { | |
66 log("Trying to invoke replaceState() with 2 arguments failed with except ion " + e); | |
67 } | |
68 | |
69 try { | |
70 history.replaceState(null, null, null); | |
71 log("Trying to invoke replaceState() with 3 arguments should've succeede d."); | |
72 } catch(e) { | |
73 log("Trying to invoke replaceState() with 3 arguments failed with except ion " + e); | |
74 } | |
75 } | |
76 | |
77 function runTest() | |
78 { | |
79 runPushStateTest(); | |
80 runReplaceStateTest(); | |
vivekg
2015/03/16 14:37:28
bad indentation.
Abhijeet Kandalkar Slow
2015/03/18 10:46:58
Done.
| |
81 } | |
82 | |
83 </script> | |
84 <body onload="runTest();"> | |
85 <pre> | |
86 This test makes sure that calls to pushState() and replaceState() with less than 2 arguments fail as expected. | |
87 </pre><br> | |
88 <pre id="logger"></pre> | |
89 </body> | |
90 </html> | |
OLD | NEW |