summaryrefslogtreecommitdiff
path: root/Tools/WebKitTestRunner
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-08-23 17:03:15 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-08-23 17:03:15 +0200
commita73d1c176f2f3e0458861de8590dc20321a501ae (patch)
treed897fc5974797c3cb300d7f5916f258df765401f /Tools/WebKitTestRunner
parentc311cf639cc1d6570d67b0a80a8ba04dc992a658 (diff)
downloadqtwebkit-a73d1c176f2f3e0458861de8590dc20321a501ae.tar.gz
Imported WebKit commit a5ae8a56a48e44ebfb9b81aaa5488affaffdb175 (http://svn.webkit.org/repository/webkit/trunk@126420)
New snapshot with OS X 10.6 build fix
Diffstat (limited to 'Tools/WebKitTestRunner')
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp17
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h2
-rw-r--r--Tools/WebKitTestRunner/TestController.cpp6
-rw-r--r--Tools/WebKitTestRunner/TestInvocation.cpp26
-rw-r--r--Tools/WebKitTestRunner/TestInvocation.h1
5 files changed, 34 insertions, 18 deletions
diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
index a44cc54d6..63ed17823 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
@@ -72,11 +72,16 @@ void InjectedBundle::didInitializePageGroup(WKBundleRef bundle, WKBundlePageGrou
static_cast<InjectedBundle*>(const_cast<void*>(clientInfo))->didInitializePageGroup(pageGroup);
}
-void InjectedBundle::didReceiveMessage(WKBundleRef bundle, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo)
+void InjectedBundle::didReceiveMessage(WKBundleRef bundle, WKStringRef messageName, WKTypeRef messageBody, const void* clientInfo)
{
static_cast<InjectedBundle*>(const_cast<void*>(clientInfo))->didReceiveMessage(messageName, messageBody);
}
+void InjectedBundle::didReceiveMessageToPage(WKBundleRef bundle, WKBundlePageRef page, WKStringRef messageName, WKTypeRef messageBody, const void* clientInfo)
+{
+ static_cast<InjectedBundle*>(const_cast<void*>(clientInfo))->didReceiveMessageToPage(page, messageName, messageBody);
+}
+
void InjectedBundle::initialize(WKBundleRef bundle, WKTypeRef initializationUserData)
{
m_bundle = bundle;
@@ -88,7 +93,8 @@ void InjectedBundle::initialize(WKBundleRef bundle, WKTypeRef initializationUser
didCreatePage,
willDestroyPage,
didInitializePageGroup,
- didReceiveMessage
+ didReceiveMessage,
+ didReceiveMessageToPage
};
WKBundleSetClient(m_bundle, &client);
@@ -190,6 +196,13 @@ void InjectedBundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messag
WKBundlePostMessage(m_bundle, errorMessageName.get(), errorMessageBody.get());
}
+void InjectedBundle::didReceiveMessageToPage(WKBundlePageRef page, WKStringRef messageName, WKTypeRef messageBody)
+{
+ WKRetainPtr<WKStringRef> errorMessageName(AdoptWK, WKStringCreateWithUTF8CString("Error"));
+ WKRetainPtr<WKStringRef> errorMessageBody(AdoptWK, WKStringCreateWithUTF8CString("Unknown"));
+ WKBundlePostMessage(m_bundle, errorMessageName.get(), errorMessageBody.get());
+}
+
bool InjectedBundle::booleanForKey(WKDictionaryRef dictionary, const char* key)
{
WKRetainPtr<WKStringRef> wkKey(AdoptWK, WKStringCreateWithUTF8CString(key));
diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
index 5309900da..d1f198f61 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
+++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
@@ -97,11 +97,13 @@ private:
static void willDestroyPage(WKBundleRef, WKBundlePageRef, const void* clientInfo);
static void didInitializePageGroup(WKBundleRef, WKBundlePageGroupRef, const void* clientInfo);
static void didReceiveMessage(WKBundleRef, WKStringRef messageName, WKTypeRef messageBody, const void* clientInfo);
+ static void didReceiveMessageToPage(WKBundleRef, WKBundlePageRef, WKStringRef messageName, WKTypeRef messageBody, const void* clientInfo);
void didCreatePage(WKBundlePageRef);
void willDestroyPage(WKBundlePageRef);
void didInitializePageGroup(WKBundlePageGroupRef);
void didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody);
+ void didReceiveMessageToPage(WKBundlePageRef, WKStringRef messageName, WKTypeRef messageBody);
void platformInitialize(WKTypeRef initializationUserData);
void resetLocalSettings();
diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp
index badb64643..d18fe3f30 100644
--- a/Tools/WebKitTestRunner/TestController.cpp
+++ b/Tools/WebKitTestRunner/TestController.cpp
@@ -625,8 +625,10 @@ void TestController::runTestingServerLoop()
void TestController::run()
{
- bool resetDone = resetStateToConsistentValues();
- ASSERT_UNUSED(resetDone, resetDone);
+ if (!resetStateToConsistentValues()) {
+ TestInvocation::dumpWebProcessUnresponsiveness("Failed to reset to consistent state before the first test");
+ return;
+ }
if (m_usingServerMode)
runTestingServerLoop();
diff --git a/Tools/WebKitTestRunner/TestInvocation.cpp b/Tools/WebKitTestRunner/TestInvocation.cpp
index d340f0f84..fd35af98e 100644
--- a/Tools/WebKitTestRunner/TestInvocation.cpp
+++ b/Tools/WebKitTestRunner/TestInvocation.cpp
@@ -198,32 +198,30 @@ end:
WKInspectorClose(WKPageGetInspector(TestController::shared().mainWebView()->page()));
#endif // ENABLE(INSPECTOR)
- bool resetDone = TestController::shared().resetStateToConsistentValues();
- // We expect resetting to not fail if there was no error or timeout.
- ASSERT(resetDone || errorMessage);
+ if (errorMessage || !TestController::shared().resetStateToConsistentValues())
+ dumpWebProcessUnresponsiveness(errorMessage);
+}
+void TestInvocation::dumpWebProcessUnresponsiveness(const char* textToStdout)
+{
const char* errorMessageToStderr = 0;
#if PLATFORM(MAC)
char buffer[64];
- if (!resetDone) {
- pid_t pid = WKPageGetProcessIdentifier(TestController::shared().mainWebView()->page());
- sprintf(buffer, "#PROCESS UNRESPONSIVE - WebProcess (pid %ld)\n", static_cast<long>(pid));
- errorMessageToStderr = buffer;
- }
+ pid_t pid = WKPageGetProcessIdentifier(TestController::shared().mainWebView()->page());
+ sprintf(buffer, "#PROCESS UNRESPONSIVE - WebProcess (pid %ld)\n", static_cast<long>(pid));
+ errorMessageToStderr = buffer;
#else
- if (!resetDone)
- errorMessageToStderr = "#PROCESS UNRESPONSIVE - WebProcess";
+ errorMessageToStderr = "#PROCESS UNRESPONSIVE - WebProcess";
#endif
- if (errorMessage)
- dump(errorMessage, errorMessageToStderr, true);
+ dump(textToStdout, errorMessageToStderr, true);
}
void TestInvocation::dump(const char* textToStdout, const char* textToStderr, bool seenError)
{
printf("Content-Type: text/plain\n");
- printf("%s", textToStdout);
-
+ if (textToStdout)
+ fputs(textToStdout, stdout);
if (textToStderr)
fputs(textToStderr, stderr);
diff --git a/Tools/WebKitTestRunner/TestInvocation.h b/Tools/WebKitTestRunner/TestInvocation.h
index 903cf066c..49641e9ee 100644
--- a/Tools/WebKitTestRunner/TestInvocation.h
+++ b/Tools/WebKitTestRunner/TestInvocation.h
@@ -44,6 +44,7 @@ public:
void didReceiveMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody);
WKRetainPtr<WKTypeRef> didReceiveSynchronousMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody);
+ static void dumpWebProcessUnresponsiveness(const char* textToStdout);
private:
static void dump(const char* textToStdout, const char* textToStderr = 0, bool seenError = false);
void dumpPixelsAndCompareWithExpected(WKImageRef, WKArrayRef repaintRects);