Title: [220626] trunk
Revision
220626
Author
cdu...@apple.com
Date
2017-08-12 14:58:45 -0700 (Sat, 12 Aug 2017)

Log Message

Address flakiness related to download tests
https://bugs.webkit.org/show_bug.cgi?id=175338

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Rebaseline several WPT tests now that download callbacks are no longer logged.

* web-platform-tests/html/semantics/embedded-content/the-area-element/area-download-click-expected.txt:
* web-platform-tests/html/semantics/text-level-semantics/the-a-element/a-download-click-expected.txt:

Tools:

- Update WKTR so that the flag set by testRunner.waitUntilDownloadFinished()
  is actually queried when a download completes. Previously, this would be
  identical to a call to testRunner.waitUntilDone() because any download
  completion would call testRunner.notifyDone().
- Disable logging of download callbacks by default and add a
  testRunner.setShouldLogDownloadCallbacks(true) API to allow tests to
  enable such logging.

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::didReceiveMessageToPage):
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setShouldLogDownloadCallbacks):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::downloadDidStart):
(WTR::TestController::decideDestinationWithSuggestedFilename):
(WTR::TestController::downloadDidFinish):
(WTR::TestController::downloadDidFail):
(WTR::TestController::downloadDidCancel):
* WebKitTestRunner/TestController.h:
(WTR::TestController::setShouldLogDownloadCallbacks):
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):

LayoutTests:

* TestExpectations:
Unmark several download tests as flaky.

* fast/dom/HTMLAnchorElement/anchor-download-synthetic-click.html:
* fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html:
* fast/dom/HTMLAnchorElement/anchor-download.html:
* fast/dom/HTMLAnchorElement/anchor-file-blob-convert-to-download.html:
* fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-backslash.html:
* fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-doublequote.html:
* fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-slashes.html:
* fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-unicode.html:
* fast/dom/HTMLAnchorElement/anchor-file-blob-download-no-extension.html:
* fast/dom/HTMLAnchorElement/anchor-file-blob-download.html:
* fast/dom/HTMLAnchorElement/anchor-nodownload-set.html:
* http/tests/download/anchor-download-attribute-content-disposition.html:
* http/tests/download/anchor-download-no-extension.html:
* http/tests/download/anchor-download-no-value.html:
* http/tests/download/area-download-expected.txt:
* http/tests/download/area-download.html:
* http/tests/security/anchor-download-allow-blob-expected.txt:
* http/tests/security/anchor-download-allow-blob.html:
* http/tests/security/anchor-download-allow-data-expected.txt:
* http/tests/security/anchor-download-allow-data.html:
* http/tests/security/anchor-download-allow-sameorigin.html:
Update download tests to explicitly enable download callbacks logging.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (220625 => 220626)


--- trunk/LayoutTests/ChangeLog	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/LayoutTests/ChangeLog	2017-08-12 21:58:45 UTC (rev 220626)
@@ -1,3 +1,36 @@
+2017-08-12  Chris Dumez  <cdu...@apple.com>
+
+        Address flakiness related to download tests
+        https://bugs.webkit.org/show_bug.cgi?id=175338
+
+        Reviewed by Ryosuke Niwa.
+
+        * TestExpectations:
+        Unmark several download tests as flaky.
+
+        * fast/dom/HTMLAnchorElement/anchor-download-synthetic-click.html:
+        * fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html:
+        * fast/dom/HTMLAnchorElement/anchor-download.html:
+        * fast/dom/HTMLAnchorElement/anchor-file-blob-convert-to-download.html:
+        * fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-backslash.html:
+        * fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-doublequote.html:
+        * fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-slashes.html:
+        * fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-unicode.html:
+        * fast/dom/HTMLAnchorElement/anchor-file-blob-download-no-extension.html:
+        * fast/dom/HTMLAnchorElement/anchor-file-blob-download.html:
+        * fast/dom/HTMLAnchorElement/anchor-nodownload-set.html:
+        * http/tests/download/anchor-download-attribute-content-disposition.html:
+        * http/tests/download/anchor-download-no-extension.html:
+        * http/tests/download/anchor-download-no-value.html:
+        * http/tests/download/area-download-expected.txt:
+        * http/tests/download/area-download.html:
+        * http/tests/security/anchor-download-allow-blob-expected.txt:
+        * http/tests/security/anchor-download-allow-blob.html:
+        * http/tests/security/anchor-download-allow-data-expected.txt:
+        * http/tests/security/anchor-download-allow-data.html:
+        * http/tests/security/anchor-download-allow-sameorigin.html:
+        Update download tests to explicitly enable download callbacks logging.
+
 2017-08-11  Chris Dumez  <cdu...@apple.com>
 
         Implement quota limitation for keepalive Fetch requests

Modified: trunk/LayoutTests/TestExpectations (220625 => 220626)


--- trunk/LayoutTests/TestExpectations	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/LayoutTests/TestExpectations	2017-08-12 21:58:45 UTC (rev 220626)
@@ -1175,10 +1175,8 @@
 imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-details-element/toggleEvent.html [ Pass Failure ]
 webkit.org/b/168175 imported/w3c/web-platform-tests/html/semantics/grouping-content/the-li-element/grouping-li-reftest-list-owner-skip-no-boxes.html [ ImageOnlyFailure ]
 webkit.org/b/168175 imported/w3c/web-platform-tests/html/semantics/grouping-content/the-li-element/grouping-li-reftest-list-owner-menu.html [ ImageOnlyFailure ]
-webkit.org/b/168175 imported/w3c/web-platform-tests/html/semantics/embedded-content/the-area-element/area-download-click.html [ Pass Failure ]
 webkit.org/b/168175 imported/w3c/web-platform-tests/html/browsers/browsing-the-web/history-traversal/same-url.html [ Pass Failure ]
 webkit.org/b/168175 imported/w3c/web-platform-tests/html/browsers/offline/browser-state/navigator_online_online.html [ Pass Failure ]
-webkit.org/b/168175 imported/w3c/web-platform-tests/html/semantics/text-level-semantics/the-a-element/a-download-click.html [ Timeout Pass Failure ]
 webkit.org/b/169264 imported/w3c/web-platform-tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-navigation-samedoc.html [ Failure ]
 
 imported/w3c/web-platform-tests/XMLHttpRequest/open-url-redirected-worker-origin.htm [ Failure Pass  ]

Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-download-synthetic-click.html (220625 => 220626)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-download-synthetic-click.html	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-download-synthetic-click.html	2017-08-12 21:58:45 UTC (rev 220626)
@@ -1,10 +1,11 @@
 <!DOCTYPE html>
 <html>
 <head>
-<script type='text/_javascript_'>
+<script>
 if (window.testRunner) {
   testRunner.dumpAsText();
-  testRunner.waitUntilDone();
+  testRunner.setShouldLogDownloadCallbacks(true);
+  testRunner.waitUntilDownloadFinished();
 }
 </script>
 </head>
@@ -20,9 +21,6 @@
     var link = document.getElementById("blob-url");
     link.href = ""
     link.click();
-    setTimeout(function() {
-        testRunner.notifyDone();
-    }, 100);
 }
 runTest();
 </script>

Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html (220625 => 220626)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html	2017-08-12 21:58:45 UTC (rev 220626)
@@ -1,10 +1,11 @@
 <!DOCTYPE html>
 <html>
 <head>
-<script type='text/_javascript_'>
+<script>
 if (window.testRunner) {
   testRunner.dumpAsText();
-  testRunner.waitUntilDone();
+  testRunner.setShouldLogDownloadCallbacks(true);
+  testRunner.waitUntilDownloadFinished();
 }
 </script>
 </head>
@@ -36,9 +37,6 @@
         link.click();
     }
     userClick(button);
-    setTimeout(function() {
-        testRunner.notifyDone();
-    }, 100);
 }
 runTest();
 </script>

Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-download.html (220625 => 220626)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-download.html	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-download.html	2017-08-12 21:58:45 UTC (rev 220626)
@@ -1,10 +1,11 @@
 <!DOCTYPE html>
 <html>
 <head>
-<script type='text/_javascript_'>
+<script>
 if (window.testRunner) {
   testRunner.dumpAsText();
-  testRunner.waitUntilDone();
+  testRunner.setShouldLogDownloadCallbacks(true);
+  testRunner.waitUntilDownloadFinished();
 }
 </script>
 </head>

Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-convert-to-download.html (220625 => 220626)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-convert-to-download.html	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-convert-to-download.html	2017-08-12 21:58:45 UTC (rev 220626)
@@ -1,10 +1,11 @@
 <!DOCTYPE html>
 <html>
 <head>
-<script type='text/_javascript_'>
+<script>
 if (window.testRunner) {
   testRunner.dumpAsText();
-  testRunner.waitUntilDone();
+  testRunner.setShouldLogDownloadCallbacks(true);
+  testRunner.waitUntilDownloadFinished();
   testRunner.setShouldDownloadUndisplayableMIMETypes(true);
 }
 </script>

Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-backslash.html (220625 => 220626)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-backslash.html	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-backslash.html	2017-08-12 21:58:45 UTC (rev 220626)
@@ -1,10 +1,11 @@
 <!DOCTYPE html>
 <html>
 <head>
-<script type='text/_javascript_'>
+<script>
 if (window.testRunner) {
   testRunner.dumpAsText();
-  testRunner.waitUntilDone();
+  testRunner.setShouldLogDownloadCallbacks(true);
+  testRunner.waitUntilDownloadFinished();
 }
 </script>
 </head>

Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-doublequote.html (220625 => 220626)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-doublequote.html	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-doublequote.html	2017-08-12 21:58:45 UTC (rev 220626)
@@ -1,10 +1,11 @@
 <!DOCTYPE html>
 <html>
 <head>
-<script type='text/_javascript_'>
+<script>
 if (window.testRunner) {
   testRunner.dumpAsText();
-  testRunner.waitUntilDone();
+  testRunner.setShouldLogDownloadCallbacks(true);
+  testRunner.waitUntilDownloadFinished();
 }
 </script>
 </head>

Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-slashes.html (220625 => 220626)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-slashes.html	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-slashes.html	2017-08-12 21:58:45 UTC (rev 220626)
@@ -1,10 +1,11 @@
 <!DOCTYPE html>
 <html>
 <head>
-<script type='text/_javascript_'>
+<script>
 if (window.testRunner) {
   testRunner.dumpAsText();
-  testRunner.waitUntilDone();
+  testRunner.setShouldLogDownloadCallbacks(true);
+  testRunner.waitUntilDownloadFinished();
 }
 </script>
 </head>

Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-unicode.html (220625 => 220626)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-unicode.html	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-unicode.html	2017-08-12 21:58:45 UTC (rev 220626)
@@ -2,10 +2,11 @@
 <html>
 <head>
 <meta charset="utf-8">
-<script type='text/_javascript_'>
+<script>
 if (window.testRunner) {
   testRunner.dumpAsText();
-  testRunner.waitUntilDone();
+  testRunner.setShouldLogDownloadCallbacks(true);
+  testRunner.waitUntilDownloadFinished();
 }
 </script>
 </head>

Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-no-extension.html (220625 => 220626)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-no-extension.html	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-no-extension.html	2017-08-12 21:58:45 UTC (rev 220626)
@@ -1,10 +1,11 @@
 <!DOCTYPE html>
 <html>
 <head>
-<script type='text/_javascript_'>
+<script>
 if (window.testRunner) {
   testRunner.dumpAsText();
-  testRunner.waitUntilDone();
+  testRunner.setShouldLogDownloadCallbacks(true);
+  testRunner.waitUntilDownloadFinished();
 }
 </script>
 </head>

Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download.html (220625 => 220626)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download.html	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download.html	2017-08-12 21:58:45 UTC (rev 220626)
@@ -1,10 +1,11 @@
 <!DOCTYPE html>
 <html>
 <head>
-<script type='text/_javascript_'>
+<script>
 if (window.testRunner) {
   testRunner.dumpAsText();
-  testRunner.waitUntilDone();
+  testRunner.setShouldLogDownloadCallbacks(true);
+  testRunner.waitUntilDownloadFinished();
 }
 </script>
 </head>

Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-nodownload-set.html (220625 => 220626)


--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-nodownload-set.html	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-nodownload-set.html	2017-08-12 21:58:45 UTC (rev 220626)
@@ -1,10 +1,11 @@
 <!DOCTYPE html>
 <html>
 <head>
-<script type='text/_javascript_'>
+<script>
 if (window.testRunner) {
   testRunner.dumpAsText();
-  testRunner.waitUntilDone();
+  testRunner.setShouldLogDownloadCallbacks(true);
+  testRunner.waitUntilDownloadFinished();
 }
 </script>
 </head>
@@ -24,7 +25,7 @@
 
 function runTest()
 {
-    var string = "<!doctype html><html><head><title>Title</title><script>if (window.testRunner) testRunner.dumpAsText(); </" + "script></head><body>PASS</body><script>if (window.testRunner) testRunner.notifyDone();</scr" + "ipt></html>";
+    var string = "<!doctype html><html><head><title>Title</title><script>if (window.testRunner) testRunner.dumpAsText(); </" + "script></head><body>FAIL</body><script>if (window.testRunner) testRunner.notifyDone();</scr" + "ipt></html>";
     var blob = new Blob([string], {type: "text/html"});
     var link = document.getElementById("blob-url");
     link.href = ""

Modified: trunk/LayoutTests/http/tests/download/anchor-download-attribute-content-disposition.html (220625 => 220626)


--- trunk/LayoutTests/http/tests/download/anchor-download-attribute-content-disposition.html	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/LayoutTests/http/tests/download/anchor-download-attribute-content-disposition.html	2017-08-12 21:58:45 UTC (rev 220626)
@@ -1,10 +1,11 @@
 <!DOCTYPE html>
 <html>
 <head>
-<script type='text/_javascript_'>
+<script>
 if (window.testRunner) {
   testRunner.dumpAsText();
-  testRunner.waitUntilDone();
+  testRunner.setShouldLogDownloadCallbacks(true);
+  testRunner.waitUntilDownloadFinished();
 }
 </script>
 </head>

Modified: trunk/LayoutTests/http/tests/download/anchor-download-no-extension.html (220625 => 220626)


--- trunk/LayoutTests/http/tests/download/anchor-download-no-extension.html	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/LayoutTests/http/tests/download/anchor-download-no-extension.html	2017-08-12 21:58:45 UTC (rev 220626)
@@ -1,10 +1,11 @@
 <!DOCTYPE html>
 <html>
 <head>
-<script type='text/_javascript_'>
+<script>
 if (window.testRunner) {
   testRunner.dumpAsText();
-  testRunner.waitUntilDone();
+  testRunner.setShouldLogDownloadCallbacks(true);
+  testRunner.waitUntilDownloadFinished();
 }
 </script>
 </head>

Modified: trunk/LayoutTests/http/tests/download/anchor-download-no-value.html (220625 => 220626)


--- trunk/LayoutTests/http/tests/download/anchor-download-no-value.html	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/LayoutTests/http/tests/download/anchor-download-no-value.html	2017-08-12 21:58:45 UTC (rev 220626)
@@ -1,10 +1,11 @@
 <!DOCTYPE html>
 <html>
 <head>
-<script type='text/_javascript_'>
+<script>
 if (window.testRunner) {
   testRunner.dumpAsText();
-  testRunner.waitUntilDone();
+  testRunner.setShouldLogDownloadCallbacks(true);
+  testRunner.waitUntilDownloadFinished();
 }
 </script>
 </head>

Modified: trunk/LayoutTests/http/tests/download/area-download-expected.txt (220625 => 220626)


--- trunk/LayoutTests/http/tests/download/area-download-expected.txt	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/LayoutTests/http/tests/download/area-download-expected.txt	2017-08-12 21:58:45 UTC (rev 220626)
@@ -5,8 +5,3 @@
 Tests that the download attribute on area elements is working.
 
 The suggested filename at the top should be foo.pdf.
-
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Modified: trunk/LayoutTests/http/tests/download/area-download.html (220625 => 220626)


--- trunk/LayoutTests/http/tests/download/area-download.html	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/LayoutTests/http/tests/download/area-download.html	2017-08-12 21:58:45 UTC (rev 220626)
@@ -1,10 +1,12 @@
 <!DOCTYPE html>
 <html>
 <head>
-<script src=""
 <script>
-    if (window.testRunner)
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.setShouldLogDownloadCallbacks(true);
         testRunner.waitUntilDownloadFinished();
+    }
 </script>
 </head>
 <body>
@@ -14,7 +16,6 @@
 </map>
 <p>Tests that the download attribute on area elements is working.</p>
 <p>The suggested filename at the top should be foo.pdf.</p>
-<div id="console"></div>
 <script>
     function click(elmt)
     {
@@ -35,6 +36,5 @@
         runTest();
     }
 </script>
-<script src=""
 </body>
 </html>

Modified: trunk/LayoutTests/http/tests/security/anchor-download-allow-blob-expected.txt (220625 => 220626)


--- trunk/LayoutTests/http/tests/security/anchor-download-allow-blob-expected.txt	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/LayoutTests/http/tests/security/anchor-download-allow-blob-expected.txt	2017-08-12 21:58:45 UTC (rev 220626)
@@ -4,8 +4,3 @@
 Tests that a suggested filename on a download attribute is allowed if the link is a blob URL.
 
 The suggested filename at the top should be foo.pdf.
-
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Modified: trunk/LayoutTests/http/tests/security/anchor-download-allow-blob.html (220625 => 220626)


--- trunk/LayoutTests/http/tests/security/anchor-download-allow-blob.html	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/LayoutTests/http/tests/security/anchor-download-allow-blob.html	2017-08-12 21:58:45 UTC (rev 220626)
@@ -1,10 +1,12 @@
 <!DOCTYPE html>
 <html>
 <head>
-<script src=""
 <script>
-    if (window.testRunner)
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.setShouldLogDownloadCallbacks(true);
         testRunner.waitUntilDownloadFinished();
+    }
 </script>
 </head>
 <body>
@@ -12,7 +14,6 @@
 Tests that a suggested filename on a download attribute is allowed if
 <a id="dl" download="foo.pdf">the link</a> is a blob URL.
 <p>The suggested filename at the top should be foo.pdf.</p>
-<div id="console"></div>    
 <script>
     function click(elmt)
     {
@@ -33,6 +34,5 @@
     }
     runTest();
 </script>
-<script src=""
 </body>
 </html>

Modified: trunk/LayoutTests/http/tests/security/anchor-download-allow-data-expected.txt (220625 => 220626)


--- trunk/LayoutTests/http/tests/security/anchor-download-allow-data-expected.txt	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/LayoutTests/http/tests/security/anchor-download-allow-data-expected.txt	2017-08-12 21:58:45 UTC (rev 220626)
@@ -1,9 +1,6 @@
 Download started.
 Downloading URL with suggested filename "foo.pdf"
 Download completed.
-PASS successfullyParsed is true
-
-TEST COMPLETE
 Tests that a suggested filename on a download attribute is allowed if the link is a data URL.
 
 The suggested filename at the top should be foo.pdf.

Modified: trunk/LayoutTests/http/tests/security/anchor-download-allow-data.html (220625 => 220626)


--- trunk/LayoutTests/http/tests/security/anchor-download-allow-data.html	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/LayoutTests/http/tests/security/anchor-download-allow-data.html	2017-08-12 21:58:45 UTC (rev 220626)
@@ -1,10 +1,12 @@
 <!DOCTYPE html>
 <html>
 <head>
-<script src=""
 <script>
-    if (window.testRunner)
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.setShouldLogDownloadCallbacks(true);
         testRunner.waitUntilDownloadFinished();
+    }
 </script>
 </head>
 <body>
@@ -30,6 +32,5 @@
     }
     runTest();
 </script>
-<script src=""
 </body>
 </html>

Modified: trunk/LayoutTests/http/tests/security/anchor-download-allow-sameorigin.html (220625 => 220626)


--- trunk/LayoutTests/http/tests/security/anchor-download-allow-sameorigin.html	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/LayoutTests/http/tests/security/anchor-download-allow-sameorigin.html	2017-08-12 21:58:45 UTC (rev 220626)
@@ -1,10 +1,12 @@
 <!DOCTYPE html>
 <html>
 <head>
-<script src=""
 <script>
-    if (window.testRunner)
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.setShouldLogDownloadCallbacks(true);
         testRunner.waitUntilDownloadFinished();
+    }
 </script>
 </head>
 <body>

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (220625 => 220626)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2017-08-12 21:58:45 UTC (rev 220626)
@@ -1,3 +1,15 @@
+2017-08-12  Chris Dumez  <cdu...@apple.com>
+
+        Address flakiness related to download tests
+        https://bugs.webkit.org/show_bug.cgi?id=175338
+
+        Reviewed by Ryosuke Niwa.
+
+        Rebaseline several WPT tests now that download callbacks are no longer logged.
+
+        * web-platform-tests/html/semantics/embedded-content/the-area-element/area-download-click-expected.txt:
+        * web-platform-tests/html/semantics/text-level-semantics/the-a-element/a-download-click-expected.txt:
+
 2017-08-11  Chris Dumez  <cdu...@apple.com>
 
         Implement quota limitation for keepalive Fetch requests

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-area-element/area-download-click-expected.txt (220625 => 220626)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-area-element/area-download-click-expected.txt	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-area-element/area-download-click-expected.txt	2017-08-12 21:58:45 UTC (rev 220626)
@@ -1,4 +1,4 @@
-Download started.
-Downloading URL with suggested filename "foo.html"
-Download completed.
 
+
+PASS Clicking on an <area> element with a download attribute must not throw an exception 
+

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/text-level-semantics/the-a-element/a-download-click-expected.txt (220625 => 220626)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/text-level-semantics/the-a-element/a-download-click-expected.txt	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/text-level-semantics/the-a-element/a-download-click-expected.txt	2017-08-12 21:58:45 UTC (rev 220626)
@@ -1,6 +1,3 @@
-Download started.
-Downloading URL with suggested filename "foo.html"
-Download completed.
 Click me
 
 PASS Clicking on an <a> element with a download attribute must not throw an exception 

Modified: trunk/Tools/ChangeLog (220625 => 220626)


--- trunk/Tools/ChangeLog	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/Tools/ChangeLog	2017-08-12 21:58:45 UTC (rev 220626)
@@ -1,3 +1,35 @@
+2017-08-12  Chris Dumez  <cdu...@apple.com>
+
+        Address flakiness related to download tests
+        https://bugs.webkit.org/show_bug.cgi?id=175338
+
+        Reviewed by Ryosuke Niwa.
+
+        - Update WKTR so that the flag set by testRunner.waitUntilDownloadFinished()
+          is actually queried when a download completes. Previously, this would be
+          identical to a call to testRunner.waitUntilDone() because any download
+          completion would call testRunner.notifyDone().
+        - Disable logging of download callbacks by default and add a
+          testRunner.setShouldLogDownloadCallbacks(true) API to allow tests to
+          enable such logging.
+
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+        (WTR::InjectedBundle::didReceiveMessageToPage):
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::setShouldLogDownloadCallbacks):
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::downloadDidStart):
+        (WTR::TestController::decideDestinationWithSuggestedFilename):
+        (WTR::TestController::downloadDidFinish):
+        (WTR::TestController::downloadDidFail):
+        (WTR::TestController::downloadDidCancel):
+        * WebKitTestRunner/TestController.h:
+        (WTR::TestController::setShouldLogDownloadCallbacks):
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
+
 2017-08-11  Jonathan Bedard  <jbed...@apple.com>
 
         Create mock ITP data in testing to prevent grandfathering

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (220625 => 220626)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2017-08-12 21:58:45 UTC (rev 220626)
@@ -31,11 +31,14 @@
     void dumpChildFramesAsText();
     void waitForPolicyDelegate();
     void waitUntilDone();
-    void waitUntilDownloadFinished();
     void notifyDone();
     double preciseTime();
     readonly attribute double timeout;
 
+    // Downloads.
+    void waitUntilDownloadFinished();
+    void setShouldLogDownloadCallbacks(boolean value);
+
     // Other dumping.
     void dumpBackForwardList();
     void dumpChildFrameScrollPositions();

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (220625 => 220626)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2017-08-12 21:58:45 UTC (rev 220626)
@@ -251,7 +251,8 @@
     }
 
     if (WKStringIsEqualToUTF8CString(messageName, "NotifyDownloadDone")) {
-        m_testRunner->notifyDone();
+        if (m_testRunner->shouldFinishAfterDownload())
+            m_testRunner->notifyDone();
         return;
     }
 

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (220625 => 220626)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2017-08-12 21:58:45 UTC (rev 220626)
@@ -1023,6 +1023,13 @@
     WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get());
 }
 
+void TestRunner::setShouldLogDownloadCallbacks(bool value)
+{
+    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetShouldLogDownloadCallbacks"));
+    WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(value));
+    WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get());
+}
+
 void TestRunner::setAuthenticationUsername(JSStringRef username)
 {
     WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetAuthenticationUsername"));

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (220625 => 220626)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2017-08-12 21:58:45 UTC (rev 220626)
@@ -210,7 +210,10 @@
     bool waitToDump() const { return m_waitToDump; }
     void waitToDumpWatchdogTimerFired();
     void invalidateWaitToDumpWatchdogTimer();
+
+    // Downloads
     bool shouldFinishAfterDownload() const { return m_shouldFinishAfterDownload; }
+    void setShouldLogDownloadCallbacks(bool);
 
     bool shouldAllowEditing() const { return m_shouldAllowEditing; }
 

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (220625 => 220626)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2017-08-12 21:58:45 UTC (rev 220626)
@@ -1722,7 +1722,8 @@
 
 void TestController::downloadDidStart(WKContextRef context, WKDownloadRef download)
 {
-    m_currentInvocation->outputText("Download started.\n");
+    if (m_shouldLogDownloadCallbacks)
+        m_currentInvocation->outputText("Download started.\n");
 }
 
 WKStringRef TestController::decideDestinationWithSuggestedFilename(WKContextRef, WKDownloadRef, WKStringRef filename, bool*& allowOverwrite)
@@ -1729,13 +1730,14 @@
 {
     String suggestedFilename = toWTFString(filename);
 
-    StringBuilder builder;
-    builder.append("Downloading URL with suggested filename \"");
-    builder.append(suggestedFilename);
-    builder.append("\"\n");
+    if (m_shouldLogDownloadCallbacks) {
+        StringBuilder builder;
+        builder.append("Downloading URL with suggested filename \"");
+        builder.append(suggestedFilename);
+        builder.append("\"\n");
+        m_currentInvocation->outputText(builder.toString());
+    }
 
-    m_currentInvocation->outputText(builder.toString());
-
     const char* dumpRenderTreeTemp = libraryPathForTesting();
     if (!dumpRenderTreeTemp)
         return nullptr;
@@ -1750,35 +1752,39 @@
 
 void TestController::downloadDidFinish(WKContextRef, WKDownloadRef)
 {
-    m_currentInvocation->outputText("Download completed.\n");
+    if (m_shouldLogDownloadCallbacks)
+        m_currentInvocation->outputText("Download completed.\n");
     m_currentInvocation->notifyDownloadDone();
 }
 
 void TestController::downloadDidFail(WKContextRef, WKDownloadRef, WKErrorRef error)
 {
-    String message = String::format("Download failed.\n");
-    m_currentInvocation->outputText(message);
-    
-    WKRetainPtr<WKStringRef> errorDomain = adoptWK(WKErrorCopyDomain(error));
-    WKRetainPtr<WKStringRef> errorDescription = adoptWK(WKErrorCopyLocalizedDescription(error));
-    int errorCode = WKErrorGetErrorCode(error);
+    if (m_shouldLogDownloadCallbacks) {
+        String message = String::format("Download failed.\n");
+        m_currentInvocation->outputText(message);
 
-    StringBuilder errorBuilder;
-    errorBuilder.append("Failed: ");
-    errorBuilder.append(toWTFString(errorDomain));
-    errorBuilder.append(", code=");
-    errorBuilder.appendNumber(errorCode);
-    errorBuilder.append(", description=");
-    errorBuilder.append(toWTFString(errorDescription));
-    errorBuilder.append("\n");
+        WKRetainPtr<WKStringRef> errorDomain = adoptWK(WKErrorCopyDomain(error));
+        WKRetainPtr<WKStringRef> errorDescription = adoptWK(WKErrorCopyLocalizedDescription(error));
+        int errorCode = WKErrorGetErrorCode(error);
 
-    m_currentInvocation->outputText(errorBuilder.toString());
+        StringBuilder errorBuilder;
+        errorBuilder.append("Failed: ");
+        errorBuilder.append(toWTFString(errorDomain));
+        errorBuilder.append(", code=");
+        errorBuilder.appendNumber(errorCode);
+        errorBuilder.append(", description=");
+        errorBuilder.append(toWTFString(errorDescription));
+        errorBuilder.append("\n");
+
+        m_currentInvocation->outputText(errorBuilder.toString());
+    }
     m_currentInvocation->notifyDownloadDone();
 }
 
 void TestController::downloadDidCancel(WKContextRef, WKDownloadRef)
 {
-    m_currentInvocation->outputText("Download cancelled.\n");
+    if (m_shouldLogDownloadCallbacks)
+        m_currentInvocation->outputText("Download cancelled.\n");
     m_currentInvocation->notifyDownloadDone();
 }
 

Modified: trunk/Tools/WebKitTestRunner/TestController.h (220625 => 220626)


--- trunk/Tools/WebKitTestRunner/TestController.h	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/Tools/WebKitTestRunner/TestController.h	2017-08-12 21:58:45 UTC (rev 220626)
@@ -140,6 +140,7 @@
 
     void setShouldLogHistoryClientCallbacks(bool shouldLog) { m_shouldLogHistoryClientCallbacks = shouldLog; }
     void setShouldLogCanAuthenticateAgainstProtectionSpace(bool shouldLog) { m_shouldLogCanAuthenticateAgainstProtectionSpace = shouldLog; }
+    void setShouldLogDownloadCallbacks(bool shouldLog) { m_shouldLogDownloadCallbacks = shouldLog; }
 
     bool isCurrentInvocation(TestInvocation* invocation) const { return invocation == m_currentInvocation.get(); }
 
@@ -383,6 +384,7 @@
     bool m_shouldUseRemoteLayerTree { false };
 
     bool m_shouldLogCanAuthenticateAgainstProtectionSpace { false };
+    bool m_shouldLogDownloadCallbacks { false };
     bool m_shouldLogHistoryClientCallbacks { false };
     bool m_shouldShowWebView { false };
     

Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (220625 => 220626)


--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2017-08-12 18:44:48 UTC (rev 220625)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2017-08-12 21:58:45 UTC (rev 220626)
@@ -674,6 +674,13 @@
         return;
     }
 
+    if (WKStringIsEqualToUTF8CString(messageName, "SetShouldLogDownloadCallbacks")) {
+        ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
+        WKBooleanRef value = static_cast<WKBooleanRef>(messageBody);
+        TestController::singleton().setShouldLogDownloadCallbacks(WKBooleanGetValue(value));
+        return;
+    }
+
     if (WKStringIsEqualToUTF8CString(messageName, "SetAuthenticationUsername")) {
         ASSERT(WKGetTypeID(messageBody) == WKStringGetTypeID());
         WKStringRef username = static_cast<WKStringRef>(messageBody);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to