Title: [210503] trunk/Tools
Revision
210503
Author
pvol...@apple.com
Date
2017-01-09 04:46:34 -0800 (Mon, 09 Jan 2017)

Log Message

[Win] Some tests are flaky because certain DLLs are writing to stdout.
https://bugs.webkit.org/show_bug.cgi?id=166760

Reviewed by Darin Adler.

Some tests are flaky because certain DLLs are writing to stdout, giving incorrect test results.
We can work around that by duplicating and redirecting stdout.

* DumpRenderTree/PixelDumpSupport.cpp:
(dumpWebViewAsPixelsAndCompareWithExpected):
(printPNG):
* DumpRenderTree/win/AccessibilityControllerWin.cpp:
(logEventProc):
* DumpRenderTree/win/DRTDesktopNotificationPresenter.cpp:
(DRTDesktopNotificationPresenter::showDesktopNotification):
(DRTDesktopNotificationPresenter::cancelDesktopNotification):
(DRTDesktopNotificationPresenter::requestNotificationPermission):
* DumpRenderTree/win/DumpRenderTree.cpp:
(dumpFrameScrollPosition):
(dumpHistoryItem):
(dumpBackForwardList):
(dump):
(runTest):
(main):
* DumpRenderTree/win/DumpRenderTreeWin.h:
* DumpRenderTree/win/EditingDelegate.cpp:
(EditingDelegate::shouldBeginEditingInDOMRange):
(EditingDelegate::shouldEndEditingInDOMRange):
(EditingDelegate::shouldInsertNode):
(EditingDelegate::shouldInsertText):
(EditingDelegate::shouldDeleteDOMRange):
(EditingDelegate::shouldChangeSelectedDOMRange):
(EditingDelegate::shouldApplyStyle):
(EditingDelegate::shouldChangeTypingStyle):
(EditingDelegate::doPlatformCommand):
(EditingDelegate::webViewDidBeginEditing):
(EditingDelegate::webViewDidChange):
(EditingDelegate::webViewDidEndEditing):
(EditingDelegate::webViewDidChangeTypingStyle):
(EditingDelegate::webViewDidChangeSelection):
* DumpRenderTree/win/FrameLoadDelegate.cpp:
(FrameLoadDelegate::didStartProvisionalLoadForFrame):
(FrameLoadDelegate::didReceiveServerRedirectForProvisionalLoadForFrame):
(FrameLoadDelegate::didChangeLocationWithinPageForFrame):
(FrameLoadDelegate::didFailProvisionalLoadWithError):
(FrameLoadDelegate::didCommitLoadForFrame):
(FrameLoadDelegate::didReceiveTitle):
(FrameLoadDelegate::didFinishLoadForFrame):
(FrameLoadDelegate::didFailLoadWithError):
(FrameLoadDelegate::willPerformClientRedirectToURL):
(FrameLoadDelegate::didCancelClientRedirectForFrame):
(FrameLoadDelegate::windowScriptObjectAvailable):
(FrameLoadDelegate::didFinishDocumentLoadForFrame):
(FrameLoadDelegate::didHandleOnloadEventsForFrame):
(FrameLoadDelegate::didDisplayInsecureContent):
(FrameLoadDelegate::didRunInsecureContent):
(FrameLoadDelegate::webViewProgressFinishedNotification):
* DumpRenderTree/win/HistoryDelegate.cpp:
(HistoryDelegate::didNavigateWithNavigationData):
(HistoryDelegate::didPerformClientRedirectFromURL):
(HistoryDelegate::didPerformServerRedirectFromURL):
(HistoryDelegate::updateHistoryTitle):
(HistoryDelegate::populateVisitedLinksForWebView):
* DumpRenderTree/win/PolicyDelegate.cpp:
(PolicyDelegate::decidePolicyForNavigationAction):
(PolicyDelegate::unableToImplementPolicyWithError):
* DumpRenderTree/win/ResourceLoadDelegate.cpp:
(ResourceLoadDelegate::willSendRequest):
(ResourceLoadDelegate::didReceiveAuthenticationChallenge):
(ResourceLoadDelegate::didReceiveResponse):
(ResourceLoadDelegate::didFinishLoadingFromDataSource):
(ResourceLoadDelegate::didFailLoadingWithError):
* DumpRenderTree/win/TestRunnerWin.cpp:
(TestRunner::addDisallowedURL):
(TestRunner::originsWithApplicationCache):
(TestRunner::setStorageDatabaseIdleInterval):
(TestRunner::closeIdleLocalStorageDatabases):
(TestRunner::copyDecodedHostName):
(TestRunner::copyEncodedHostName):
(TestRunner::numberOfPendingGeolocationPermissionRequests):
(TestRunner::isGeolocationProviderActive):
(TestRunner::pathToLocalResource):
(TestRunner::setMockDeviceOrientation):
(TestRunner::setMockGeolocationPosition):
(TestRunner::setMockGeolocationPositionUnavailableError):
(TestRunner::setSpatialNavigationEnabled):
(TestRunner::setAutomaticLinkDetectionEnabled):
(TestRunner::isCommandEnabled):
(TestRunner::authenticateSession):
(TestRunner::addChromeInputField):
(TestRunner::removeChromeInputField):
(TestRunner::focusWebView):
(TestRunner::grantWebNotificationPermission):
(TestRunner::denyWebNotificationPermission):
(TestRunner::removeAllWebNotificationPermissions):
(TestRunner::simulateWebNotificationClick):
(TestRunner::imageCountInGeneralPasteboard):
* DumpRenderTree/win/UIDelegate.cpp:
(UIDelegate::runJavaScriptAlertPanelWithMessage):
(UIDelegate::runJavaScriptConfirmPanelWithMessage):
(UIDelegate::runJavaScriptTextInputPanelWithPrompt):
(UIDelegate::runBeforeUnloadConfirmPanelWithMessage):
(UIDelegate::webViewAddMessageToConsole):
(UIDelegate::exceededDatabaseQuota):
(UIDelegate::setStatusText):
(UIDelegate::didPressMissingPluginButton):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (210502 => 210503)


--- trunk/Tools/ChangeLog	2017-01-09 12:43:49 UTC (rev 210502)
+++ trunk/Tools/ChangeLog	2017-01-09 12:46:34 UTC (rev 210503)
@@ -1,3 +1,112 @@
+2017-01-06  Per Arne Vollan  <pvol...@apple.com>
+
+        [Win] Some tests are flaky because certain DLLs are writing to stdout.
+        https://bugs.webkit.org/show_bug.cgi?id=166760
+
+        Reviewed by Darin Adler.
+
+        Some tests are flaky because certain DLLs are writing to stdout, giving incorrect test results.
+        We can work around that by duplicating and redirecting stdout.
+
+        * DumpRenderTree/PixelDumpSupport.cpp:
+        (dumpWebViewAsPixelsAndCompareWithExpected):
+        (printPNG):
+        * DumpRenderTree/win/AccessibilityControllerWin.cpp:
+        (logEventProc):
+        * DumpRenderTree/win/DRTDesktopNotificationPresenter.cpp:
+        (DRTDesktopNotificationPresenter::showDesktopNotification):
+        (DRTDesktopNotificationPresenter::cancelDesktopNotification):
+        (DRTDesktopNotificationPresenter::requestNotificationPermission):
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        (dumpFrameScrollPosition):
+        (dumpHistoryItem):
+        (dumpBackForwardList):
+        (dump):
+        (runTest):
+        (main):
+        * DumpRenderTree/win/DumpRenderTreeWin.h:
+        * DumpRenderTree/win/EditingDelegate.cpp:
+        (EditingDelegate::shouldBeginEditingInDOMRange):
+        (EditingDelegate::shouldEndEditingInDOMRange):
+        (EditingDelegate::shouldInsertNode):
+        (EditingDelegate::shouldInsertText):
+        (EditingDelegate::shouldDeleteDOMRange):
+        (EditingDelegate::shouldChangeSelectedDOMRange):
+        (EditingDelegate::shouldApplyStyle):
+        (EditingDelegate::shouldChangeTypingStyle):
+        (EditingDelegate::doPlatformCommand):
+        (EditingDelegate::webViewDidBeginEditing):
+        (EditingDelegate::webViewDidChange):
+        (EditingDelegate::webViewDidEndEditing):
+        (EditingDelegate::webViewDidChangeTypingStyle):
+        (EditingDelegate::webViewDidChangeSelection):
+        * DumpRenderTree/win/FrameLoadDelegate.cpp:
+        (FrameLoadDelegate::didStartProvisionalLoadForFrame):
+        (FrameLoadDelegate::didReceiveServerRedirectForProvisionalLoadForFrame):
+        (FrameLoadDelegate::didChangeLocationWithinPageForFrame):
+        (FrameLoadDelegate::didFailProvisionalLoadWithError):
+        (FrameLoadDelegate::didCommitLoadForFrame):
+        (FrameLoadDelegate::didReceiveTitle):
+        (FrameLoadDelegate::didFinishLoadForFrame):
+        (FrameLoadDelegate::didFailLoadWithError):
+        (FrameLoadDelegate::willPerformClientRedirectToURL):
+        (FrameLoadDelegate::didCancelClientRedirectForFrame):
+        (FrameLoadDelegate::windowScriptObjectAvailable):
+        (FrameLoadDelegate::didFinishDocumentLoadForFrame):
+        (FrameLoadDelegate::didHandleOnloadEventsForFrame):
+        (FrameLoadDelegate::didDisplayInsecureContent):
+        (FrameLoadDelegate::didRunInsecureContent):
+        (FrameLoadDelegate::webViewProgressFinishedNotification):
+        * DumpRenderTree/win/HistoryDelegate.cpp:
+        (HistoryDelegate::didNavigateWithNavigationData):
+        (HistoryDelegate::didPerformClientRedirectFromURL):
+        (HistoryDelegate::didPerformServerRedirectFromURL):
+        (HistoryDelegate::updateHistoryTitle):
+        (HistoryDelegate::populateVisitedLinksForWebView):
+        * DumpRenderTree/win/PolicyDelegate.cpp:
+        (PolicyDelegate::decidePolicyForNavigationAction):
+        (PolicyDelegate::unableToImplementPolicyWithError):
+        * DumpRenderTree/win/ResourceLoadDelegate.cpp:
+        (ResourceLoadDelegate::willSendRequest):
+        (ResourceLoadDelegate::didReceiveAuthenticationChallenge):
+        (ResourceLoadDelegate::didReceiveResponse):
+        (ResourceLoadDelegate::didFinishLoadingFromDataSource):
+        (ResourceLoadDelegate::didFailLoadingWithError):
+        * DumpRenderTree/win/TestRunnerWin.cpp:
+        (TestRunner::addDisallowedURL):
+        (TestRunner::originsWithApplicationCache):
+        (TestRunner::setStorageDatabaseIdleInterval):
+        (TestRunner::closeIdleLocalStorageDatabases):
+        (TestRunner::copyDecodedHostName):
+        (TestRunner::copyEncodedHostName):
+        (TestRunner::numberOfPendingGeolocationPermissionRequests):
+        (TestRunner::isGeolocationProviderActive):
+        (TestRunner::pathToLocalResource):
+        (TestRunner::setMockDeviceOrientation):
+        (TestRunner::setMockGeolocationPosition):
+        (TestRunner::setMockGeolocationPositionUnavailableError):
+        (TestRunner::setSpatialNavigationEnabled):
+        (TestRunner::setAutomaticLinkDetectionEnabled):
+        (TestRunner::isCommandEnabled):
+        (TestRunner::authenticateSession):
+        (TestRunner::addChromeInputField):
+        (TestRunner::removeChromeInputField):
+        (TestRunner::focusWebView):
+        (TestRunner::grantWebNotificationPermission):
+        (TestRunner::denyWebNotificationPermission):
+        (TestRunner::removeAllWebNotificationPermissions):
+        (TestRunner::simulateWebNotificationClick):
+        (TestRunner::imageCountInGeneralPasteboard):
+        * DumpRenderTree/win/UIDelegate.cpp:
+        (UIDelegate::runJavaScriptAlertPanelWithMessage):
+        (UIDelegate::runJavaScriptConfirmPanelWithMessage):
+        (UIDelegate::runJavaScriptTextInputPanelWithPrompt):
+        (UIDelegate::runBeforeUnloadConfirmPanelWithMessage):
+        (UIDelegate::webViewAddMessageToConsole):
+        (UIDelegate::exceededDatabaseQuota):
+        (UIDelegate::setStatusText):
+        (UIDelegate::didPressMissingPluginButton):
+
 2017-01-07  Tim Horton  <timothy_hor...@apple.com>
 
         Add a setting to create editable MiniBrowser windows by default

Modified: trunk/Tools/DumpRenderTree/PixelDumpSupport.cpp (210502 => 210503)


--- trunk/Tools/DumpRenderTree/PixelDumpSupport.cpp	2017-01-09 12:43:49 UTC (rev 210502)
+++ trunk/Tools/DumpRenderTree/PixelDumpSupport.cpp	2017-01-09 12:46:34 UTC (rev 210503)
@@ -43,6 +43,10 @@
 #include "PixelDumpSupportCairo.h"
 #endif
 
+#if !PLATFORM(WIN)
+#define testResult stdout
+#endif
+
 void dumpWebViewAsPixelsAndCompareWithExpected(const std::string& expectedHash)
 {
     RefPtr<BitmapContext> context;
@@ -57,7 +61,7 @@
     // Compute the hash of the bitmap context pixels
     char actualHash[33];
     computeMD5HashStringForBitmapContext(context.get(), actualHash);
-    printf("\nActualHash: %s\n", actualHash); // FIXME: No need for the leading newline.
+    fprintf(testResult, "\nActualHash: %s\n", actualHash); // FIXME: No need for the leading newline.
 
     // Check the computed hash against the expected one and dump image on mismatch
     bool dumpImage = true;
@@ -64,7 +68,7 @@
     if (expectedHash.length() > 0) {
         ASSERT(expectedHash.length() == 32);
 
-        printf("\nExpectedHash: %s\n", expectedHash.c_str()); // FIXME: No need for the leading newline.
+        fprintf(testResult, "\nExpectedHash: %s\n", expectedHash.c_str()); // FIXME: No need for the leading newline.
         
         if (expectedHash == actualHash) // FIXME: do case insensitive compare
             dumpImage = false;
@@ -114,13 +118,13 @@
     Vector<unsigned char> bytesToAdd;
     convertChecksumToPNGComment(checksum, bytesToAdd);
 
-    printf("Content-Type: %s\n", "image/png");
-    printf("Content-Length: %lu\n", static_cast<unsigned long>(dataLength + bytesToAdd.size()));
+    fprintf(testResult, "Content-Type: image/png\n");
+    fprintf(testResult, "Content-Length: %lu\n", static_cast<unsigned long>(dataLength + bytesToAdd.size()));
 
     size_t insertOffset = offsetAfterIHDRChunk(data, dataLength);
 
-    fwrite(data, 1, insertOffset, stdout);
-    fwrite(bytesToAdd.data(), 1, bytesToAdd.size(), stdout);
+    fwrite(data, 1, insertOffset, testResult);
+    fwrite(bytesToAdd.data(), 1, bytesToAdd.size(), testResult);
 
     const size_t bytesToWriteInOneChunk = 1 << 15;
     data += insertOffset;
@@ -127,7 +131,7 @@
     size_t dataRemainingToWrite = dataLength - insertOffset;
     while (dataRemainingToWrite) {
         size_t bytesToWriteInThisChunk = std::min(dataRemainingToWrite, bytesToWriteInOneChunk);
-        size_t bytesWritten = fwrite(data, 1, bytesToWriteInThisChunk, stdout);
+        size_t bytesWritten = fwrite(data, 1, bytesToWriteInThisChunk, testResult);
         if (bytesWritten != bytesToWriteInThisChunk)
             break;
         dataRemainingToWrite -= bytesWritten;

Modified: trunk/Tools/DumpRenderTree/win/AccessibilityControllerWin.cpp (210502 => 210503)


--- trunk/Tools/DumpRenderTree/win/AccessibilityControllerWin.cpp	2017-01-09 12:43:49 UTC (rev 210502)
+++ trunk/Tools/DumpRenderTree/win/AccessibilityControllerWin.cpp	2017-01-09 12:46:34 UTC (rev 210503)
@@ -192,11 +192,11 @@
 
     switch (event) {
         case EVENT_OBJECT_FOCUS:
-            printf("Received focus event for object '%S'.\n", name.c_str());
+            fprintf(testResult, "Received focus event for object '%S'.\n", name.c_str());
             break;
 
         case EVENT_OBJECT_SELECTION:
-            printf("Received selection event for object '%S'.\n", name.c_str());
+            fprintf(testResult, "Received selection event for object '%S'.\n", name.c_str());
             break;
 
         case EVENT_OBJECT_VALUECHANGE: {
@@ -205,16 +205,16 @@
             ASSERT(SUCCEEDED(hr));
             wstring value(valueBSTR, valueBSTR.length());
 
-            printf("Received value change event for object '%S', value '%S'.\n", name.c_str(), value.c_str());
+            fprintf(testResult, "Received value change event for object '%S', value '%S'.\n", name.c_str(), value.c_str());
             break;
         }
 
         case EVENT_SYSTEM_SCROLLINGSTART:
-            printf("Received scrolling start event for object '%S'.\n", name.c_str());
+            fprintf(testResult, "Received scrolling start event for object '%S'.\n", name.c_str());
             break;
 
         default:
-            printf("Received unknown event for object '%S'.\n", name.c_str());
+            fprintf(testResult, "Received unknown event for object '%S'.\n", name.c_str());
             break;
     }
 }

Modified: trunk/Tools/DumpRenderTree/win/DRTDesktopNotificationPresenter.cpp (210502 => 210503)


--- trunk/Tools/DumpRenderTree/win/DRTDesktopNotificationPresenter.cpp	2017-01-09 12:43:49 UTC (rev 210502)
+++ trunk/Tools/DumpRenderTree/win/DRTDesktopNotificationPresenter.cpp	2017-01-09 12:46:34 UTC (rev 210503)
@@ -80,12 +80,12 @@
 
     if (SUCCEEDED(notification->isHTML(&html)) && html) {
         notification->contentsURL(&url.GetBSTR());    
-        printf("DESKTOP NOTIFICATION: contents at %S\n", static_cast<wchar_t*>(url));
+        fprintf(testResult, "DESKTOP NOTIFICATION: contents at %S\n", static_cast<wchar_t*>(url));
     } else {
         notification->iconURL(&url.GetBSTR());
         notification->title(&title.GetBSTR());
         notification->text(&text.GetBSTR());
-        printf("DESKTOP NOTIFICATION: icon %S, title %S, text %S\n", static_cast<wchar_t*>(url), static_cast<wchar_t*>(title), static_cast<wchar_t*>(text));
+        fprintf(testResult, "DESKTOP NOTIFICATION: icon %S, title %S, text %S\n", static_cast<wchar_t*>(url), static_cast<wchar_t*>(title), static_cast<wchar_t*>(text));
     }
 
     // In this stub implementation, the notification is displayed immediately;
@@ -105,7 +105,7 @@
     else
         notification->title(&identifier.GetBSTR());
 
-    printf("DESKTOP NOTIFICATION CLOSED: %S\n", static_cast<wchar_t*>(identifier));
+    fprintf(testResult, "DESKTOP NOTIFICATION CLOSED: %S\n", static_cast<wchar_t*>(identifier));
     notification->notifyClose(false);
 
     return S_OK;
@@ -141,6 +141,6 @@
 
 HRESULT DRTDesktopNotificationPresenter::requestNotificationPermission(_In_ BSTR origin)
 {
-    printf("DESKTOP NOTIFICATION PERMISSION REQUESTED: %S\n", origin ? origin : L"");
+    fprintf(testResult, "DESKTOP NOTIFICATION PERMISSION REQUESTED: %S\n", origin ? origin : L"");
     return S_OK;
 }

Modified: trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp (210502 => 210503)


--- trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp	2017-01-09 12:43:49 UTC (rev 210502)
+++ trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp	2017-01-09 12:46:34 UTC (rev 210503)
@@ -42,6 +42,10 @@
 #include "WorkQueueItem.h"
 #include "WorkQueue.h"
 
+#include <CoreFoundation/CoreFoundation.h>
+#include <WebCore/FileSystem.h>
+#include <WebKit/WebKit.h>
+#include <WebKit/WebKitCOMAPI.h>
 #include <comutil.h>
 #include <cstdio>
 #include <cstring>
@@ -52,15 +56,13 @@
 #include <shlobj.h>
 #include <shlwapi.h>
 #include <tchar.h>
+#include <windows.h>
+#include <wtf/HashSet.h>
 #include <wtf/NeverDestroyed.h>
 #include <wtf/RetainPtr.h>
 #include <wtf/Vector.h>
 #include <wtf/text/CString.h>
-#include <windows.h>
-#include <CoreFoundation/CoreFoundation.h>
-#include <WebCore/FileSystem.h>
-#include <WebKit/WebKit.h>
-#include <WebKit/WebKitCOMAPI.h>
+#include <wtf/text/StringHash.h>
 
 #if USE(CFURLCONNECTION)
 #include <CFNetwork/CFHTTPCookiesPriv.h>
@@ -121,6 +123,8 @@
 
 UINT_PTR waitToDumpWatchdog = 0;
 
+FILE* testResult = nullptr;
+
 void setPersistentUserStyleSheetLocation(CFStringRef url)
 {
     persistentUserStyleSheetLocation = url;
@@ -405,9 +409,9 @@
             _bstr_t name;
             if (FAILED(frame->name(&name.GetBSTR())))
                 return;
-            printf("frame '%S' ", static_cast<wchar_t*>(name));
+            fprintf(testResult, "frame '%S' ", static_cast<wchar_t*>(name));
         }
-        printf("scrolled to %.f,%.f\n", (double)scrollPosition.cx, (double)scrollPosition.cy);
+        fprintf(testResult, "scrolled to %.f,%.f\n", (double)scrollPosition.cx, (double)scrollPosition.cy);
     }
 
     if (::gTestRunner->dumpChildFrameScrollPositions()) {
@@ -506,11 +510,11 @@
 
     int start = 0;
     if (current) {
-        printf("curr->");
+        fprintf(testResult, "curr->");
         start = 6;
     }
     for (int i = start; i < indent; i++)
-        putchar(' ');
+        fputc(' ', testResult);
 
     _bstr_t url;
     if (FAILED(item->URLString(&url.GetBSTR())))
@@ -531,7 +535,7 @@
         url = "" test):") + _bstr_t(start);
     }
 
-    printf("%S", static_cast<wchar_t*>(url));
+    fprintf(testResult, "%S", static_cast<wchar_t*>(url));
 
     COMPtr<IWebHistoryItemPrivate> itemPrivate;
     if (FAILED(item->QueryInterface(&itemPrivate)))
@@ -541,13 +545,13 @@
     if (FAILED(itemPrivate->target(&target.GetBSTR())))
         return;
     if (target.length())
-        printf(" (in frame \"%S\")", static_cast<wchar_t*>(target));
+        fprintf(testResult, " (in frame \"%S\")", static_cast<wchar_t*>(target));
     BOOL isTargetItem = FALSE;
     if (FAILED(itemPrivate->isTargetItem(&isTargetItem)))
         return;
     if (isTargetItem)
-        printf("  **nav target**");
-    putchar('\n');
+        fprintf(testResult, "  **nav target**");
+    fputc('\n', testResult);
 
     unsigned kidsCount;
     SAFEARRAY* arrPtr;
@@ -595,7 +599,7 @@
 {
     ASSERT(webView);
 
-    printf("\n============== Back Forward List ==============\n");
+    fprintf(testResult, "\n============== Back Forward List ==============\n");
 
     COMPtr<IWebBackForwardList> bfList;
     if (FAILED(webView->backForwardList(&bfList)))
@@ -652,7 +656,7 @@
         dumpHistoryItem(historyItemToPrint.get(), 8, i == currentItemIndex);
     }
 
-    printf("===============================================\n");
+    fprintf(testResult, "===============================================\n");
 }
 
 static void dumpBackForwardListForAllWindows()
@@ -711,7 +715,7 @@
             int bufferSize = ::WideCharToMultiByte(CP_UTF8, 0, resultString, stringLength, 0, 0, 0, 0);
             char* buffer = (char*)malloc(bufferSize + 1);
             ::WideCharToMultiByte(CP_UTF8, 0, resultString, stringLength, buffer, bufferSize + 1, 0, 0);
-            fwrite(buffer, 1, bufferSize, stdout);
+            fwrite(buffer, 1, bufferSize, testResult);
             free(buffer);
 
             if (!::gTestRunner->dumpAsText() && !::gTestRunner->dumpDOMAsWebArchive() && !::gTestRunner->dumpSourceAsWebArchive() && !::gTestRunner->dumpAsAudio())
@@ -720,10 +724,10 @@
             if (::gTestRunner->dumpBackForwardList())
                 dumpBackForwardListForAllWindows();
         } else
-            printf("ERROR: nil result from %s", ::gTestRunner->dumpAsText() ? "IDOMElement::innerText" : "IFrameViewPrivate::renderTreeAsExternalRepresentation");
+            fprintf(testResult, "ERROR: nil result from %s", ::gTestRunner->dumpAsText() ? "IDOMElement::innerText" : "IFrameViewPrivate::renderTreeAsExternalRepresentation");
 
         if (printSeparators)
-            puts("#EOF"); // terminate the content block
+            fputs("#EOF\n", testResult); // terminate the content block
     }
 
     if (dumpPixelsForCurrentTest && ::gTestRunner->generatePixelResults()) {
@@ -731,8 +735,8 @@
         dumpWebViewAsPixelsAndCompareWithExpected(gTestRunner->expectedPixelHash());
     }
 
-    puts("#EOF");   // terminate the (possibly empty) pixels block
-    fflush(stdout);
+    fputs("#EOF\n", testResult); // terminate the (possibly empty) pixels block
+    fflush(testResult);
 
 fail:
     // This will exit from our message loop.
@@ -1110,6 +1114,12 @@
     _bstr_t urlBStr(reinterpret_cast<wchar_t*>(buffer.data()));
     ASSERT(urlBStr.length() == length);
 
+    // Check that test has not already run
+    static HashSet<String> testUrls;
+    if (testUrls.contains(String(inputLine.c_str())))
+        fprintf(stderr, "Test has already run \"%s\"\n", inputLine.c_str());
+    testUrls.add(String(inputLine.c_str()));
+
     CFIndex maximumURLLengthAsUTF8 = CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8) + 1;
     Vector<char> testURL(maximumURLLengthAsUTF8 + 1, 0);
     CFStringGetCString(str, testURL.data(), maximumURLLengthAsUTF8, kCFStringEncodingUTF8);
@@ -1455,6 +1465,14 @@
     _setmode(1, _O_BINARY);
     _setmode(2, _O_BINARY);
 
+    // Some tests are flaky because certain DLLs are writing to stdout, giving incorrect test results.
+    // We work around that here by duplicating and redirecting stdout.
+    int fdStdout = _dup(1);
+    _setmode(fdStdout, _O_BINARY);
+    testResult = fdopen(fdStdout, "a+b");
+    // Redirect stdout to stderr.
+    int result = _dup2(_fileno(stderr), 1);
+
     initialize();
 
     setDefaultsToConsistentValuesForTesting();
@@ -1487,7 +1505,7 @@
         BOOL threeDTransformsAvailable = FALSE;
 #endif
 
-        printf("SupportedFeatures:%s %s\n", acceleratedCompositingAvailable ? "AcceleratedCompositing" : "", threeDTransformsAvailable ? "3DTransforms" : "");
+        fprintf(testResult, "SupportedFeatures:%s %s\n", acceleratedCompositingAvailable ? "AcceleratedCompositing" : "", threeDTransformsAvailable ? "3DTransforms" : "");
         return 0;
     }
 

Modified: trunk/Tools/DumpRenderTree/win/DumpRenderTreeWin.h (210502 => 210503)


--- trunk/Tools/DumpRenderTree/win/DumpRenderTreeWin.h	2017-01-09 12:43:49 UTC (rev 210502)
+++ trunk/Tools/DumpRenderTree/win/DumpRenderTreeWin.h	2017-01-09 12:46:34 UTC (rev 210503)
@@ -43,6 +43,8 @@
 
 extern HWND webViewWindow;
 
+extern FILE* testResult;
+
 #include <WebCore/COMPtr.h>
 #include <string>
 #include <wtf/HashMap.h>

Modified: trunk/Tools/DumpRenderTree/win/EditingDelegate.cpp (210502 => 210503)


--- trunk/Tools/DumpRenderTree/win/EditingDelegate.cpp	2017-01-09 12:43:49 UTC (rev 210502)
+++ trunk/Tools/DumpRenderTree/win/EditingDelegate.cpp	2017-01-09 12:46:34 UTC (rev 210503)
@@ -132,7 +132,7 @@
     }
 
     if (::gTestRunner->dumpEditingCallbacks() && !done)
-        printf("EDITING DELEGATE: shouldBeginEditingInDOMRange:%s\n", dump(range).c_str());
+        fprintf(testResult, "EDITING DELEGATE: shouldBeginEditingInDOMRange:%s\n", dump(range).c_str());
 
     *result = m_acceptsEditing;
     return S_OK;
@@ -146,7 +146,7 @@
     }
 
     if (::gTestRunner->dumpEditingCallbacks() && !done)
-        printf("EDITING DELEGATE: shouldEndEditingInDOMRange:%s\n", dump(range).c_str());
+        fprintf(testResult, "EDITING DELEGATE: shouldEndEditingInDOMRange:%s\n", dump(range).c_str());
 
     *result = m_acceptsEditing;
     return S_OK;
@@ -172,7 +172,7 @@
         return E_POINTER;
 
     if (::gTestRunner->dumpEditingCallbacks() && !done)
-        printf("EDITING DELEGATE: shouldInsertNode:%s replacingDOMRange:%s givenAction:%s\n", dumpPath(node).c_str(), dump(range).c_str(), insertActionString[action]);
+        fprintf(testResult, "EDITING DELEGATE: shouldInsertNode:%s replacingDOMRange:%s givenAction:%s\n", dumpPath(node).c_str(), dump(range).c_str(), insertActionString[action]);
 
     *result = m_acceptsEditing;
     return S_OK;
@@ -193,7 +193,7 @@
 
     if (::gTestRunner->dumpEditingCallbacks() && !done) {
         _bstr_t textBstr(text);
-        printf("EDITING DELEGATE: shouldInsertText:%s replacingDOMRange:%s givenAction:%s\n", static_cast<const char*>(textBstr), dump(range).c_str(), insertactionstring[action]);
+        fprintf(testResult, "EDITING DELEGATE: shouldInsertText:%s replacingDOMRange:%s givenAction:%s\n", static_cast<const char*>(textBstr), dump(range).c_str(), insertactionstring[action]);
     }
 
     *result = m_acceptsEditing;
@@ -208,7 +208,7 @@
     }
 
     if (::gTestRunner->dumpEditingCallbacks() && !done)
-        printf("EDITING DELEGATE: shouldDeleteDOMRange:%s\n", dump(range).c_str());
+        fprintf(testResult, "EDITING DELEGATE: shouldDeleteDOMRange:%s\n", dump(range).c_str());
 
     *result = m_acceptsEditing;
     return S_OK;
@@ -232,7 +232,7 @@
     };
 
     if (::gTestRunner->dumpEditingCallbacks() && !done)
-        printf("EDITING DELEGATE: shouldChangeSelectedDOMRange:%s toDOMRange:%s affinity:%s stillSelecting:%s\n", dump(currentRange).c_str(), dump(proposedRange).c_str(), affinityString[selectionAffinity], boolstring[stillSelecting]);
+        fprintf(testResult, "EDITING DELEGATE: shouldChangeSelectedDOMRange:%s toDOMRange:%s affinity:%s stillSelecting:%s\n", dump(currentRange).c_str(), dump(proposedRange).c_str(), affinityString[selectionAffinity], boolstring[stillSelecting]);
 
     *result = m_acceptsEditing;
     return S_OK;
@@ -246,7 +246,7 @@
     }
 
     if (::gTestRunner->dumpEditingCallbacks() && !done)
-        printf("EDITING DELEGATE: shouldApplyStyle:%s toElementsInDOMRange:%s\n", "'style description'"/*[[style description] UTF8String]*/, dump(range).c_str());
+        fprintf(testResult, "EDITING DELEGATE: shouldApplyStyle:%s toElementsInDOMRange:%s\n", "'style description'"/*[[style description] UTF8String]*/, dump(range).c_str());
 
     *result = m_acceptsEditing;
     return S_OK;
@@ -261,7 +261,7 @@
     }
 
     if (::gTestRunner->dumpEditingCallbacks() && !done)
-        printf("EDITING DELEGATE: shouldChangeTypingStyle:%s toStyle:%s\n", "'currentStyle description'", "'proposedStyle description'");
+        fprintf(testResult, "EDITING DELEGATE: shouldChangeTypingStyle:%s toStyle:%s\n", "'currentStyle description'", "'proposedStyle description'");
 
     *result = m_acceptsEditing;
     return S_OK;
@@ -276,7 +276,7 @@
 
     if (::gTestRunner->dumpEditingCallbacks() && !done) {
         _bstr_t commandBSTR(command);
-        printf("EDITING DELEGATE: doPlatformCommand:%s\n", static_cast<const char*>(commandBSTR));
+        fprintf(testResult, "EDITING DELEGATE: doPlatformCommand:%s\n", static_cast<const char*>(commandBSTR));
     }
 
     *result = m_acceptsEditing;
@@ -291,7 +291,7 @@
     if (::gTestRunner->dumpEditingCallbacks() && !done) {
         _bstr_t name;
         notification->name(&name.GetBSTR());
-        printf("EDITING DELEGATE: webViewDidBeginEditing:%s\n", static_cast<const char*>(name));
+        fprintf(testResult, "EDITING DELEGATE: webViewDidBeginEditing:%s\n", static_cast<const char*>(name));
     }
     return S_OK;
 }
@@ -304,7 +304,7 @@
     if (::gTestRunner->dumpEditingCallbacks() && !done) {
         _bstr_t name;
         notification->name(&name.GetBSTR());
-        printf("EDITING DELEGATE: webViewDidChange:%s\n", static_cast<const char*>(name));
+        fprintf(testResult, "EDITING DELEGATE: webViewDidChange:%s\n", static_cast<const char*>(name));
     }
     return S_OK;
 }
@@ -317,7 +317,7 @@
     if (::gTestRunner->dumpEditingCallbacks() && !done) {
         _bstr_t name;
         notification->name(&name.GetBSTR());
-        printf("EDITING DELEGATE: webViewDidEndEditing:%s\n", static_cast<const char*>(name));
+        fprintf(testResult, "EDITING DELEGATE: webViewDidEndEditing:%s\n", static_cast<const char*>(name));
     }
     return S_OK;
 }
@@ -330,7 +330,7 @@
     if (::gTestRunner->dumpEditingCallbacks() && !done) {
         _bstr_t name;
         notification->name(&name.GetBSTR());
-        printf("EDITING DELEGATE: webViewDidChangeTypingStyle:%s\n", static_cast<const char*>(name));
+        fprintf(testResult, "EDITING DELEGATE: webViewDidChangeTypingStyle:%s\n", static_cast<const char*>(name));
     }
     return S_OK;
 }
@@ -343,7 +343,7 @@
     if (::gTestRunner->dumpEditingCallbacks() && !done) {
         _bstr_t name;
         notification->name(&name.GetBSTR());
-        printf("EDITING DELEGATE: webViewDidChangeSelection:%s\n", static_cast<const char*>(name));
+        fprintf(testResult, "EDITING DELEGATE: webViewDidChangeSelection:%s\n", static_cast<const char*>(name));
     }
     return S_OK;
 }

Modified: trunk/Tools/DumpRenderTree/win/FrameLoadDelegate.cpp (210502 => 210503)


--- trunk/Tools/DumpRenderTree/win/FrameLoadDelegate.cpp	2017-01-09 12:43:49 UTC (rev 210502)
+++ trunk/Tools/DumpRenderTree/win/FrameLoadDelegate.cpp	2017-01-09 12:46:34 UTC (rev 210503)
@@ -123,7 +123,7 @@
 HRESULT FrameLoadDelegate::didStartProvisionalLoadForFrame(_In_opt_ IWebView*, _In_opt_ IWebFrame* frame)
 {
     if (!done && gTestRunner->dumpFrameLoadCallbacks())
-        printf("%s - didStartProvisionalLoadForFrame\n", descriptionSuitableForTestResult(frame).c_str());
+        fprintf(testResult, "%s - didStartProvisionalLoadForFrame\n", descriptionSuitableForTestResult(frame).c_str());
 
     // Make sure we only set this once per test.  If it gets cleared, and then set again, we might
     // end up doing two dumps for one test.
@@ -136,7 +136,7 @@
 HRESULT FrameLoadDelegate::didReceiveServerRedirectForProvisionalLoadForFrame(_In_opt_ IWebView*, _In_opt_ IWebFrame* frame)
 { 
     if (!done && gTestRunner->dumpFrameLoadCallbacks())
-        printf("%s - didReceiveServerRedirectForProvisionalLoadForFrame\n", descriptionSuitableForTestResult(frame).c_str());
+        fprintf(testResult, "%s - didReceiveServerRedirectForProvisionalLoadForFrame\n", descriptionSuitableForTestResult(frame).c_str());
 
     return S_OK;
 }
@@ -144,7 +144,7 @@
 HRESULT FrameLoadDelegate::didChangeLocationWithinPageForFrame(_In_opt_ IWebView* , _In_opt_ IWebFrame* frame)
 {
     if (!done && gTestRunner->dumpFrameLoadCallbacks())
-        printf("%s - didChangeLocationWithinPageForFrame\n", descriptionSuitableForTestResult(frame).c_str());
+        fprintf(testResult, "%s - didChangeLocationWithinPageForFrame\n", descriptionSuitableForTestResult(frame).c_str());
 
     return S_OK;
 }
@@ -152,7 +152,7 @@
 HRESULT FrameLoadDelegate::didFailProvisionalLoadWithError(_In_opt_ IWebView*, _In_opt_ IWebError* error, _In_opt_ IWebFrame* frame)
 {
     if (!done && gTestRunner->dumpFrameLoadCallbacks())
-        printf("%s - didFailProvisionalLoadWithError\n", descriptionSuitableForTestResult(frame).c_str());
+        fprintf(testResult, "%s - didFailProvisionalLoadWithError\n", descriptionSuitableForTestResult(frame).c_str());
 
     locationChangeDone(error, frame);
     return S_OK;
@@ -161,7 +161,7 @@
 HRESULT FrameLoadDelegate::didCommitLoadForFrame(_In_opt_ IWebView* webView, _In_opt_ IWebFrame* frame)
 {
     if (!done && gTestRunner->dumpFrameLoadCallbacks())
-        printf("%s - didCommitLoadForFrame\n", descriptionSuitableForTestResult(frame).c_str());
+        fprintf(testResult, "%s - didCommitLoadForFrame\n", descriptionSuitableForTestResult(frame).c_str());
 
     COMPtr<IWebViewPrivate2> webViewPrivate;
     HRESULT hr = webView->QueryInterface(&webViewPrivate);
@@ -175,10 +175,10 @@
 HRESULT FrameLoadDelegate::didReceiveTitle(_In_opt_ IWebView*, _In_ BSTR title, _In_opt_ IWebFrame* frame)
 {
     if (!done && gTestRunner->dumpFrameLoadCallbacks())
-        printf("%s - didReceiveTitle: %S\n", descriptionSuitableForTestResult(frame).c_str(), title);
+        fprintf(testResult, "%s - didReceiveTitle: %S\n", descriptionSuitableForTestResult(frame).c_str(), title);
 
     if (::gTestRunner->dumpTitleChanges() && !done)
-        printf("TITLE CHANGED: '%S'\n", title ? title : L"");
+        fprintf(testResult, "TITLE CHANGED: '%S'\n", title ? title : L"");
     return S_OK;
 }
 
@@ -252,7 +252,7 @@
 HRESULT FrameLoadDelegate::didFinishLoadForFrame(_In_opt_ IWebView*, _In_opt_ IWebFrame* frame)
 {
     if (!done && gTestRunner->dumpFrameLoadCallbacks())
-        printf("%s - didFinishLoadForFrame\n", descriptionSuitableForTestResult(frame).c_str());
+        fprintf(testResult, "%s - didFinishLoadForFrame\n", descriptionSuitableForTestResult(frame).c_str());
 
     locationChangeDone(0, frame);
     return S_OK;
@@ -261,7 +261,7 @@
 HRESULT FrameLoadDelegate::didFailLoadWithError(_In_opt_ IWebView*, _In_opt_ IWebError* error, _In_opt_ IWebFrame* frame)
 {
     if (!done && gTestRunner->dumpFrameLoadCallbacks())
-        printf("%s - didFailLoadWithError\n", descriptionSuitableForTestResult(frame).c_str());
+        fprintf(testResult, "%s - didFailLoadWithError\n", descriptionSuitableForTestResult(frame).c_str());
 
     locationChangeDone(error, frame);
     return S_OK;
@@ -270,7 +270,7 @@
 HRESULT FrameLoadDelegate::willPerformClientRedirectToURL(_In_opt_ IWebView*, _In_ BSTR url, double /*delaySeconds*/, DATE /*fireDate*/, _In_opt_ IWebFrame* frame)
 {
     if (!done && gTestRunner->dumpFrameLoadCallbacks())
-        printf("%s - willPerformClientRedirectToURL: %S \n", descriptionSuitableForTestResult(frame).c_str(),
+        fprintf(testResult, "%s - willPerformClientRedirectToURL: %S \n", descriptionSuitableForTestResult(frame).c_str(),
                 urlSuitableForTestResult(std::wstring(url, ::SysStringLen(url))).c_str());
 
     return S_OK;
@@ -279,7 +279,7 @@
 HRESULT FrameLoadDelegate::didCancelClientRedirectForFrame(_In_opt_ IWebView*, _In_opt_ IWebFrame* frame)
 {
     if (!done && gTestRunner->dumpFrameLoadCallbacks())
-        printf("%s - didCancelClientRedirectForFrame\n", descriptionSuitableForTestResult(frame).c_str());
+        fprintf(testResult, "%s - didCancelClientRedirectForFrame\n", descriptionSuitableForTestResult(frame).c_str());
 
     return S_OK;
 }
@@ -293,7 +293,7 @@
 HRESULT FrameLoadDelegate::windowScriptObjectAvailable(IWebView*, JSContextRef, JSObjectRef)
 {
     if (!done && gTestRunner->dumpFrameLoadCallbacks())
-        printf("?? - windowScriptObjectAvailable\n");
+        fprintf(testResult, "?? - windowScriptObjectAvailable\n");
 
     ASSERT_NOT_REACHED();
 
@@ -375,7 +375,7 @@
 HRESULT FrameLoadDelegate::didFinishDocumentLoadForFrame(_In_opt_ IWebView* /*sender*/, _In_opt_ IWebFrame* frame)
 {
     if (!done && gTestRunner->dumpFrameLoadCallbacks())
-        printf("%s - didFinishDocumentLoadForFrame\n",
+        fprintf(testResult, "%s - didFinishDocumentLoadForFrame\n",
                 descriptionSuitableForTestResult(frame).c_str());
     if (!done) {
         COMPtr<IWebFramePrivate> webFramePrivate;
@@ -387,7 +387,7 @@
         if (FAILED(hr))
             return hr;
         if (pendingFrameUnloadEvents)
-            printf("%s - has %u onunload handler(s)\n",
+            fprintf(testResult, "%s - has %u onunload handler(s)\n",
                     descriptionSuitableForTestResult(frame).c_str(), pendingFrameUnloadEvents);
     }
 
@@ -397,7 +397,7 @@
 HRESULT FrameLoadDelegate::didHandleOnloadEventsForFrame(_In_opt_ IWebView* /*sender*/, _In_opt_ IWebFrame* frame)
 {
     if (!done && gTestRunner->dumpFrameLoadCallbacks())
-        printf("%s - didHandleOnloadEventsForFrame\n",
+        fprintf(testResult, "%s - didHandleOnloadEventsForFrame\n",
                 descriptionSuitableForTestResult(frame).c_str());
 
     return S_OK;
@@ -411,7 +411,7 @@
 HRESULT FrameLoadDelegate::didDisplayInsecureContent(_In_opt_ IWebView* /*sender*/)
 {
     if (!done && gTestRunner->dumpFrameLoadCallbacks())
-        printf("didDisplayInsecureContent\n");
+        fprintf(testResult, "didDisplayInsecureContent\n");
 
     return S_OK;
 }
@@ -419,7 +419,7 @@
 HRESULT FrameLoadDelegate::didRunInsecureContent(_In_opt_ IWebView* /*sender*/, _In_opt_ IWebSecurityOrigin* /*origin*/)
 {
     if (!done && gTestRunner->dumpFrameLoadCallbacks())
-        printf("didRunInsecureContent\n");
+        fprintf(testResult, "didRunInsecureContent\n");
 
     return S_OK;
 }
@@ -442,5 +442,5 @@
 void FrameLoadDelegate::webViewProgressFinishedNotification()
 {
     if (!done && gTestRunner->dumpProgressFinishedCallback())
-        printf("postProgressFinishedNotification\n");
+        fprintf(testResult, "postProgressFinishedNotification\n");
 }

Modified: trunk/Tools/DumpRenderTree/win/HistoryDelegate.cpp (210502 => 210503)


--- trunk/Tools/DumpRenderTree/win/HistoryDelegate.cpp	2017-01-09 12:43:49 UTC (rev 210502)
+++ trunk/Tools/DumpRenderTree/win/HistoryDelegate.cpp	2017-01-09 12:46:34 UTC (rev 210503)
@@ -140,7 +140,7 @@
 
     bool wasFailure = hasSubstituteData || (httpResponse && statusCode >= 400);
         
-    printf("WebView navigated to url \"%S\" with title \"%s\" with HTTP equivalent method \"%s\".  The navigation was %s and was %s%S.\n", 
+    fprintf(testResult, "WebView navigated to url \"%S\" with title \"%s\" with HTTP equivalent method \"%s\".  The navigation was %s and was %s%S.\n", 
         url.c_str(), 
         static_cast<char*>(titleBSTR),
         static_cast<char*>(httpMethodBSTR),
@@ -164,7 +164,7 @@
     if (destinationURL)
         destination = urlSuitableForTestResult(wstringFromBSTR(destinationURL));
 
-    printf("WebView performed a client redirect from \"%S\" to \"%S\".\n", source.c_str(), destination.c_str());
+    fprintf(testResult, "WebView performed a client redirect from \"%S\" to \"%S\".\n", source.c_str(), destination.c_str());
     return S_OK;
 }
     
@@ -181,7 +181,7 @@
     if (destinationURL)
         destination = urlSuitableForTestResult(wstringFromBSTR(destinationURL));
 
-    printf("WebView performed a server redirect from \"%S\" to \"%S\".\n", source.c_str(), destination.c_str());
+    fprintf(testResult, "WebView performed a server redirect from \"%S\" to \"%S\".\n", source.c_str(), destination.c_str());
     return S_OK;
 }
 
@@ -194,7 +194,7 @@
     if (urlBSTR)
         url = ""
 
-    printf("WebView updated the title for history URL \"%S\" to \"%S\".\n", url.c_str(), titleBSTR ? titleBSTR : L"");
+    fprintf(testResult, "WebView updated the title for history URL \"%S\" to \"%S\".\n", url.c_str(), titleBSTR ? titleBSTR : L"");
     return S_OK;
 }
     
@@ -212,7 +212,7 @@
         url = ""
 
     if (gTestRunner->dumpVisitedLinksCallback())
-        printf("Asked to populate visited links for WebView \"%S\"\n", url.c_str());
+        fprintf(testResult, "Asked to populate visited links for WebView \"%S\"\n", url.c_str());
 
     return S_OK;
 }

Modified: trunk/Tools/DumpRenderTree/win/PolicyDelegate.cpp (210502 => 210503)


--- trunk/Tools/DumpRenderTree/win/PolicyDelegate.cpp	2017-01-09 12:43:49 UTC (rev 210502)
+++ trunk/Tools/DumpRenderTree/win/PolicyDelegate.cpp	2017-01-09 12:46:34 UTC (rev 210503)
@@ -139,7 +139,7 @@
         }
     }
 
-    printf("%S\n", message.c_str());
+    fprintf(testResult, "%S\n", message.c_str());
 
     if (m_permissiveDelegate)
         listener->use();
@@ -166,7 +166,7 @@
     _bstr_t frameName;
     frame->name(&frameName.GetBSTR());
     
-    printf("Policy delegate: unable to implement policy with error domain '%S', error code %d, in frame '%S'\n", static_cast<wchar_t*>(domainStr), code, static_cast<TCHAR*>(frameName));
+    fprintf(testResult, "Policy delegate: unable to implement policy with error domain '%S', error code %d, in frame '%S'\n", static_cast<wchar_t*>(domainStr), code, static_cast<TCHAR*>(frameName));
     
     return S_OK;
 }

Modified: trunk/Tools/DumpRenderTree/win/ResourceLoadDelegate.cpp (210502 => 210503)


--- trunk/Tools/DumpRenderTree/win/ResourceLoadDelegate.cpp	2017-01-09 12:43:49 UTC (rev 210502)
+++ trunk/Tools/DumpRenderTree/win/ResourceLoadDelegate.cpp	2017-01-09 12:46:34 UTC (rev 210503)
@@ -236,7 +236,7 @@
     *newRequest = nullptr;
 
     if (!done && gTestRunner->dumpResourceLoadCallbacks()) {
-        printf("%S - willSendRequest %S redirectResponse %S\n", 
+        fprintf(testResult, "%S - willSendRequest %S redirectResponse %S\n", 
             descriptionSuitableForTestResult(identifier).c_str(),
             descriptionSuitableForTestResult(request).c_str(),
             descriptionSuitableForTestResult(redirectResponse).c_str());
@@ -246,13 +246,13 @@
         return S_OK;
 
     if (!done && gTestRunner->willSendRequestReturnsNullOnRedirect() && redirectResponse) {
-        printf("Returning null for this redirect\n");
+        fprintf(testResult, "Returning null for this redirect\n");
         return S_OK;
     }
 
     _bstr_t urlBstr;
     if (FAILED(request->URL(&urlBstr.GetBSTR()))) {
-        printf("Request has no URL\n");
+        fprintf(testResult, "Request has no URL\n");
         return E_FAIL;
     }
 
@@ -274,7 +274,7 @@
                 testHost = adoptCF(CFURLCopyHostName(testPathURL.get()));
             }
             if (!isLocalhost(host.get()) && !hostIsUsedBySomeTestsToGenerateError(host.get()) && (!testHost || isLocalhost(testHost.get()))) {
-                printf("Blocked access to external URL %s\n", static_cast<const char*>(urlBstr));
+                fprintf(testResult, "Blocked access to external URL %s\n", static_cast<const char*>(urlBstr));
                 return S_OK;
             }
         }
@@ -300,7 +300,7 @@
         return E_FAIL;
 
     if (!gTestRunner->handlesAuthenticationChallenges()) {
-        printf("%S - didReceiveAuthenticationChallenge - Simulating cancelled authentication sheet\n", descriptionSuitableForTestResult(identifier).c_str());
+        fprintf(testResult, "%S - didReceiveAuthenticationChallenge - Simulating cancelled authentication sheet\n", descriptionSuitableForTestResult(identifier).c_str());
         sender->continueWithoutCredentialForAuthenticationChallenge(challenge);
         return S_OK;
     }
@@ -308,7 +308,7 @@
     const char* user = gTestRunner->authenticationUsername().c_str();
     const char* password = gTestRunner->authenticationPassword().c_str();
 
-    printf("%S - didReceiveAuthenticationChallenge - Responding with %s:%s\n", descriptionSuitableForTestResult(identifier).c_str(), user, password);
+    fprintf(testResult, "%S - didReceiveAuthenticationChallenge - Responding with %s:%s\n", descriptionSuitableForTestResult(identifier).c_str(), user, password);
 
     COMPtr<IWebURLCredential> credential;
     if (FAILED(WebKitCreateInstance(CLSID_WebURLCredential, 0, IID_IWebURLCredential, (void**)&credential)))
@@ -323,7 +323,7 @@
     _In_opt_ IWebURLResponse* response, _In_opt_ IWebDataSource* dataSource)
 {
     if (!done && gTestRunner->dumpResourceLoadCallbacks()) {
-        printf("%S - didReceiveResponse %S\n",
+        fprintf(testResult, "%S - didReceiveResponse %S\n",
             descriptionSuitableForTestResult(identifier).c_str(),
             descriptionSuitableForTestResult(response).c_str());
     }
@@ -338,7 +338,7 @@
     
         wstring url = ""
 
-        printf("%S has MIME type %S\n", lastPathComponent(url).c_str(), static_cast<wchar_t*>(mimeTypeBSTR));
+        fprintf(testResult, "%S has MIME type %S\n", lastPathComponent(url).c_str(), static_cast<wchar_t*>(mimeTypeBSTR));
     }
 
     return S_OK;
@@ -348,7 +348,7 @@
 HRESULT ResourceLoadDelegate::didFinishLoadingFromDataSource(_In_opt_ IWebView* webView, unsigned long identifier, _In_opt_ IWebDataSource* dataSource)
 {
     if (!done && gTestRunner->dumpResourceLoadCallbacks()) {
-        printf("%S - didFinishLoading\n",
+        fprintf(testResult, "%S - didFinishLoading\n",
             descriptionSuitableForTestResult(identifier).c_str());
     }
 
@@ -360,7 +360,7 @@
 HRESULT ResourceLoadDelegate::didFailLoadingWithError(_In_opt_ IWebView* webView, unsigned long identifier, _In_opt_ IWebError* error, _In_opt_ IWebDataSource* dataSource)
 {
     if (!done && gTestRunner->dumpResourceLoadCallbacks()) {
-        printf("%S - didFailLoadingWithError: %S\n", 
+        fprintf(testResult, "%S - didFailLoadingWithError: %S\n", 
             descriptionSuitableForTestResult(identifier).c_str(),
             descriptionSuitableForTestResult(error, identifier).c_str());
     }

Modified: trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp (210502 => 210503)


--- trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp	2017-01-09 12:43:49 UTC (rev 210502)
+++ trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp	2017-01-09 12:46:34 UTC (rev 210503)
@@ -82,7 +82,7 @@
 void TestRunner::addDisallowedURL(JSStringRef url)
 {
     // FIXME: Implement!
-    printf("ERROR: TestRunner::addDisallowedURL(JSStringRef) not implemented\n");
+    fprintf(testResult, "ERROR: TestRunner::addDisallowedURL(JSStringRef) not implemented\n");
 }
 
 bool TestRunner::callShouldCloseOnWebView()
@@ -149,7 +149,7 @@
 JSValueRef TestRunner::originsWithApplicationCache(JSContextRef context)
 {
     // FIXME: Implement to get origins that have application caches.
-    printf("ERROR: TestRunner::originsWithApplicationCache(JSContextRef) not implemented\n");
+    fprintf(testResult, "ERROR: TestRunner::originsWithApplicationCache(JSContextRef) not implemented\n");
     return JSValueMakeUndefined(context);
 }
 
@@ -175,13 +175,13 @@
 void TestRunner::setStorageDatabaseIdleInterval(double)
 {
     // FIXME: Implement. Requires non-existant (on Windows) WebStorageManager
-    printf("ERROR: TestRunner::setStorageDatabaseIdleInterval(double) not implemented\n");
+    fprintf(testResult, "ERROR: TestRunner::setStorageDatabaseIdleInterval(double) not implemented\n");
 }
 
 void TestRunner::closeIdleLocalStorageDatabases()
 {
     // FIXME: Implement. Requires non-existant (on Windows) WebStorageManager
-    printf("ERROR: TestRunner::closeIdleLocalStorageDatabases(double) not implemented\n");
+    fprintf(testResult, "ERROR: TestRunner::closeIdleLocalStorageDatabases(double) not implemented\n");
 }
 
 void TestRunner::clearBackForwardList()
@@ -213,7 +213,7 @@
 JSStringRef TestRunner::copyDecodedHostName(JSStringRef name)
 {
     // FIXME: Implement!
-    printf("ERROR: TestRunner::copyDecodedHostName(JSStringRef) not implemented\n");
+    fprintf(testResult, "ERROR: TestRunner::copyDecodedHostName(JSStringRef) not implemented\n");
     return 0;
 }
 
@@ -220,7 +220,7 @@
 JSStringRef TestRunner::copyEncodedHostName(JSStringRef name)
 {
     // FIXME: Implement!
-    printf("ERROR: TestRunner::copyEncodedHostName(JSStringRef) not implemented\n");
+    fprintf(testResult, "ERROR: TestRunner::copyEncodedHostName(JSStringRef) not implemented\n");
     return 0;
 }
 
@@ -248,7 +248,7 @@
 int TestRunner::numberOfPendingGeolocationPermissionRequests()
 {
     // FIXME: Implement for Geolocation layout tests.
-    printf("ERROR: TestRunner::numberOfPendingGeolocationPermissionRequests() not implemented\n");
+    fprintf(testResult, "ERROR: TestRunner::numberOfPendingGeolocationPermissionRequests() not implemented\n");
     return -1;
 }
 
@@ -255,7 +255,7 @@
 bool TestRunner::isGeolocationProviderActive()
 {
     // FIXME: Implement for Geolocation layout tests.
-    printf("ERROR: TestRunner::isGeolocationProviderActive() not implemented\n");
+    fprintf(testResult, "ERROR: TestRunner::isGeolocationProviderActive() not implemented\n");
     return false;
 }
 
@@ -304,7 +304,7 @@
 
     wstring localPath;
     if (!resolveCygwinPath(input, localPath)) {
-        printf("ERROR: Failed to resolve Cygwin path %S\n", input.c_str());
+        fprintf(testResult, "ERROR: Failed to resolve Cygwin path %S\n", input.c_str());
         return nullptr;
     }
 
@@ -457,7 +457,7 @@
 {
     // FIXME: Implement for DeviceOrientation layout tests.
     // See https://bugs.webkit.org/show_bug.cgi?id=30335.
-    printf("ERROR: TestRunner::setMockDeviceOrientation() not implemented\n");
+    fprintf(testResult, "ERROR: TestRunner::setMockDeviceOrientation() not implemented\n");
 }
 
 void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed)
@@ -464,7 +464,7 @@
 {
     // FIXME: Implement for Geolocation layout tests.
     // See https://bugs.webkit.org/show_bug.cgi?id=28264.
-    printf("ERROR: TestRunner::setMockGeolocationPosition() not implemented\n");
+    fprintf(testResult, "ERROR: TestRunner::setMockGeolocationPosition() not implemented\n");
 }
 
 void TestRunner::setMockGeolocationPositionUnavailableError(JSStringRef message)
@@ -471,7 +471,7 @@
 {
     // FIXME: Implement for Geolocation layout tests.
     // See https://bugs.webkit.org/show_bug.cgi?id=28264.
-    printf("ERROR: TestRunner::setMockGeolocationPositionUnavailableError() not implemented\n");
+    fprintf(testResult, "ERROR: TestRunner::setMockGeolocationPositionUnavailableError() not implemented\n");
 }
 
 void TestRunner::setGeolocationPermission(bool allow)
@@ -533,7 +533,7 @@
 void TestRunner::setSpatialNavigationEnabled(bool enabled)
 {
     // FIXME: Implement for SpatialNavigation layout tests.
-    printf("ERROR: TestRunner::setSpatialNavigationEnabled(bool) not implemented\n");
+    fprintf(testResult, "ERROR: TestRunner::setSpatialNavigationEnabled(bool) not implemented\n");
 }
 
 void TestRunner::setAllowUniversalAccessFromFileURLs(bool enabled)
@@ -633,7 +633,7 @@
 void TestRunner::setAutomaticLinkDetectionEnabled(bool)
 {
     // FIXME: Implement this.
-    printf("ERROR: TestRunner::setAutomaticLinkDetectionEnabled(bool) not implemented\n");
+    fprintf(testResult, "ERROR: TestRunner::setAutomaticLinkDetectionEnabled(bool) not implemented\n");
 }
 
 void TestRunner::setTabKeyCyclesThroughElements(bool shouldCycle)
@@ -1036,7 +1036,7 @@
 
 bool TestRunner::isCommandEnabled(JSStringRef /*name*/)
 {
-    printf("ERROR: TestRunner::isCommandEnabled() not implemented\n");
+    fprintf(testResult, "ERROR: TestRunner::isCommandEnabled() not implemented\n");
     return false;
 }
 
@@ -1277,7 +1277,7 @@
 
 void TestRunner::authenticateSession(JSStringRef, JSStringRef, JSStringRef)
 {
-    printf("ERROR: TestRunner::authenticateSession() not implemented\n");
+    fprintf(testResult, "ERROR: TestRunner::authenticateSession() not implemented\n");
 }
 
 void TestRunner::abortModal()
@@ -1309,17 +1309,17 @@
 
 void TestRunner::addChromeInputField()
 {
-    printf("ERROR: TestRunner::addChromeInputField() not implemented\n");
+    fprintf(testResult, "ERROR: TestRunner::addChromeInputField() not implemented\n");
 }
 
 void TestRunner::removeChromeInputField()
 {
-    printf("ERROR: TestRunner::removeChromeInputField() not implemented\n");
+    fprintf(testResult, "ERROR: TestRunner::removeChromeInputField() not implemented\n");
 }
 
 void TestRunner::focusWebView()
 {
-    printf("ERROR: TestRunner::focusWebView() not implemented\n");
+    fprintf(testResult, "ERROR: TestRunner::focusWebView() not implemented\n");
 }
 
 void TestRunner::setBackingScaleFactor(double)
@@ -1363,22 +1363,22 @@
 
 void TestRunner::grantWebNotificationPermission(JSStringRef origin)
 {
-    printf("ERROR: TestRunner::grantWebNotificationPermission(JSStringRef) not implemented\n");
+    fprintf(testResult, "ERROR: TestRunner::grantWebNotificationPermission(JSStringRef) not implemented\n");
 }
 
 void TestRunner::denyWebNotificationPermission(JSStringRef jsOrigin)
 {
-    printf("ERROR: TestRunner::denyWebNotificationPermission(JSStringRef) not implemented\n");
+    fprintf(testResult, "ERROR: TestRunner::denyWebNotificationPermission(JSStringRef) not implemented\n");
 }
 
 void TestRunner::removeAllWebNotificationPermissions()
 {
-    printf("ERROR: TestRunner::removeAllWebNotificationPermissions() not implemented\n");
+    fprintf(testResult, "ERROR: TestRunner::removeAllWebNotificationPermissions() not implemented\n");
 }
 
 void TestRunner::simulateWebNotificationClick(JSValueRef jsNotification)
 {
-    printf("ERROR: TestRunner::simulateWebNotificationClick() not implemented\n");
+    fprintf(testResult, "ERROR: TestRunner::simulateWebNotificationClick() not implemented\n");
 }
 
 void TestRunner::simulateLegacyWebNotificationClick(JSStringRef title)
@@ -1388,7 +1388,7 @@
 
 unsigned TestRunner::imageCountInGeneralPasteboard() const
 {
-    printf("ERROR: TestRunner::imageCountInGeneralPasteboard() not implemented\n");
+    fprintf(testResult, "ERROR: TestRunner::imageCountInGeneralPasteboard() not implemented\n");
     return 0;
 }
 

Modified: trunk/Tools/DumpRenderTree/win/UIDelegate.cpp (210502 => 210503)


--- trunk/Tools/DumpRenderTree/win/UIDelegate.cpp	2017-01-09 12:43:49 UTC (rev 210502)
+++ trunk/Tools/DumpRenderTree/win/UIDelegate.cpp	2017-01-09 12:46:34 UTC (rev 210503)
@@ -453,8 +453,8 @@
 HRESULT UIDelegate::runJavaScriptAlertPanelWithMessage(_In_opt_ IWebView* /*sender*/, _In_ BSTR message)
 {
     if (!done) {
-        printf("ALERT: %S\n", message ? message : L"");
-        fflush(stdout);
+        fprintf(testResult, "ALERT: %S\n", message ? message : L"");
+        fflush(testResult);
     }
 
     return S_OK;
@@ -463,7 +463,7 @@
 HRESULT UIDelegate::runJavaScriptConfirmPanelWithMessage(_In_opt_ IWebView* /*sender*/, _In_ BSTR message, _Out_ BOOL* result)
 {
     if (!done)
-        printf("CONFIRM: %S\n", message ? message : L"");
+        fprintf(testResult, "CONFIRM: %S\n", message ? message : L"");
 
     *result = TRUE;
 
@@ -473,7 +473,7 @@
 HRESULT UIDelegate::runJavaScriptTextInputPanelWithPrompt(_In_opt_ IWebView* /*sender*/, _In_ BSTR message, _In_ BSTR defaultText, __deref_opt_out BSTR* result)
 {
     if (!done)
-        printf("PROMPT: %S, default text: %S\n", message ? message : L"", defaultText ? defaultText : L"");
+        fprintf(testResult, "PROMPT: %S, default text: %S\n", message ? message : L"", defaultText ? defaultText : L"");
 
     *result = SysAllocString(defaultText);
 
@@ -486,7 +486,7 @@
         return E_POINTER;
 
     if (!done)
-        printf("CONFIRM NAVIGATION: %S\n", message ? message : L"");
+        fprintf(testResult, "CONFIRM NAVIGATION: %S\n", message ? message : L"");
 
     *result = !gTestRunner->shouldStayOnPageAfterHandlingBeforeUnload();
 
@@ -507,7 +507,7 @@
             newMessage = newMessage.substr(0, fileProtocol) + lastPathComponent(newMessage.substr(fileProtocol + fileURL.size()));
     }
 
-    auto out = gTestRunner->dumpJSConsoleLogInStdErr() ? stderr : stdout;
+    auto out = gTestRunner->dumpJSConsoleLogInStdErr() ? stderr : testResult;
     fprintf(out, "CONSOLE MESSAGE: ");
     if (lineNumber)
         fprintf(out, "line %d: ", lineNumber);
@@ -594,7 +594,7 @@
     origin->port(&port);
 
     if (!done && gTestRunner->dumpDatabaseCallbacks())
-        printf("UI DELEGATE DATABASE CALLBACK: exceededDatabaseQuotaForSecurityOrigin:{%s, %s, %i} database:%S\n", static_cast<const char*>(protocol), static_cast<const char*>(host), port, databaseIdentifier);
+        fprintf(testResult, "UI DELEGATE DATABASE CALLBACK: exceededDatabaseQuotaForSecurityOrigin:{%s, %s, %i} database:%S\n", static_cast<const char*>(protocol), static_cast<const char*>(host), port, databaseIdentifier);
 
     unsigned long long defaultQuota = 5 * 1024 * 1024;
     double testDefaultQuota = gTestRunner->databaseDefaultQuota();
@@ -626,7 +626,7 @@
     if (maxQuota >= 0) {
         if (defaultQuota < expectedSize && expectedSize <= maxQuota) {
             newQuota = expectedSize;
-            printf("UI DELEGATE DATABASE CALLBACK: increased quota to %llu\n", newQuota);
+            fprintf(testResult, "UI DELEGATE DATABASE CALLBACK: increased quota to %llu\n", newQuota);
         }
     }
     origin->setQuota(newQuota);
@@ -660,7 +660,7 @@
 HRESULT UIDelegate::setStatusText(_In_opt_ IWebView*, _In_ BSTR text)
 { 
     if (gTestRunner->dumpStatusCallbacks())
-        printf("UI DELEGATE STATUS CALLBACK: setStatusText:%S\n", text ? text : L"");
+        fprintf(testResult, "UI DELEGATE STATUS CALLBACK: setStatusText:%S\n", text ? text : L"");
     return S_OK;
 }
 
@@ -693,6 +693,6 @@
 
 HRESULT UIDelegate::didPressMissingPluginButton(_In_opt_ IDOMElement* /*element*/)
 {
-    printf("MISSING PLUGIN BUTTON PRESSED\n");
+    fprintf(testResult, "MISSING PLUGIN BUTTON PRESSED\n");
     return S_OK;
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to