Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <html> | |
| 2 <head> | |
| 3 <script> | |
| 4 | |
| 5 if (window.testRunner) { | |
| 6 testRunner.clearBackForwardList(); | |
| 7 testRunner.dumpAsText(); | |
| 8 testRunner.waitUntilDone(); | |
| 9 } | |
| 10 | |
| 11 function log(txt) | |
|
dcheng
2017/07/07 23:28:38
It's generally preferred to write tests using the
| |
| 12 { | |
| 13 document.getElementById("logger").innerText += txt + "\n"; | |
| 14 } | |
| 15 | |
| 16 function runTest() | |
| 17 { | |
| 18 // This value must match that in Source/core/frame/History.cpp. | |
| 19 const kStateUpdateLimit = 50; | |
| 20 for (let i = 0; i < kStateUpdateLimit; ++i) { | |
| 21 history.pushState("SpammyHistoryItem", "" + i); | |
| 22 } | |
| 23 log("History length is " + history.length); | |
| 24 | |
| 25 history.pushState("DiscardedSpamItem", "51"); | |
| 26 log("History length is " + history.length); | |
| 27 history.back(); | |
| 28 } | |
| 29 | |
| 30 onpopstate = function(event) | |
| 31 { | |
| 32 log("State popped - " + event.state + " (type " + typeof event.state + ")"); | |
| 33 if (event.state == "OriginalHistoryItem") | |
| 34 history.forward(); | |
| 35 else if (window.testRunner) | |
| 36 testRunner.notifyDone(); | |
| 37 } | |
| 38 | |
| 39 </script> | |
| 40 <body onload="runTest();"> | |
| 41 <pre> | |
| 42 This test does the following: | |
| 43 -Makes kStateUpdateLimit calls to pushState() | |
|
dcheng
2017/07/07 23:28:38
Dare I suggest <ul><li></li></ul> =P
kinuko
2017/07/10 05:10:49
Maybe we should make it clear that it's UA-specifi
palmer
2017/07/10 19:42:25
But it tests behavior in History, which is core to
| |
| 44 -Makes sure the history length is correct | |
| 45 -Makes another call to pushState() | |
| 46 -Makes sure the history length is correct | |
| 47 -Goes back, and makes sure the popstate event is correct | |
| 48 </pre><br> | |
| 49 <pre id="logger"></pre> | |
| 50 </body> | |
| 51 </html> | |
| OLD | NEW |