Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / test / data / History / history_length_test_page_2.html
blobedc0deede039aca9bb3f8a74cb0632aab9ed4224
1 <html xmlns="http://www.w3.org/1999/xhtml">
2 <head><title>History Test Page 2</title>
3 <script type="text/javascript" src="HistoryHelper.js"></script>
4 </head>
6 <body onload="onLoad();">
7 <div id="statusPanel" style="border: 1px solid red; width: 100%">
8 History Test Page 2....
9 </div>
10 </body>
12 <script type="text/javascript">
14 function onLoad() {
15 // This page could be visited in the following sequences:-
16 // 1. history_length_test_page1->history_length_test_page2.html
17 // 2. history_length_test_page1->history_length_test_page2.html->
18 // redirect to history_length_test_page3.html
19 // ->history_length_test_page4.html->history_length_test_page3.html->
20 // history_length_test_page2.html->history_length_test_page1.html->
21 // history_length_test_page2.html
22 if (readCookie(navigate_forward_cookie) != null) {
23 setTimeout(OnNavigateForward, 0);
24 } else if (readCookie(navigate_backward_cookie) != null) {
25 setTimeout(OnNavigateBackward, 0);
26 } else {
27 setTimeout(OnInitialLoad, 0);
29 return true;
32 function OnNavigateForward() {
33 if (window.history.length != 5) {
34 onFailure("History_Length_Test_2", 1,
35 "History length mismatch on initial load at page 2: " +
36 window.history.length);
37 return false;
39 window.history.forward();
40 return true;
43 function OnNavigateBackward() {
44 if (window.history.length != 5) {
45 onFailure("History_Length_Test_2", 1,
46 "History length mismatch on initial load at page 2: " +
47 window.history.length);
48 return false;
50 window.history.back();
51 return true;
54 function OnInitialLoad() {
55 if (window.history.length != 2 && window.history.length != 3) {
56 onFailure("History_Length_Test_2", 1,
57 "History length mismatch on initial load at page 2: " +
58 window.history.length);
59 return false;
61 // Redirect to page 3.
62 window.location.href = "history_length_test_page_3.html";
63 return true;
66 </script>
67 </html>