tizen beta release
[framework/web/webkit-efl.git] / LayoutTests / fast / history / history-length.html
1 <script>
2 onload = function() {
3   if (location.search.substring(1).length == 0) {
4     sessionStorage.testStage = 0;
5     if (window.layoutTestController) {
6       layoutTestController.dumpAsText();
7       layoutTestController.clearBackForwardList();
8       layoutTestController.waitUntilDone();
9     }
10   }
11
12   // Location changes need to happen outside the onload handler to generate history entries.
13   setTimeout(function() {
14     // This test advances history by 2 pages, then navigates back one, and
15     // records history.length.  We expect history.length to indicate the total
16     // length of session history.  At the end of the test, it should be 2 greater
17     // than it was at the start of the test.
18     switch (sessionStorage.testStage++) {
19     case 0:
20       sessionStorage.initialLength = history.length;
21       location = "?a";
22       break;
23     case 1:
24       location = "?b";
25       break;
26     case 2:
27       history.back();
28       break;
29     case 3:
30       if (history.length == (sessionStorage.initialLength - 0) + 2)
31         document.body.innerHTML = "PASS";
32       else
33         document.body.innerHTML = "FAIL: initialLength=" + sessionStorage.initialLength + ", history.length=" + history.length;
34       if (window.layoutTestController)
35         layoutTestController.notifyDone();
36       break;
37     }
38   }, 0);
39 }
40 onunload = function() {
41   // disable page cache
42 }
43 </script>
44 <body></body>