2008-06-13 Cameron Zwarich <cwzwarich@uwaterloo.ca>
authorcwzwarich@webkit.org <cwzwarich@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Jun 2008 22:32:13 +0000 (22:32 +0000)
committercwzwarich@webkit.org <cwzwarich@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Jun 2008 22:32:13 +0000 (22:32 +0000)
        Reviewed by Darin.

        Add a test for existing loader behaviour in preparation for:

        Bug 19422: Distinct redirects from the same link do not create distinct history items
        <https://bugs.webkit.org/show_bug.cgi?id=19422>

        * http/tests/navigation/redirect-cycle-expected.txt: Added.
        * http/tests/navigation/redirect-cycle.html: Added.
        * http/tests/navigation/resources/redirect-cycle-1.pl: Added.
        * http/tests/navigation/resources/redirect-cycle-2.pl: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@34525 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/navigation/redirect-cycle-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/navigation/redirect-cycle.html [new file with mode: 0644]
LayoutTests/http/tests/navigation/resources/redirect-cycle-1.pl [new file with mode: 0755]
LayoutTests/http/tests/navigation/resources/redirect-cycle-2.pl [new file with mode: 0755]

index 1250bca..0de39b3 100644 (file)
@@ -1,3 +1,17 @@
+2008-06-13  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
+
+        Reviewed by Darin.
+
+        Add a test for existing loader behaviour in preparation for:
+
+        Bug 19422: Distinct redirects from the same link do not create distinct history items
+        <https://bugs.webkit.org/show_bug.cgi?id=19422>
+
+        * http/tests/navigation/redirect-cycle-expected.txt: Added.
+        * http/tests/navigation/redirect-cycle.html: Added.
+        * http/tests/navigation/resources/redirect-cycle-1.pl: Added.
+        * http/tests/navigation/resources/redirect-cycle-2.pl: Added.
+
 2008-06-13  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Darin.
diff --git a/LayoutTests/http/tests/navigation/redirect-cycle-expected.txt b/LayoutTests/http/tests/navigation/redirect-cycle-expected.txt
new file mode 100644 (file)
index 0000000..55c0a3d
--- /dev/null
@@ -0,0 +1,6 @@
+Page 3
+
+============== Back Forward List ==============
+        http://127.0.0.1:8000/navigation/redirect-cycle.html  **nav target**
+curr->  http://127.0.0.1:8000/navigation/resources/redirect-cycle-1.pl  **nav target**
+===============================================
diff --git a/LayoutTests/http/tests/navigation/redirect-cycle.html b/LayoutTests/http/tests/navigation/redirect-cycle.html
new file mode 100644 (file)
index 0000000..9157eb3
--- /dev/null
@@ -0,0 +1,14 @@
+<html>
+<head>
+<script type="text/javascript">
+function startTest()
+{
+    layoutTestController.dumpAsText();
+    layoutTestController.queueLoad("resources/redirect-cycle-1.pl");
+}
+</script>
+</head>
+<body onload="startTest();">
+<div>Original page</div>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/navigation/resources/redirect-cycle-1.pl b/LayoutTests/http/tests/navigation/resources/redirect-cycle-1.pl
new file mode 100755 (executable)
index 0000000..926bb8d
--- /dev/null
@@ -0,0 +1,42 @@
+#!/usr/bin/perl
+
+$count = 1;
+
+@cookies = split(/;/, $ENV{'HTTP_COOKIE'});
+foreach $pair (@cookies)
+{
+    ($name, $value) = split(/=/, $pair);
+    
+    $name =~ s/^\s+//;
+    $name =~ s/\s+$//;
+    
+    if ($name eq "redirect-cycle-count") {
+        $count = $value;
+    }
+}
+
+if ($count eq 1) {
+    print "Status: 302 Moved Temporarily\r\n";
+    print "Location: redirect-cycle-2.pl\r\n";
+    print "Content-type: text/html\r\n";
+    print "Set-Cookie: redirect-cycle-count=2\r\n";
+    print "\r\n";
+    print "<html>";
+    print "<body>";
+    print "<div>Page 1</div>";
+    print "</body>";
+    print "</html>";
+} else {
+    print "Content-type: text/html\r\n";
+    print "\r\n";
+    print "<html>";
+    print "<head>";
+    print "<script type='text/javascript'>";
+    print "function startTest() { layoutTestController.dumpBackForwardList(); }";
+    print "</script>";
+    print "</head>";
+    print "<body onload='startTest();'>";
+    print "<div>Page 3</div>";
+    print "</body>";
+    print "</html>";
+}
diff --git a/LayoutTests/http/tests/navigation/resources/redirect-cycle-2.pl b/LayoutTests/http/tests/navigation/resources/redirect-cycle-2.pl
new file mode 100755 (executable)
index 0000000..9e022d8
--- /dev/null
@@ -0,0 +1,11 @@
+#!/usr/bin/perl
+
+print "Status: 302 Moved Temporarily\r\n";
+print "Location: redirect-cycle-1.pl\r\n";
+print "Content-type: text/html\r\n";
+print "\r\n";
+print "<html>";
+print "<body>";
+print "<div>Page 2</div>";
+print "</body>";
+print "</html>";