2011-01-07 Maciej Stachowiak <mjs@apple.com>
authormjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 8 Jan 2011 00:21:52 +0000 (00:21 +0000)
committermjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 8 Jan 2011 00:21:52 +0000 (00:21 +0000)
        Reviewed by Sam Weinig.

        Make WebKitTestRunner rest between loads more robust to avoid test crashes
        https://bugs.webkit.org/show_bug.cgi?id=52086

        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
        (WTR::InjectedBundle::didReceiveMessage):
        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
        (WTR::LayoutTestController::notifyDone):
        * WebKitTestRunner/TestController.cpp:
        (WTR::TestController::resetStateToConsistentValues):
        (WTR::TestController::run):

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

Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
Tools/WebKitTestRunner/TestController.cpp

index dcdfc5f9baa1126ab88db31864bad5f9caf6840e..70f7a4f2bc6445ea2bfd3a57f8ff87205d38d492 100644 (file)
@@ -1,3 +1,18 @@
+2011-01-07  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Make WebKitTestRunner rest between loads more robust to avoid test crashes
+        https://bugs.webkit.org/show_bug.cgi?id=52086
+
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+        (WTR::InjectedBundle::didReceiveMessage):
+        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
+        (WTR::LayoutTestController::notifyDone):
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::resetStateToConsistentValues):
+        (WTR::TestController::run):
+
 2011-01-07  James Robinson  <jamesr@chromium.org>
 
         Revert "Implement mozilla's animationTime property"
index 49d9db6c1c056ea21026dc87dad8ce0c7f36df98..f68d3c4836c7e9b93084e6d29c11784d18bedb15 100644 (file)
@@ -128,6 +128,9 @@ void InjectedBundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messag
 
         beginTesting();
         return;
+    } else if (WKStringIsEqualToUTF8CString(messageName, "Reset")) {
+        m_state = Idle;
+        return;
     }
 
     WKRetainPtr<WKStringRef> errorMessageName(AdoptWK, WKStringCreateWithUTF8CString("Error"));
index 60e313044dc43e090f4f26bb74bf26fb511182b8..aa3dbf45348a67562acf9eeb35a6db72ce5574c0 100644 (file)
@@ -129,6 +129,9 @@ void LayoutTestController::waitToDumpWatchdogTimerFired()
 
 void LayoutTestController::notifyDone()
 {
+    if (!InjectedBundle::shared().isTestRunning())
+        return;
+
     if (m_waitToDump && !InjectedBundle::shared().page()->isLoading())
         InjectedBundle::shared().page()->dump();
     m_waitToDump = false;
index 77213a24460990a798907ee3b40517201d6558bd..3ea46eef297deeb48dce62481a1324540b339a57 100644 (file)
@@ -280,6 +280,9 @@ bool TestController::resetStateToConsistentValues()
 {
     m_state = Resetting;
 
+    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("Reset"));
+    WKContextPostMessageToInjectedBundle(TestController::shared().context(), messageName.get(), 0);
+
     // FIXME: This function should also ensure that there is only one page open.
 
     // Reset preferences
@@ -353,6 +356,7 @@ void TestController::run()
                 break;
         }
     }
+
 }
 
 void TestController::runUntil(bool& done, TimeoutDuration timeoutDuration)