Diff
Modified: trunk/Tools/ChangeLog (145707 => 145708)
--- trunk/Tools/ChangeLog 2013-03-13 12:48:28 UTC (rev 145707)
+++ trunk/Tools/ChangeLog 2013-03-13 12:48:47 UTC (rev 145708)
@@ -1,3 +1,139 @@
+2013-03-12 Simon Hausmann <simon.hausm...@digia.com>
+
+ [Qt] Prepare DRT for transition to shared TestRunner interface
+ https://bugs.webkit.org/show_bug.cgi?id=112144
+
+ Reviewed by Benjamin Poulain.
+
+ Prepare Qt's DRT for a transition from the QObject based TestRunner to
+ the JSC C API based one.
+
+ This is impplemented by instantiating the QObject based testRunner in
+ the global object, then instantiating the JSC C based TestRunner
+ separately and placing it "behind" the QObject based testRunner through
+ injection of the individual functions through proxies. (prototype
+ chaining doesn't work due to the this object and Function.prototype.bind
+ doesn't work due to the native function)
+
+ This allows for porting over method by method by removing the method
+ from the QObject TestRunnerQt and implementing it in the JSC C based
+ TestRunner.
+
+ In order for this to link and run dummy implementations of all the
+ necessary TestRunner functions are provided.
+
+ * DumpRenderTree/qt/DumpRenderTree.pro:
+ * DumpRenderTree/qt/DumpRenderTreeMain.cpp:
+ * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
+ (WebCore::DumpRenderTree::resetToConsistentStateBeforeTesting):
+ (WebCore::DumpRenderTree::initJSObjects):
+ * DumpRenderTree/qt/DumpRenderTreeQt.h:
+ (DumpRenderTree):
+ * DumpRenderTree/qt/TestRunnerQt.cpp:
+ (TestRunner::~TestRunner):
+ (TestRunner::addDisallowedURL):
+ (TestRunner::queueLoad):
+ (TestRunner::removeAllVisitedLinks):
+ (TestRunner::setAcceptsEditing):
+ (TestRunner::simulateLegacyWebNotificationClick):
+ (TestRunner::setWindowIsKey):
+ (TestRunner::setAlwaysAcceptCookies):
+ (TestRunner::addOriginAccessWhitelistEntry):
+ (TestRunner::setWebViewEditable):
+ (TestRunner::clearAllApplicationCaches):
+ (TestRunner::setTextDirection):
+ (TestRunner::notifyDone):
+ (TestRunner::numberOfPendingGeolocationPermissionRequests):
+ (TestRunner::overridePreference):
+ (TestRunner::pathToLocalResource):
+ (TestRunner::removeAllWebNotificationPermissions):
+ (TestRunner::simulateWebNotificationClick):
+ (TestRunner::closeIdleLocalStorageDatabases):
+ (TestRunner::focusWebView):
+ (TestRunner::setBackingScaleFactor):
+ (TestRunner::removeChromeInputField):
+ (TestRunner::addChromeInputField):
+ (TestRunner::originsWithLocalStorage):
+ (TestRunner::deleteAllLocalStorage):
+ (TestRunner::deleteLocalStorageForOrigin):
+ (TestRunner::observeStorageTrackerNotifications):
+ (TestRunner::syncLocalStorage):
+ (TestRunner::windowCount):
+ (TestRunner::setWaitToDump):
+ (TestRunner::waitForPolicyDelegate):
+ (TestRunner::webHistoryItemCount):
+ (TestRunner::showWebInspector):
+ (TestRunner::closeWebInspector):
+ (TestRunner::evaluateInWebInspector):
+ (TestRunner::setSerializeHTTPLoads):
+ (TestRunner::apiTestNewWindowDataLoadBaseURL):
+ (TestRunner::setCustomPolicyDelegate):
+ (TestRunner::setDatabaseQuota):
+ (TestRunner::setDomainRelaxationForbiddenForURLScheme):
+ (TestRunner::resetPageVisibility):
+ (TestRunner::keepWebHistory):
+ (TestRunner::goBack):
+ (TestRunner::originsWithApplicationCache):
+ (TestRunner::applicationCacheDiskUsageForOrigin):
+ (TestRunner::display):
+ (TestRunner::dispatchPendingLoadRequests):
+ (TestRunner::clearPersistentUserStyleSheet):
+ (TestRunner::callShouldCloseOnWebView):
+ (TestRunner::copyDecodedHostName):
+ (TestRunner::clearBackForwardList):
+ (TestRunner::clearAllDatabases):
+ (TestRunner::clearApplicationCacheForOrigin):
+ (TestRunner::apiTestGoToCurrentBackForwardItem):
+ (TestRunner::authenticateSession):
+ (TestRunner::abortModal):
+ (TestRunner::setStorageDatabaseIdleInterval):
+ (TestRunner::setAsynchronousSpellCheckingEnabled):
+ (TestRunner::setXSSAuditorEnabled):
+ (TestRunner::setSpatialNavigationEnabled):
+ (TestRunner::setScrollbarPolicy):
+ (TestRunner::setJavaScriptCanAccessClipboard):
+ (TestRunner::setAutomaticLinkDetectionEnabled):
+ (TestRunner::setUserStyleSheetEnabled):
+ (TestRunner::setUserStyleSheetLocation):
+ (TestRunner::setUseDashboardCompatibilityMode):
+ (TestRunner::setTabKeyCyclesThroughElements):
+ (TestRunner::setSmartInsertDeleteEnabled):
+ (TestRunner::setSelectTrailingWhitespaceEnabled):
+ (TestRunner::setPrivateBrowsingEnabled):
+ (TestRunner::setPluginsEnabled):
+ (TestRunner::setPopupBlockingEnabled):
+ (TestRunner::setMockSpeechInputDumpRect):
+ (TestRunner::setPersistentUserStyleSheetLocation):
+ (TestRunner::setMockGeolocationPosition):
+ (TestRunner::setMockGeolocationPositionUnavailableError):
+ (TestRunner::setMockDeviceOrientation):
+ (TestRunner::setMainFrameIsFirstResponder):
+ (TestRunner::setIconDatabaseEnabled):
+ (TestRunner::setGeolocationPermission):
+ (TestRunner::setDefersLoading):
+ (TestRunner::setCacheModel):
+ (TestRunner::setAuthorAndUserStylesEnabled):
+ (TestRunner::setAllowFileAccessFromFileURLs):
+ (TestRunner::setAppCacheMaximumSize):
+ (TestRunner::setAllowUniversalAccessFromFileURLs):
+ (TestRunner::setApplicationCacheOriginQuota):
+ (TestRunner::denyWebNotificationPermission):
+ (TestRunner::grantWebNotificationPermission):
+ (TestRunner::setValueForUser):
+ (TestRunner::setViewModeMediaFeature):
+ (TestRunner::setPageVisibility):
+ (TestRunner::addMockSpeechInputResult):
+ (TestRunner::removeOriginAccessWhitelistEntry):
+ (TestRunner::addUserScript):
+ (TestRunner::isCommandEnabled):
+ (TestRunner::evaluateScriptInIsolatedWorld):
+ (TestRunner::evaluateScriptInIsolatedWorldAndReturnValue):
+ (TestRunner::copyEncodedHostName):
+ (TestRunner::addUserStyleSheet):
+ (TestRunner::findString):
+ (TestRunner::execCommand):
+ (TestRunner::localStorageDiskUsageForOrigin):
+
2013-03-12 Julie Parent <jpar...@chromium.org>
Cleanup: Move flatten-trie to loader.
Modified: trunk/Tools/DumpRenderTree/qt/DumpRenderTree.pro (145707 => 145708)
--- trunk/Tools/DumpRenderTree/qt/DumpRenderTree.pro 2013-03-13 12:48:28 UTC (rev 145707)
+++ trunk/Tools/DumpRenderTree/qt/DumpRenderTree.pro 2013-03-13 12:48:47 UTC (rev 145708)
@@ -27,6 +27,7 @@
$$PWD/../WorkQueue.h \
$$PWD/../DumpRenderTree.h \
$$PWD/../GCController.h \
+ $$PWD/../TextRunner.h \
DumpRenderTreeQt.h \
EventSenderQt.h \
TextInputControllerQt.h \
@@ -38,6 +39,7 @@
$$PWD/../WorkQueue.cpp \
$$PWD/../DumpRenderTreeCommon.cpp \
$$PWD/../GCController.cpp \
+ $$PWD/../TestRunner.cpp \
DumpRenderTreeQt.cpp \
EventSenderQt.cpp \
TextInputControllerQt.cpp \
Modified: trunk/Tools/DumpRenderTree/qt/DumpRenderTreeMain.cpp (145707 => 145708)
--- trunk/Tools/DumpRenderTree/qt/DumpRenderTreeMain.cpp 2013-03-13 12:48:28 UTC (rev 145707)
+++ trunk/Tools/DumpRenderTree/qt/DumpRenderTreeMain.cpp 2013-03-13 12:48:47 UTC (rev 145708)
@@ -42,7 +42,6 @@
#include <wtf/AlwaysInline.h>
-#include <wtf/ExportMacros.h>
#ifdef Q_WS_X11
#include <qx11info_x11.h>
Modified: trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp (145707 => 145708)
--- trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp 2013-03-13 12:48:28 UTC (rev 145707)
+++ trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp 2013-03-13 12:48:47 UTC (rev 145708)
@@ -38,7 +38,9 @@
#include "GCController.h"
#include "InitWebCoreQt.h"
#include "InitWebKitQt.h"
+#include "JSStringRefQt.h"
#include "QtTestSupport.h"
+#include "TestRunner.h"
#include "TestRunnerQt.h"
#include "TextInputControllerQt.h"
#include "testplugin.h"
@@ -524,6 +526,8 @@
// of the DRT.
m_controller->reset();
+ m_jscController = TestRunner::create(url.toString().toStdString(), m_expectedHash.toStdString());
+
// reset mouse clicks counter
m_eventSender->resetClickCount();
@@ -746,6 +750,40 @@
frame->addToJavaScriptWindowObject(QLatin1String("textInputController"), m_textInputController);
m_gcController->makeWindowObject(context, window, 0);
+ if (m_jscController) {
+ JSObjectRef dummyWindow = JSObjectMake(context, 0, 0);
+ m_jscController->makeWindowObject(context, dummyWindow, 0);
+ JSRetainPtr<JSStringRef> testRunnerName(Adopt, JSStringCreateWithUTF8CString("testRunner"));
+ JSValueRef wrappedTestRunner = JSObjectGetProperty(context, dummyWindow, testRunnerName.get(), 0);
+ JSRetainPtr<JSStringRef> helperScript(Adopt, JSStringCreateWithUTF8CString("(function() {\n"
+ " function bind(fun, thisArg) {\n"
+ " return function() {\n"
+ " return fun.apply(thisArg, Array.prototype.slice.call(arguments));\n"
+ " }\n"
+ " }\n"
+ "for (var prop in this.jscBasedTestRunner) {\n"
+ " var pd = Object.getOwnPropertyDescriptor(this.qtBasedTestRunner, prop);\n"
+ " if (pd !== undefined) continue;\n"
+ " pd = Object.getOwnPropertyDescriptor(this.jscBasedTestRunner, prop);\n"
+ " this.qtBasedTestRunner[prop] = bind(this.jscBasedTestRunner[prop], this.jscBasedTestRunner);\n"
+ "}\n"
+ "}).apply(this)\n"));
+
+ JSRetainPtr<JSStringRef> qtBasedTestRunnerName(Adopt, JSStringCreateWithUTF8CString("qtBasedTestRunner"));
+ JSRetainPtr<JSStringRef> jscBasedTestRunnerName(Adopt, JSStringCreateWithUTF8CString("jscBasedTestRunner"));
+
+ JSObjectRef args = JSObjectMake(context, 0, 0);
+ JSObjectSetProperty(context, args, qtBasedTestRunnerName.get(), JSObjectGetProperty(context, window, testRunnerName.get(), 0), 0, 0);
+ JSObjectSetProperty(context, args, jscBasedTestRunnerName.get(), wrappedTestRunner, 0, 0);
+
+ JSValueRef ex = 0;
+ JSEvaluateScript(context, helperScript.get(), args, 0, 0, &ex);
+ if (ex) {
+ JSRetainPtr<JSStringRef> msg(Adopt, JSValueToStringCopy(context, ex, 0));
+ fprintf(stderr, "Error evaluating TestRunner setup-script: %s\n", qPrintable(JSStringCopyQString(msg.get())));
+ }
+ }
+
DumpRenderTreeSupportQt::injectInternalsObject(frame->handle());
}
Modified: trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h (145707 => 145708)
--- trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h 2013-03-13 12:48:28 UTC (rev 145707)
+++ trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h 2013-03-13 12:48:47 UTC (rev 145708)
@@ -41,12 +41,14 @@
#endif
#include "DumpRenderTreeSupportQt.h"
+#include "TestRunner.h"
#include <qgraphicsview.h>
#include <qgraphicswebview.h>
#include <qwebframe.h>
#include <qwebinspector.h>
#include <qwebpage.h>
#include <qwebview.h>
+#include <wtf/RefPtr.h>
QT_BEGIN_NAMESPACE
class QUrl;
@@ -144,6 +146,7 @@
QString dumpBackForwardList(QWebPage* page);
QString dumpFrameScrollPosition(QWebFrame* frame);
TestRunnerQt *m_controller;
+ RefPtr<TestRunner> m_jscController;
bool m_dumpPixelsForCurrentTest;
bool m_dumpPixelsForAllTests;
Modified: trunk/Tools/DumpRenderTree/qt/TestRunnerQt.cpp (145707 => 145708)
--- trunk/Tools/DumpRenderTree/qt/TestRunnerQt.cpp 2013-03-13 12:48:28 UTC (rev 145707)
+++ trunk/Tools/DumpRenderTree/qt/TestRunnerQt.cpp 2013-03-13 12:48:47 UTC (rev 145708)
@@ -48,6 +48,10 @@
reset();
}
+TestRunner::~TestRunner()
+{
+}
+
void TestRunnerQt::reset()
{
m_hasDumped = false;
@@ -926,3 +930,427 @@
const unsigned TestRunnerQt::maxViewWidth = 800;
const unsigned TestRunnerQt::maxViewHeight = 600;
+
+// --- JSC C API stubs
+
+void TestRunner::addDisallowedURL(JSStringRef url)
+{
+}
+
+void TestRunner::queueLoad(JSStringRef url, JSStringRef target)
+{
+}
+
+void TestRunner::removeAllVisitedLinks()
+{
+}
+
+void TestRunner::setAcceptsEditing(bool)
+{
+}
+
+void TestRunner::simulateLegacyWebNotificationClick(JSStringRef title)
+{
+}
+
+void TestRunner::setWindowIsKey(bool)
+{
+}
+
+void TestRunner::setAlwaysAcceptCookies(bool)
+{
+}
+
+void TestRunner::addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains)
+{
+}
+
+void TestRunner::setWebViewEditable(bool)
+{
+}
+
+void TestRunner::clearAllApplicationCaches()
+{
+}
+
+void TestRunner::setTextDirection(JSStringRef)
+{
+}
+
+void TestRunner::notifyDone()
+{
+}
+
+int TestRunner::numberOfPendingGeolocationPermissionRequests()
+{
+ return 0;
+}
+
+void TestRunner::overridePreference(JSStringRef key, JSStringRef value)
+{
+}
+
+JSStringRef TestRunner::pathToLocalResource(JSContextRef, JSStringRef url)
+{
+ return JSStringCreateWithUTF8CString(0); // ### Take impl from WTR
+}
+
+void TestRunner::removeAllWebNotificationPermissions()
+{
+}
+
+void TestRunner::simulateWebNotificationClick(JSValueRef notification)
+{
+}
+
+void TestRunner::closeIdleLocalStorageDatabases()
+{
+}
+
+void TestRunner::focusWebView()
+{
+}
+
+void TestRunner::setBackingScaleFactor(double)
+{
+}
+
+void TestRunner::removeChromeInputField()
+{
+}
+
+void TestRunner::addChromeInputField()
+{
+}
+
+JSValueRef TestRunner::originsWithLocalStorage(JSContextRef context)
+{
+ return JSValueMakeNull(context);
+}
+
+void TestRunner::deleteAllLocalStorage()
+{
+}
+
+void TestRunner::deleteLocalStorageForOrigin(JSStringRef originIdentifier)
+{
+}
+
+void TestRunner::observeStorageTrackerNotifications(unsigned number)
+{
+}
+
+void TestRunner::syncLocalStorage()
+{
+}
+
+int TestRunner::windowCount()
+{
+ return 0;
+}
+
+void TestRunner::setWaitToDump(bool)
+{
+}
+
+void TestRunner::waitForPolicyDelegate()
+{
+}
+
+size_t TestRunner::webHistoryItemCount()
+{
+ return 0;
+}
+
+void TestRunner::showWebInspector()
+{
+}
+
+void TestRunner::closeWebInspector()
+{
+}
+
+void TestRunner::evaluateInWebInspector(long callId, JSStringRef script)
+{
+}
+
+void TestRunner::setSerializeHTTPLoads(bool)
+{
+}
+
+void TestRunner::apiTestNewWindowDataLoadBaseURL(JSStringRef utf8Data, JSStringRef baseURL)
+{
+}
+
+void TestRunner::setCustomPolicyDelegate(bool setDelegate, bool permissive)
+{
+}
+
+void TestRunner::setDatabaseQuota(unsigned long long quota)
+{
+}
+
+void TestRunner::setDomainRelaxationForbiddenForURLScheme(bool forbidden, JSStringRef scheme)
+{
+}
+
+void TestRunner::resetPageVisibility()
+{
+}
+
+void TestRunner::keepWebHistory()
+{
+}
+
+void TestRunner::goBack()
+{
+}
+
+JSValueRef TestRunner::originsWithApplicationCache(JSContextRef context)
+{
+ return JSValueMakeNull(context);
+}
+
+long long TestRunner::applicationCacheDiskUsageForOrigin(JSStringRef name)
+{
+ return 0;
+}
+
+void TestRunner::display()
+{
+}
+
+void TestRunner::dispatchPendingLoadRequests()
+{
+}
+
+void TestRunner::clearPersistentUserStyleSheet()
+{
+}
+
+bool TestRunner::callShouldCloseOnWebView()
+{
+ return false;
+}
+
+JSStringRef TestRunner::copyDecodedHostName(JSStringRef name)
+{
+ return JSStringCreateWithUTF8CString(0);
+}
+
+void TestRunner::clearBackForwardList()
+{
+}
+
+void TestRunner::clearAllDatabases()
+{
+}
+
+void TestRunner::clearApplicationCacheForOrigin(JSStringRef name)
+{
+}
+
+void TestRunner::apiTestGoToCurrentBackForwardItem()
+{
+}
+
+void TestRunner::authenticateSession(JSStringRef url, JSStringRef username, JSStringRef password)
+{
+}
+
+void TestRunner::abortModal()
+{
+}
+
+void TestRunner::setStorageDatabaseIdleInterval(double)
+{
+}
+
+void TestRunner::setAsynchronousSpellCheckingEnabled(bool)
+{
+}
+
+void TestRunner::setXSSAuditorEnabled(bool flag)
+{
+}
+
+void TestRunner::setSpatialNavigationEnabled(bool)
+{
+}
+
+void TestRunner::setScrollbarPolicy(JSStringRef orientation, JSStringRef policy)
+{
+}
+
+void TestRunner::setJavaScriptCanAccessClipboard(bool flag)
+{
+}
+
+void TestRunner::setAutomaticLinkDetectionEnabled(bool flag)
+{
+}
+
+void TestRunner::setUserStyleSheetEnabled(bool flag)
+{
+}
+
+void TestRunner::setUserStyleSheetLocation(JSStringRef path)
+{
+}
+
+void TestRunner::setUseDashboardCompatibilityMode(bool flag)
+{
+}
+
+void TestRunner::setTabKeyCyclesThroughElements(bool)
+{
+}
+
+void TestRunner::setSmartInsertDeleteEnabled(bool)
+{
+}
+
+void TestRunner::setSelectTrailingWhitespaceEnabled(bool)
+{
+}
+
+void TestRunner::setPrivateBrowsingEnabled(bool)
+{
+}
+
+void TestRunner::setPluginsEnabled(bool)
+{
+}
+
+void TestRunner::setPopupBlockingEnabled(bool)
+{
+}
+
+void TestRunner::setMockSpeechInputDumpRect(bool flag)
+{
+}
+
+void TestRunner::setPersistentUserStyleSheetLocation(JSStringRef path)
+{
+}
+
+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)
+{
+}
+
+void TestRunner::setMockGeolocationPositionUnavailableError(JSStringRef message)
+{
+}
+
+void TestRunner::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
+{
+}
+
+void TestRunner::setMainFrameIsFirstResponder(bool flag)
+{
+}
+
+void TestRunner::setIconDatabaseEnabled(bool)
+{
+}
+
+void TestRunner::setGeolocationPermission(bool allow)
+{
+}
+
+void TestRunner::setDefersLoading(bool)
+{
+}
+
+void TestRunner::setCacheModel(int)
+{
+}
+
+void TestRunner::setAuthorAndUserStylesEnabled(bool)
+{
+}
+
+void TestRunner::setAllowFileAccessFromFileURLs(bool)
+{
+}
+
+void TestRunner::setAppCacheMaximumSize(unsigned long long quota)
+{
+}
+
+void TestRunner::setAllowUniversalAccessFromFileURLs(bool)
+{
+}
+
+void TestRunner::setApplicationCacheOriginQuota(unsigned long long)
+{
+}
+
+void TestRunner::denyWebNotificationPermission(JSStringRef origin)
+{
+}
+
+void TestRunner::grantWebNotificationPermission(JSStringRef origin)
+{
+}
+
+void TestRunner::setValueForUser(JSContextRef, JSValueRef nodeObject, JSStringRef value)
+{
+}
+
+void TestRunner::setViewModeMediaFeature(JSStringRef)
+{
+}
+
+void TestRunner::setPageVisibility(const char *)
+{
+}
+
+void TestRunner::addMockSpeechInputResult(JSStringRef result, double confidence, JSStringRef language)
+{
+}
+
+void TestRunner::removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains)
+{
+}
+
+void TestRunner::addUserScript(JSStringRef source, bool runAtStart, bool allFrames)
+{
+}
+
+bool TestRunner::isCommandEnabled(JSStringRef name)
+{
+ return false;
+}
+
+void TestRunner::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script)
+{
+}
+
+void TestRunner::evaluateScriptInIsolatedWorldAndReturnValue(unsigned worldID, JSObjectRef globalObject, JSStringRef script)
+{
+}
+
+JSStringRef TestRunner::copyEncodedHostName(JSStringRef name)
+{
+ return JSStringCreateWithUTF8CString(0);
+}
+
+void TestRunner::addUserStyleSheet(JSStringRef source, bool allFrames)
+{
+}
+
+bool TestRunner::findString(JSContextRef, JSStringRef, JSObjectRef optionsArray)
+{
+ return false;
+}
+
+void TestRunner::execCommand(JSStringRef name, JSStringRef value)
+{
+}
+
+long long TestRunner::localStorageDiskUsageForOrigin(JSStringRef originIdentifier)
+{
+ return 0;
+}
+