Stop using testRunner.setPrivateBrowsingEnabled_DEPRECATED() in http/tests/cache...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Sep 2019 04:51:31 +0000 (04:51 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Sep 2019 04:51:31 +0000 (04:51 +0000)
https://bugs.webkit.org/show_bug.cgi?id=201524

Reviewed by Alex Christensen.

Stop using testRunner.setPrivateBrowsingEnabled_DEPRECATED() as it does not do the right thing for WebKit2.
Instead, use the new useEphemeralSession WKTR flag added in r249542.

* http/tests/cache/disk-cache/disk-cache-vary-cookie-expected.txt:
* http/tests/cache/disk-cache/disk-cache-vary-cookie-private-expected.txt: Added.
* http/tests/cache/disk-cache/disk-cache-vary-cookie-private.html: Copied from LayoutTests/http/tests/cache/disk-cache/disk-cache-vary-cookie.html.
* http/tests/cache/disk-cache/disk-cache-vary-cookie.html:

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

LayoutTests/ChangeLog
LayoutTests/http/tests/cache/disk-cache/disk-cache-vary-cookie-expected.txt
LayoutTests/http/tests/cache/disk-cache/disk-cache-vary-cookie-private-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/cache/disk-cache/disk-cache-vary-cookie-private.html [new file with mode: 0644]
LayoutTests/http/tests/cache/disk-cache/disk-cache-vary-cookie.html

index 0801e08..52f9ae2 100644 (file)
@@ -1,5 +1,20 @@
 2019-09-05  Chris Dumez  <cdumez@apple.com>
 
+        Stop using testRunner.setPrivateBrowsingEnabled_DEPRECATED() in http/tests/cache/disk-cache/disk-cache-vary-cookie.html
+        https://bugs.webkit.org/show_bug.cgi?id=201524
+
+        Reviewed by Alex Christensen.
+
+        Stop using testRunner.setPrivateBrowsingEnabled_DEPRECATED() as it does not do the right thing for WebKit2.
+        Instead, use the new useEphemeralSession WKTR flag added in r249542.
+
+        * http/tests/cache/disk-cache/disk-cache-vary-cookie-expected.txt:
+        * http/tests/cache/disk-cache/disk-cache-vary-cookie-private-expected.txt: Added.
+        * http/tests/cache/disk-cache/disk-cache-vary-cookie-private.html: Copied from LayoutTests/http/tests/cache/disk-cache/disk-cache-vary-cookie.html.
+        * http/tests/cache/disk-cache/disk-cache-vary-cookie.html:
+
+2019-09-05  Chris Dumez  <cdumez@apple.com>
+
         Stop using testRunner.setPrivateBrowsingEnabled_DEPRECATED() in plugins/private-browsing-mode.html
         https://bugs.webkit.org/show_bug.cgi?id=201523
 
index d53649c..94fe660 100644 (file)
@@ -61,35 +61,6 @@ response source: Memory cache
 response headers: {"Vary":"Cookie","Cache-control":"max-age=100"}
 response source: Memory cache
 
-Testing memory cache in private browsing
-Setting cookie and loading
-response headers: {"Cache-control":"max-age=100"}
-response source: Network
-
-response headers: {"Vary":"Cookie","Cache-control":"max-age=100"}
-response source: Network
-
-Loading again
-response headers: {"Cache-control":"max-age=100"}
-response source: Memory cache
-
-response headers: {"Vary":"Cookie","Cache-control":"max-age=100"}
-response source: Memory cache
-
-Changing cookie and loading
-response headers: {"Cache-control":"max-age=100"}
-response source: Memory cache
-
-response headers: {"Vary":"Cookie","Cache-control":"max-age=100"}
-response source: Network
-
-Loading again
-response headers: {"Cache-control":"max-age=100"}
-response source: Memory cache
-
-response headers: {"Vary":"Cookie","Cache-control":"max-age=100"}
-response source: Memory cache
-
 PASS successfullyParsed is true
 
 TEST COMPLETE
diff --git a/LayoutTests/http/tests/cache/disk-cache/disk-cache-vary-cookie-private-expected.txt b/LayoutTests/http/tests/cache/disk-cache/disk-cache-vary-cookie-private-expected.txt
new file mode 100644 (file)
index 0000000..d4a5476
--- /dev/null
@@ -0,0 +1,39 @@
+Test that Vary: Cookie in response is handled by caches.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Testing disk cache
+Testing memory cache in private browsing
+Setting cookie and loading
+response headers: {"Cache-control":"max-age=100"}
+response source: Network
+
+response headers: {"Vary":"Cookie","Cache-control":"max-age=100"}
+response source: Network
+
+Loading again
+response headers: {"Cache-control":"max-age=100"}
+response source: Memory cache
+
+response headers: {"Vary":"Cookie","Cache-control":"max-age=100"}
+response source: Memory cache
+
+Changing cookie and loading
+response headers: {"Cache-control":"max-age=100"}
+response source: Memory cache
+
+response headers: {"Vary":"Cookie","Cache-control":"max-age=100"}
+response source: Network
+
+Loading again
+response headers: {"Cache-control":"max-age=100"}
+response source: Memory cache
+
+response headers: {"Vary":"Cookie","Cache-control":"max-age=100"}
+response source: Memory cache
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/http/tests/cache/disk-cache/disk-cache-vary-cookie-private.html b/LayoutTests/http/tests/cache/disk-cache/disk-cache-vary-cookie-private.html
new file mode 100644 (file)
index 0000000..64be1c2
--- /dev/null
@@ -0,0 +1,46 @@
+<!-- webkit-test-runner [ useEphemeralSession=true ] -->
+<script src="/js-test-resources/js-test-pre.js"></script>
+<script src="resources/cache-test.js"></script>
+<body>
+<script>
+
+
+description("Test that Vary: Cookie in response is handled by caches.");
+
+function testCookies(testDiskCache, completionHandler)
+{
+    var tests = [
+      { responseHeaders: {'Cache-control': 'max-age=100'} },
+      { responseHeaders: {'Vary': 'Cookie', 'Cache-control': 'max-age=100'} },
+    ];
+
+    var options = { "ClearMemoryCache" : testDiskCache };
+    debug("Setting cookie and loading");
+    document.cookie = "cookie=" + Math.floor((Math.random() * 1000000000000));
+    loadResourcesWithOptions(tests, options, function () {
+        printResults(tests);
+        debug("Loading again");
+        loadResourcesWithOptions(tests, options, function () {
+            printResults(tests);
+            debug("Changing cookie and loading");
+            document.cookie = "cookie" + Math.floor((Math.random() * 1000000000000));
+            loadResourcesWithOptions(tests, options, function () {
+                printResults(tests);
+                debug("Loading again");
+                loadResourcesWithOptions(tests, options, function () {
+                   printResults(tests);
+                   completionHandler();
+                });
+            });
+        });
+    });
+}
+
+debug("Testing disk cache");
+debug("Testing memory cache in private browsing");
+testCookies(false, function () {
+    finishJSTest();
+});
+
+</script>
+<script src="/js-test-resources/js-test-post.js"></script>
index 289ac8f..e6a246d 100644 (file)
@@ -39,11 +39,7 @@ debug("Testing disk cache");
 testCookies(true, function () {
     debug("Testing memory cache");
     testCookies(false, function () {
-        debug("Testing memory cache in private browsing");
-        testRunner.setPrivateBrowsingEnabled_DEPRECATED(true);
-        testCookies(false, function () {
-            finishJSTest();
-        });
+        finishJSTest();
     });
 });