Changeset 145708 in webkit
- Timestamp:
- Mar 13, 2013, 5:48:47 AM (12 years ago)
- Location:
- trunk/Tools
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r145679 r145708 1 2013-03-12 Simon Hausmann <simon.hausmann@digia.com> 2 3 [Qt] Prepare DRT for transition to shared TestRunner interface 4 https://bugs.webkit.org/show_bug.cgi?id=112144 5 6 Reviewed by Benjamin Poulain. 7 8 Prepare Qt's DRT for a transition from the QObject based TestRunner to 9 the JSC C API based one. 10 11 This is impplemented by instantiating the QObject based testRunner in 12 the global object, then instantiating the JSC C based TestRunner 13 separately and placing it "behind" the QObject based testRunner through 14 injection of the individual functions through proxies. (prototype 15 chaining doesn't work due to the this object and Function.prototype.bind 16 doesn't work due to the native function) 17 18 This allows for porting over method by method by removing the method 19 from the QObject TestRunnerQt and implementing it in the JSC C based 20 TestRunner. 21 22 In order for this to link and run dummy implementations of all the 23 necessary TestRunner functions are provided. 24 25 * DumpRenderTree/qt/DumpRenderTree.pro: 26 * DumpRenderTree/qt/DumpRenderTreeMain.cpp: 27 * DumpRenderTree/qt/DumpRenderTreeQt.cpp: 28 (WebCore::DumpRenderTree::resetToConsistentStateBeforeTesting): 29 (WebCore::DumpRenderTree::initJSObjects): 30 * DumpRenderTree/qt/DumpRenderTreeQt.h: 31 (DumpRenderTree): 32 * DumpRenderTree/qt/TestRunnerQt.cpp: 33 (TestRunner::~TestRunner): 34 (TestRunner::addDisallowedURL): 35 (TestRunner::queueLoad): 36 (TestRunner::removeAllVisitedLinks): 37 (TestRunner::setAcceptsEditing): 38 (TestRunner::simulateLegacyWebNotificationClick): 39 (TestRunner::setWindowIsKey): 40 (TestRunner::setAlwaysAcceptCookies): 41 (TestRunner::addOriginAccessWhitelistEntry): 42 (TestRunner::setWebViewEditable): 43 (TestRunner::clearAllApplicationCaches): 44 (TestRunner::setTextDirection): 45 (TestRunner::notifyDone): 46 (TestRunner::numberOfPendingGeolocationPermissionRequests): 47 (TestRunner::overridePreference): 48 (TestRunner::pathToLocalResource): 49 (TestRunner::removeAllWebNotificationPermissions): 50 (TestRunner::simulateWebNotificationClick): 51 (TestRunner::closeIdleLocalStorageDatabases): 52 (TestRunner::focusWebView): 53 (TestRunner::setBackingScaleFactor): 54 (TestRunner::removeChromeInputField): 55 (TestRunner::addChromeInputField): 56 (TestRunner::originsWithLocalStorage): 57 (TestRunner::deleteAllLocalStorage): 58 (TestRunner::deleteLocalStorageForOrigin): 59 (TestRunner::observeStorageTrackerNotifications): 60 (TestRunner::syncLocalStorage): 61 (TestRunner::windowCount): 62 (TestRunner::setWaitToDump): 63 (TestRunner::waitForPolicyDelegate): 64 (TestRunner::webHistoryItemCount): 65 (TestRunner::showWebInspector): 66 (TestRunner::closeWebInspector): 67 (TestRunner::evaluateInWebInspector): 68 (TestRunner::setSerializeHTTPLoads): 69 (TestRunner::apiTestNewWindowDataLoadBaseURL): 70 (TestRunner::setCustomPolicyDelegate): 71 (TestRunner::setDatabaseQuota): 72 (TestRunner::setDomainRelaxationForbiddenForURLScheme): 73 (TestRunner::resetPageVisibility): 74 (TestRunner::keepWebHistory): 75 (TestRunner::goBack): 76 (TestRunner::originsWithApplicationCache): 77 (TestRunner::applicationCacheDiskUsageForOrigin): 78 (TestRunner::display): 79 (TestRunner::dispatchPendingLoadRequests): 80 (TestRunner::clearPersistentUserStyleSheet): 81 (TestRunner::callShouldCloseOnWebView): 82 (TestRunner::copyDecodedHostName): 83 (TestRunner::clearBackForwardList): 84 (TestRunner::clearAllDatabases): 85 (TestRunner::clearApplicationCacheForOrigin): 86 (TestRunner::apiTestGoToCurrentBackForwardItem): 87 (TestRunner::authenticateSession): 88 (TestRunner::abortModal): 89 (TestRunner::setStorageDatabaseIdleInterval): 90 (TestRunner::setAsynchronousSpellCheckingEnabled): 91 (TestRunner::setXSSAuditorEnabled): 92 (TestRunner::setSpatialNavigationEnabled): 93 (TestRunner::setScrollbarPolicy): 94 (TestRunner::setJavaScriptCanAccessClipboard): 95 (TestRunner::setAutomaticLinkDetectionEnabled): 96 (TestRunner::setUserStyleSheetEnabled): 97 (TestRunner::setUserStyleSheetLocation): 98 (TestRunner::setUseDashboardCompatibilityMode): 99 (TestRunner::setTabKeyCyclesThroughElements): 100 (TestRunner::setSmartInsertDeleteEnabled): 101 (TestRunner::setSelectTrailingWhitespaceEnabled): 102 (TestRunner::setPrivateBrowsingEnabled): 103 (TestRunner::setPluginsEnabled): 104 (TestRunner::setPopupBlockingEnabled): 105 (TestRunner::setMockSpeechInputDumpRect): 106 (TestRunner::setPersistentUserStyleSheetLocation): 107 (TestRunner::setMockGeolocationPosition): 108 (TestRunner::setMockGeolocationPositionUnavailableError): 109 (TestRunner::setMockDeviceOrientation): 110 (TestRunner::setMainFrameIsFirstResponder): 111 (TestRunner::setIconDatabaseEnabled): 112 (TestRunner::setGeolocationPermission): 113 (TestRunner::setDefersLoading): 114 (TestRunner::setCacheModel): 115 (TestRunner::setAuthorAndUserStylesEnabled): 116 (TestRunner::setAllowFileAccessFromFileURLs): 117 (TestRunner::setAppCacheMaximumSize): 118 (TestRunner::setAllowUniversalAccessFromFileURLs): 119 (TestRunner::setApplicationCacheOriginQuota): 120 (TestRunner::denyWebNotificationPermission): 121 (TestRunner::grantWebNotificationPermission): 122 (TestRunner::setValueForUser): 123 (TestRunner::setViewModeMediaFeature): 124 (TestRunner::setPageVisibility): 125 (TestRunner::addMockSpeechInputResult): 126 (TestRunner::removeOriginAccessWhitelistEntry): 127 (TestRunner::addUserScript): 128 (TestRunner::isCommandEnabled): 129 (TestRunner::evaluateScriptInIsolatedWorld): 130 (TestRunner::evaluateScriptInIsolatedWorldAndReturnValue): 131 (TestRunner::copyEncodedHostName): 132 (TestRunner::addUserStyleSheet): 133 (TestRunner::findString): 134 (TestRunner::execCommand): 135 (TestRunner::localStorageDiskUsageForOrigin): 136 1 137 2013-03-12 Julie Parent <jparent@chromium.org> 2 138 -
trunk/Tools/DumpRenderTree/qt/DumpRenderTree.pro
r142972 r145708 28 28 $$PWD/../DumpRenderTree.h \ 29 29 $$PWD/../GCController.h \ 30 $$PWD/../TextRunner.h \ 30 31 DumpRenderTreeQt.h \ 31 32 EventSenderQt.h \ … … 39 40 $$PWD/../DumpRenderTreeCommon.cpp \ 40 41 $$PWD/../GCController.cpp \ 42 $$PWD/../TestRunner.cpp \ 41 43 DumpRenderTreeQt.cpp \ 42 44 EventSenderQt.cpp \ -
trunk/Tools/DumpRenderTree/qt/DumpRenderTreeMain.cpp
r135857 r145708 43 43 44 44 #include <wtf/AlwaysInline.h> 45 #include <wtf/ExportMacros.h>46 45 47 46 #ifdef Q_WS_X11 -
trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
r142972 r145708 39 39 #include "InitWebCoreQt.h" 40 40 #include "InitWebKitQt.h" 41 #include "JSStringRefQt.h" 41 42 #include "QtTestSupport.h" 43 #include "TestRunner.h" 42 44 #include "TestRunnerQt.h" 43 45 #include "TextInputControllerQt.h" … … 525 527 m_controller->reset(); 526 528 529 m_jscController = TestRunner::create(url.toString().toStdString(), m_expectedHash.toStdString()); 530 527 531 // reset mouse clicks counter 528 532 m_eventSender->resetClickCount(); … … 746 750 frame->addToJavaScriptWindowObject(QLatin1String("textInputController"), m_textInputController); 747 751 m_gcController->makeWindowObject(context, window, 0); 752 753 if (m_jscController) { 754 JSObjectRef dummyWindow = JSObjectMake(context, 0, 0); 755 m_jscController->makeWindowObject(context, dummyWindow, 0); 756 JSRetainPtr<JSStringRef> testRunnerName(Adopt, JSStringCreateWithUTF8CString("testRunner")); 757 JSValueRef wrappedTestRunner = JSObjectGetProperty(context, dummyWindow, testRunnerName.get(), 0); 758 JSRetainPtr<JSStringRef> helperScript(Adopt, JSStringCreateWithUTF8CString("(function() {\n" 759 " function bind(fun, thisArg) {\n" 760 " return function() {\n" 761 " return fun.apply(thisArg, Array.prototype.slice.call(arguments));\n" 762 " }\n" 763 " }\n" 764 "for (var prop in this.jscBasedTestRunner) {\n" 765 " var pd = Object.getOwnPropertyDescriptor(this.qtBasedTestRunner, prop);\n" 766 " if (pd !== undefined) continue;\n" 767 " pd = Object.getOwnPropertyDescriptor(this.jscBasedTestRunner, prop);\n" 768 " this.qtBasedTestRunner[prop] = bind(this.jscBasedTestRunner[prop], this.jscBasedTestRunner);\n" 769 "}\n" 770 "}).apply(this)\n")); 771 772 JSRetainPtr<JSStringRef> qtBasedTestRunnerName(Adopt, JSStringCreateWithUTF8CString("qtBasedTestRunner")); 773 JSRetainPtr<JSStringRef> jscBasedTestRunnerName(Adopt, JSStringCreateWithUTF8CString("jscBasedTestRunner")); 774 775 JSObjectRef args = JSObjectMake(context, 0, 0); 776 JSObjectSetProperty(context, args, qtBasedTestRunnerName.get(), JSObjectGetProperty(context, window, testRunnerName.get(), 0), 0, 0); 777 JSObjectSetProperty(context, args, jscBasedTestRunnerName.get(), wrappedTestRunner, 0, 0); 778 779 JSValueRef ex = 0; 780 JSEvaluateScript(context, helperScript.get(), args, 0, 0, &ex); 781 if (ex) { 782 JSRetainPtr<JSStringRef> msg(Adopt, JSValueToStringCopy(context, ex, 0)); 783 fprintf(stderr, "Error evaluating TestRunner setup-script: %s\n", qPrintable(JSStringCopyQString(msg.get()))); 784 } 785 } 748 786 749 787 DumpRenderTreeSupportQt::injectInternalsObject(frame->handle()); -
trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h
r142972 r145708 42 42 43 43 #include "DumpRenderTreeSupportQt.h" 44 #include "TestRunner.h" 44 45 #include <qgraphicsview.h> 45 46 #include <qgraphicswebview.h> … … 48 49 #include <qwebpage.h> 49 50 #include <qwebview.h> 51 #include <wtf/RefPtr.h> 50 52 51 53 QT_BEGIN_NAMESPACE … … 145 147 QString dumpFrameScrollPosition(QWebFrame* frame); 146 148 TestRunnerQt *m_controller; 149 RefPtr<TestRunner> m_jscController; 147 150 148 151 bool m_dumpPixelsForCurrentTest; -
trunk/Tools/DumpRenderTree/qt/TestRunnerQt.cpp
r145012 r145708 47 47 { 48 48 reset(); 49 } 50 51 TestRunner::~TestRunner() 52 { 49 53 } 50 54 … … 927 931 const unsigned TestRunnerQt::maxViewWidth = 800; 928 932 const unsigned TestRunnerQt::maxViewHeight = 600; 933 934 // --- JSC C API stubs 935 936 void TestRunner::addDisallowedURL(JSStringRef url) 937 { 938 } 939 940 void TestRunner::queueLoad(JSStringRef url, JSStringRef target) 941 { 942 } 943 944 void TestRunner::removeAllVisitedLinks() 945 { 946 } 947 948 void TestRunner::setAcceptsEditing(bool) 949 { 950 } 951 952 void TestRunner::simulateLegacyWebNotificationClick(JSStringRef title) 953 { 954 } 955 956 void TestRunner::setWindowIsKey(bool) 957 { 958 } 959 960 void TestRunner::setAlwaysAcceptCookies(bool) 961 { 962 } 963 964 void TestRunner::addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains) 965 { 966 } 967 968 void TestRunner::setWebViewEditable(bool) 969 { 970 } 971 972 void TestRunner::clearAllApplicationCaches() 973 { 974 } 975 976 void TestRunner::setTextDirection(JSStringRef) 977 { 978 } 979 980 void TestRunner::notifyDone() 981 { 982 } 983 984 int TestRunner::numberOfPendingGeolocationPermissionRequests() 985 { 986 return 0; 987 } 988 989 void TestRunner::overridePreference(JSStringRef key, JSStringRef value) 990 { 991 } 992 993 JSStringRef TestRunner::pathToLocalResource(JSContextRef, JSStringRef url) 994 { 995 return JSStringCreateWithUTF8CString(0); // ### Take impl from WTR 996 } 997 998 void TestRunner::removeAllWebNotificationPermissions() 999 { 1000 } 1001 1002 void TestRunner::simulateWebNotificationClick(JSValueRef notification) 1003 { 1004 } 1005 1006 void TestRunner::closeIdleLocalStorageDatabases() 1007 { 1008 } 1009 1010 void TestRunner::focusWebView() 1011 { 1012 } 1013 1014 void TestRunner::setBackingScaleFactor(double) 1015 { 1016 } 1017 1018 void TestRunner::removeChromeInputField() 1019 { 1020 } 1021 1022 void TestRunner::addChromeInputField() 1023 { 1024 } 1025 1026 JSValueRef TestRunner::originsWithLocalStorage(JSContextRef context) 1027 { 1028 return JSValueMakeNull(context); 1029 } 1030 1031 void TestRunner::deleteAllLocalStorage() 1032 { 1033 } 1034 1035 void TestRunner::deleteLocalStorageForOrigin(JSStringRef originIdentifier) 1036 { 1037 } 1038 1039 void TestRunner::observeStorageTrackerNotifications(unsigned number) 1040 { 1041 } 1042 1043 void TestRunner::syncLocalStorage() 1044 { 1045 } 1046 1047 int TestRunner::windowCount() 1048 { 1049 return 0; 1050 } 1051 1052 void TestRunner::setWaitToDump(bool) 1053 { 1054 } 1055 1056 void TestRunner::waitForPolicyDelegate() 1057 { 1058 } 1059 1060 size_t TestRunner::webHistoryItemCount() 1061 { 1062 return 0; 1063 } 1064 1065 void TestRunner::showWebInspector() 1066 { 1067 } 1068 1069 void TestRunner::closeWebInspector() 1070 { 1071 } 1072 1073 void TestRunner::evaluateInWebInspector(long callId, JSStringRef script) 1074 { 1075 } 1076 1077 void TestRunner::setSerializeHTTPLoads(bool) 1078 { 1079 } 1080 1081 void TestRunner::apiTestNewWindowDataLoadBaseURL(JSStringRef utf8Data, JSStringRef baseURL) 1082 { 1083 } 1084 1085 void TestRunner::setCustomPolicyDelegate(bool setDelegate, bool permissive) 1086 { 1087 } 1088 1089 void TestRunner::setDatabaseQuota(unsigned long long quota) 1090 { 1091 } 1092 1093 void TestRunner::setDomainRelaxationForbiddenForURLScheme(bool forbidden, JSStringRef scheme) 1094 { 1095 } 1096 1097 void TestRunner::resetPageVisibility() 1098 { 1099 } 1100 1101 void TestRunner::keepWebHistory() 1102 { 1103 } 1104 1105 void TestRunner::goBack() 1106 { 1107 } 1108 1109 JSValueRef TestRunner::originsWithApplicationCache(JSContextRef context) 1110 { 1111 return JSValueMakeNull(context); 1112 } 1113 1114 long long TestRunner::applicationCacheDiskUsageForOrigin(JSStringRef name) 1115 { 1116 return 0; 1117 } 1118 1119 void TestRunner::display() 1120 { 1121 } 1122 1123 void TestRunner::dispatchPendingLoadRequests() 1124 { 1125 } 1126 1127 void TestRunner::clearPersistentUserStyleSheet() 1128 { 1129 } 1130 1131 bool TestRunner::callShouldCloseOnWebView() 1132 { 1133 return false; 1134 } 1135 1136 JSStringRef TestRunner::copyDecodedHostName(JSStringRef name) 1137 { 1138 return JSStringCreateWithUTF8CString(0); 1139 } 1140 1141 void TestRunner::clearBackForwardList() 1142 { 1143 } 1144 1145 void TestRunner::clearAllDatabases() 1146 { 1147 } 1148 1149 void TestRunner::clearApplicationCacheForOrigin(JSStringRef name) 1150 { 1151 } 1152 1153 void TestRunner::apiTestGoToCurrentBackForwardItem() 1154 { 1155 } 1156 1157 void TestRunner::authenticateSession(JSStringRef url, JSStringRef username, JSStringRef password) 1158 { 1159 } 1160 1161 void TestRunner::abortModal() 1162 { 1163 } 1164 1165 void TestRunner::setStorageDatabaseIdleInterval(double) 1166 { 1167 } 1168 1169 void TestRunner::setAsynchronousSpellCheckingEnabled(bool) 1170 { 1171 } 1172 1173 void TestRunner::setXSSAuditorEnabled(bool flag) 1174 { 1175 } 1176 1177 void TestRunner::setSpatialNavigationEnabled(bool) 1178 { 1179 } 1180 1181 void TestRunner::setScrollbarPolicy(JSStringRef orientation, JSStringRef policy) 1182 { 1183 } 1184 1185 void TestRunner::setJavaScriptCanAccessClipboard(bool flag) 1186 { 1187 } 1188 1189 void TestRunner::setAutomaticLinkDetectionEnabled(bool flag) 1190 { 1191 } 1192 1193 void TestRunner::setUserStyleSheetEnabled(bool flag) 1194 { 1195 } 1196 1197 void TestRunner::setUserStyleSheetLocation(JSStringRef path) 1198 { 1199 } 1200 1201 void TestRunner::setUseDashboardCompatibilityMode(bool flag) 1202 { 1203 } 1204 1205 void TestRunner::setTabKeyCyclesThroughElements(bool) 1206 { 1207 } 1208 1209 void TestRunner::setSmartInsertDeleteEnabled(bool) 1210 { 1211 } 1212 1213 void TestRunner::setSelectTrailingWhitespaceEnabled(bool) 1214 { 1215 } 1216 1217 void TestRunner::setPrivateBrowsingEnabled(bool) 1218 { 1219 } 1220 1221 void TestRunner::setPluginsEnabled(bool) 1222 { 1223 } 1224 1225 void TestRunner::setPopupBlockingEnabled(bool) 1226 { 1227 } 1228 1229 void TestRunner::setMockSpeechInputDumpRect(bool flag) 1230 { 1231 } 1232 1233 void TestRunner::setPersistentUserStyleSheetLocation(JSStringRef path) 1234 { 1235 } 1236 1237 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) 1238 { 1239 } 1240 1241 void TestRunner::setMockGeolocationPositionUnavailableError(JSStringRef message) 1242 { 1243 } 1244 1245 void TestRunner::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) 1246 { 1247 } 1248 1249 void TestRunner::setMainFrameIsFirstResponder(bool flag) 1250 { 1251 } 1252 1253 void TestRunner::setIconDatabaseEnabled(bool) 1254 { 1255 } 1256 1257 void TestRunner::setGeolocationPermission(bool allow) 1258 { 1259 } 1260 1261 void TestRunner::setDefersLoading(bool) 1262 { 1263 } 1264 1265 void TestRunner::setCacheModel(int) 1266 { 1267 } 1268 1269 void TestRunner::setAuthorAndUserStylesEnabled(bool) 1270 { 1271 } 1272 1273 void TestRunner::setAllowFileAccessFromFileURLs(bool) 1274 { 1275 } 1276 1277 void TestRunner::setAppCacheMaximumSize(unsigned long long quota) 1278 { 1279 } 1280 1281 void TestRunner::setAllowUniversalAccessFromFileURLs(bool) 1282 { 1283 } 1284 1285 void TestRunner::setApplicationCacheOriginQuota(unsigned long long) 1286 { 1287 } 1288 1289 void TestRunner::denyWebNotificationPermission(JSStringRef origin) 1290 { 1291 } 1292 1293 void TestRunner::grantWebNotificationPermission(JSStringRef origin) 1294 { 1295 } 1296 1297 void TestRunner::setValueForUser(JSContextRef, JSValueRef nodeObject, JSStringRef value) 1298 { 1299 } 1300 1301 void TestRunner::setViewModeMediaFeature(JSStringRef) 1302 { 1303 } 1304 1305 void TestRunner::setPageVisibility(const char *) 1306 { 1307 } 1308 1309 void TestRunner::addMockSpeechInputResult(JSStringRef result, double confidence, JSStringRef language) 1310 { 1311 } 1312 1313 void TestRunner::removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains) 1314 { 1315 } 1316 1317 void TestRunner::addUserScript(JSStringRef source, bool runAtStart, bool allFrames) 1318 { 1319 } 1320 1321 bool TestRunner::isCommandEnabled(JSStringRef name) 1322 { 1323 return false; 1324 } 1325 1326 void TestRunner::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script) 1327 { 1328 } 1329 1330 void TestRunner::evaluateScriptInIsolatedWorldAndReturnValue(unsigned worldID, JSObjectRef globalObject, JSStringRef script) 1331 { 1332 } 1333 1334 JSStringRef TestRunner::copyEncodedHostName(JSStringRef name) 1335 { 1336 return JSStringCreateWithUTF8CString(0); 1337 } 1338 1339 void TestRunner::addUserStyleSheet(JSStringRef source, bool allFrames) 1340 { 1341 } 1342 1343 bool TestRunner::findString(JSContextRef, JSStringRef, JSObjectRef optionsArray) 1344 { 1345 return false; 1346 } 1347 1348 void TestRunner::execCommand(JSStringRef name, JSStringRef value) 1349 { 1350 } 1351 1352 long long TestRunner::localStorageDiskUsageForOrigin(JSStringRef originIdentifier) 1353 { 1354 return 0; 1355 } 1356
Note:
See TracChangeset
for help on using the changeset viewer.