DumpRenderTree doesn't call Internals::resetToConsistentState() before the first...
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Apr 2019 22:41:59 +0000 (22:41 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Apr 2019 22:41:59 +0000 (22:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197273

Reviewed by Dean Jackson.

Reorder code so that we create gTestRunner before calling resetWebViewToConsistentStateBeforeTesting(),
so that WebCoreTestSupport::resetInternalsObject() is always run.

* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebViewToConsistentStateBeforeTesting):
(runTest):

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

Tools/ChangeLog
Tools/DumpRenderTree/mac/DumpRenderTree.mm

index 6f73054..b19e448 100644 (file)
         * TestWebKitAPI/Tests/WebKitCocoa/WKURLSchemeHandler-1.mm: Add a test that POSTs all sorts of things
           from an XHR to a custom protocol.
 
+2019-04-25  Simon Fraser  <simon.fraser@apple.com>
+
+        DumpRenderTree doesn't call Internals::resetToConsistentState() before the first test
+        https://bugs.webkit.org/show_bug.cgi?id=197273
+
+        Reviewed by Dean Jackson.
+
+        Reorder code so that we create gTestRunner before calling resetWebViewToConsistentStateBeforeTesting(),
+        so that WebCoreTestSupport::resetInternalsObject() is always run.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (resetWebViewToConsistentStateBeforeTesting):
+        (runTest):
+
 2019-04-24  John Wilander  <wilander@apple.com>
 
         Age out unconverted Ad Click Attributions after one week.
index 5273395..4935322 100644 (file)
@@ -1882,12 +1882,12 @@ static void resetWebViewToConsistentStateBeforeTesting(const TestOptions& option
 
     setlocale(LC_ALL, "");
 
-    if (gTestRunner) {
-        gTestRunner->resetPageVisibility();
-        WebCoreTestSupport::resetInternalsObject([mainFrame globalContext]);
-        // in the case that a test using the chrome input field failed, be sure to clean up for the next test
-        gTestRunner->removeChromeInputField();
-    }
+    ASSERT(gTestRunner);
+    gTestRunner->resetPageVisibility();
+    // In the case that a test using the chrome input field failed, be sure to clean up for the next test.
+    gTestRunner->removeChromeInputField();
+
+    WebCoreTestSupport::resetInternalsObject([mainFrame globalContext]);
 
 #if !PLATFORM(IOS_FAMILY)
     if (WebCore::Frame* frame = [webView _mainCoreFrame])
@@ -2005,18 +2005,18 @@ static void runTest(const string& inputLine)
     }
     mainFrameTestOptions = options;
 
-    resetWebViewToConsistentStateBeforeTesting(options);
-
     const char* testURL([[url absoluteString] UTF8String]);
+    gTestRunner = TestRunner::create(testURL, command.expectedPixelHash);
+    gTestRunner->setAllowedHosts(allowedHosts);
+    gTestRunner->setCustomTimeout(command.timeout);
+    gTestRunner->setDumpJSConsoleLogInStdErr(command.dumpJSConsoleLogInStdErr || options.dumpJSConsoleLogInStdErr);
+
+    resetWebViewToConsistentStateBeforeTesting(options);
 
 #if !PLATFORM(IOS_FAMILY)
     changeWindowScaleIfNeeded(testURL);
 #endif
 
-    gTestRunner = TestRunner::create(testURL, command.expectedPixelHash);
-    gTestRunner->setAllowedHosts(allowedHosts);
-    gTestRunner->setCustomTimeout(command.timeout);
-    gTestRunner->setDumpJSConsoleLogInStdErr(command.dumpJSConsoleLogInStdErr || options.dumpJSConsoleLogInStdErr);
     topLoadingFrame = nil;
 #if !PLATFORM(IOS_FAMILY)
     ASSERT(!draggingInfo); // the previous test should have called eventSender.mouseUp to drop!