summaryrefslogtreecommitdiffstats
path: root/chrome/test/data/History
diff options
context:
space:
mode:
authormaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-13 13:22:45 +0000
committermaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-13 13:22:45 +0000
commit672eba29c169685bc6b08712098bed16a1eadc72 (patch)
tree6ecea5aa774ce1b8e6a31ec90417bc72f45f27d6 /chrome/test/data/History
parentd5282e72b2da0b27b2a487d8376c44ad795736dc (diff)
downloadchromium_src-672eba29c169685bc6b08712098bed16a1eadc72.zip
chromium_src-672eba29c169685bc6b08712098bed16a1eadc72.tar.gz
chromium_src-672eba29c169685bc6b08712098bed16a1eadc72.tar.bz2
This is the successor to http://codereview.chromium.org/67150
Make forward/backward navigation work even when redirection is involved. Currently, Chrome tries to go back to the page immediately before the current one. This doesn't work if the current page was visited by redirection; redirection just occurs again. With this change, Chrome first tries to find the redirection source of the current page and then to go back to the page before the source. BUG=9663,10531 Tested: unit_tests, ui_tests, manually. Patch contributed by Yuzo Fujishima <yuzo@google.com> Review: http://codereview.chromium.org/100245 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15950 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/data/History')
-rw-r--r--chrome/test/data/History/HistoryHelper.js3
-rw-r--r--chrome/test/data/History/history_length_test1.html66
-rw-r--r--chrome/test/data/History/history_length_test2.html32
-rw-r--r--chrome/test/data/History/history_length_test_page_1.html46
-rw-r--r--chrome/test/data/History/history_length_test_page_2.html37
-rw-r--r--chrome/test/data/History/history_length_test_page_3.html58
-rw-r--r--chrome/test/data/History/history_length_test_page_4.html48
7 files changed, 192 insertions, 98 deletions
diff --git a/chrome/test/data/History/HistoryHelper.js b/chrome/test/data/History/HistoryHelper.js
index 93e0a94..efd2369 100644
--- a/chrome/test/data/History/HistoryHelper.js
+++ b/chrome/test/data/History/HistoryHelper.js
@@ -53,3 +53,6 @@ function createCookie(name,value,days) {
function eraseCookie(name) {
createCookie(name, "", -1);
}
+
+var navigate_backward_cookie = "Navigate_Backward_Cookie";
+var navigate_forward_cookie = "Navigate_Forward_Cookie";
diff --git a/chrome/test/data/History/history_length_test1.html b/chrome/test/data/History/history_length_test1.html
index 5700661..e69de29 100644
--- a/chrome/test/data/History/history_length_test1.html
+++ b/chrome/test/data/History/history_length_test1.html
@@ -1,66 +0,0 @@
-<html>
-<head><title>History test1</title>
-<script src="HistoryHelper.js"></script>
-</head>
-
-<body onload="onLoad();">
-<div id="statusPanel" style="border: 1px solid red; width: 100%">
-History Test1 running....
-</body>
-
-<SCRIPT type="text/javascript">
-var first_run_cookie = "First_History_Test_Run";
-var second_run_cookie = "Second_History_Test_Run";
-
-function onLoad() {
- if (readCookie(second_run_cookie) != null) {
- setTimeout(OnValidateHistoryForSecondRun, 100);
- return true;
- }
-
- if (readCookie(first_run_cookie) != null) {
- setTimeout(OnMoveForwardInHistory, 100);
- return true;
- }
-
- setTimeout(OnNavigateToPage2, 100);
- return true;
-}
-
-function OnValidateHistoryForSecondRun() {
- eraseCookie(first_run_cookie);
- eraseCookie(second_run_cookie);
-
- if (window.history.length != 2) {
- onFailure("History_Length_Test", 1, "Second run history length mismatch");
- return false;
- }
-
- onSuccess("History_Length_Test", 1);
- return true;
-}
-
-function OnMoveForwardInHistory() {
- if (window.history.length != 2) {
- onFailure("History_Length_Test", 1, "History length mismatch in MoveForward navigation");
- return false;
- }
-
- createCookie(second_run_cookie, "1", "1");
- window.history.forward();
- return true;
-}
-
-function OnNavigateToPage2() {
- if (window.history.length != 2) {
- onFailure("History_Length_Test", 1, "History length mismatch in initial navigation");
- return false;
- }
-
- createCookie(first_run_cookie, "1", "1");
- window.location.href = "history_length_test2.html";
- return true;
-}
-
-</SCRIPT>
-</html> \ No newline at end of file
diff --git a/chrome/test/data/History/history_length_test2.html b/chrome/test/data/History/history_length_test2.html
index 39b5ebc..e69de29 100644
--- a/chrome/test/data/History/history_length_test2.html
+++ b/chrome/test/data/History/history_length_test2.html
@@ -1,32 +0,0 @@
-<html>
-<head><title>History test2</title>
-<script src="HistoryHelper.js"></script>
-</head>
-
-<body onload="onLoad();">
-<div id="statusPanel" style="border: 1px solid red; width: 100%">
-History test2....
-<div id="Div1" style="border: 1px solid red; width: 100%">
-</body>
-
-<SCRIPT type="text/javascript">
-function onLoad() {
- setTimeout(OnValidateHistoryLength, 100);
-}
-
-function OnValidateHistoryLength() {
- if (window.history.length != 3) {
- onFailure("History_Length_Test", 1, "History length mismatch in second page OnLoad");
- return false;
- }
-
- window.history.back();
- return true;
-}
-
-function OnEchoHistory() {
- alert(window.history.length);
-}
-
-</SCRIPT>
-</html> \ No newline at end of file
diff --git a/chrome/test/data/History/history_length_test_page_1.html b/chrome/test/data/History/history_length_test_page_1.html
new file mode 100644
index 0000000..b0bfdaf
--- /dev/null
+++ b/chrome/test/data/History/history_length_test_page_1.html
@@ -0,0 +1,46 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head><title>History Test Page 1</title>
+<script type="text/javascript" src="HistoryHelper.js"></script>
+</head>
+
+<body onload="onLoad();">
+<div id="statusPanel" style="border: 1px solid red; width: 100%">
+History Test Page 1....
+</div>
+</body>
+
+<script type="text/javascript">
+
+function onLoad() {
+ if (readCookie(navigate_backward_cookie) != null) {
+ setTimeout(OnNavigateBackward, 100);
+ return true;
+ }
+ setTimeout(OnInitialLoad, 100);
+ return true;
+}
+
+function OnNavigateBackward() {
+ if (window.history.length != 2) {
+ onFailure("History_Length_Test_3", 1,
+ "History length mismatch on navigate backward at page 1");
+ return false;
+ }
+ // Navigate forward from this point on.
+ createCookie(navigate_forward_cookie, "1", "1");
+ window.history.forward();
+ return true;
+}
+
+function OnInitialLoad() {
+ if (window.history.length != 2) {
+ onFailure("History_Length_Test_1", 1,
+ "History length mismatch on initial load at page 1");
+ return false;
+ }
+ onSuccess("History_Length_Test_1", 1);
+ return true;
+}
+
+</script>
+</html> \ No newline at end of file
diff --git a/chrome/test/data/History/history_length_test_page_2.html b/chrome/test/data/History/history_length_test_page_2.html
new file mode 100644
index 0000000..edcecfe
--- /dev/null
+++ b/chrome/test/data/History/history_length_test_page_2.html
@@ -0,0 +1,37 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head><title>History Test Page 2</title>
+<script type="text/javascript" src="HistoryHelper.js"></script>
+</head>
+
+<body onload="onLoad();">
+<div id="statusPanel" style="border: 1px solid red; width: 100%">
+History Test Page 2....
+</div>
+</body>
+
+<script type="text/javascript">
+
+function onLoad() {
+ if (readCookie(navigate_backward_cookie) != null ||
+ readCookie(navigate_forward_cookie) != null) {
+ onFailure("History_Length_Test_3", 1,
+ "Page 2 must not be visited in navigating backward/forward");
+ return false;
+ }
+ setTimeout(OnInitialLoad, 100);
+ return true;
+}
+
+function OnInitialLoad() {
+ if (window.history.length != 3) {
+ onFailure("History_Length_Test_2", 1,
+ "History length mismatch on initial load at page 2");
+ return false;
+ }
+ // Redirect to page 3.
+ window.location.href = "history_length_test_page_3.html";
+ return true;
+}
+
+</script>
+</html> \ No newline at end of file
diff --git a/chrome/test/data/History/history_length_test_page_3.html b/chrome/test/data/History/history_length_test_page_3.html
new file mode 100644
index 0000000..4c9a0a0
--- /dev/null
+++ b/chrome/test/data/History/history_length_test_page_3.html
@@ -0,0 +1,58 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head><title>History Test Page 3</title>
+<script src="HistoryHelper.js"></script>
+</head>
+
+<body onload="onLoad();">
+<div id="statusPanel" style="border: 1px solid red; width: 100%">
+History Test Page 3....
+</div>
+</body>
+
+<script type="text/javascript">
+
+function onLoad() {
+ if (readCookie(navigate_forward_cookie) != null) {
+ setTimeout(OnNavigateForward, 100);
+ return true;
+ }
+ if (readCookie(navigate_backward_cookie)) {
+ setTimeout(OnNavigateBackward, 100);
+ return true;
+ }
+ setTimeout(OnInitialLoad, 100);
+ return true;
+}
+
+function OnInitialLoad() {
+ if (window.history.length != 3) {
+ onFailure("History_Length_Test_2", 1,
+ "History length mismatch on initial load at page 3");
+ return false;
+ }
+ onSuccess("History_Length_Test_2", 1);
+ return true;
+}
+
+function OnNavigateBackward() {
+ if (window.history.length != 3) {
+ onFailure("History_Length_Test_3", 1,
+ "History length mismatch on navigating backward at page 3");
+ return false;
+ }
+ window.history.back();
+ return true;
+}
+
+function OnNavigateForward() {
+ if (window.history.length != 3) {
+ onFailure("History_Length_Test_3", 1,
+ "History length mismatch on navigating forward at page 3");
+ return false;
+ }
+ window.history.forward();
+ return true;
+}
+
+</script>
+</html> \ No newline at end of file
diff --git a/chrome/test/data/History/history_length_test_page_4.html b/chrome/test/data/History/history_length_test_page_4.html
new file mode 100644
index 0000000..a72889c
--- /dev/null
+++ b/chrome/test/data/History/history_length_test_page_4.html
@@ -0,0 +1,48 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head><title>History Test Page 4</title>
+<script src="HistoryHelper.js"></script>
+</head>
+
+<body onload="onLoad();">
+<div id="statusPanel" style="border: 1px solid red; width: 100%">
+History Test Page 4....
+</div>
+</body>
+
+<SCRIPT type="text/javascript">
+
+function onLoad() {
+ if (readCookie(navigate_forward_cookie) != null) {
+ setTimeout(OnNavigateForward, 100);
+ return true;
+ }
+ setTimeout(OnInitialLoad, 100);
+ return true;
+}
+
+function OnInitialLoad() {
+ if (window.history.length != 4) {
+ onFailure("History_Length_Test_3", 1,
+ "History length mismatch on initial load at page 4");
+ return false;
+ }
+ // Navigate backward from this point on.
+ createCookie(navigate_backward_cookie, "1", "1");
+ window.history.back();
+ return true;
+}
+
+function OnNavigateForward() {
+ if (window.history.length != 4) {
+ onFailure("History_Length_Test_3", 1,
+ "History length mismatch on navigating forward at page 4");
+ return false;
+ }
+ eraseCookie(navigate_forward_cookie);
+ eraseCookie(navigate_backward_cookie);
+ onSuccess("History_Length_Test_3", 1);
+ return true;
+}
+
+</SCRIPT>
+</html> \ No newline at end of file