diff options
Diffstat (limited to 'WebKitTools/DumpRenderTree')
17 files changed, 310 insertions, 40 deletions
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/LayoutTestController.cpp index c2393c3..f528b31 100644 --- a/WebKitTools/DumpRenderTree/LayoutTestController.cpp +++ b/WebKitTools/DumpRenderTree/LayoutTestController.cpp @@ -467,10 +467,8 @@ static JSValueRef notifyDoneCallback(JSContextRef context, JSObjectRef function, static bool parsePageParameters(JSContextRef context, int argumentCount, const JSValueRef* arguments, JSValueRef* exception, float& pageWidthInPixels, float& pageHeightInPixels) { - // FIXME: These values should sync with maxViewWidth/Height in - // DumpRenderTree.mm. Factor these values out to somewhere. - pageWidthInPixels = 800; - pageHeightInPixels = 600; + pageWidthInPixels = LayoutTestController::maxViewWidth; + pageHeightInPixels = LayoutTestController::maxViewHeight; switch (argumentCount) { case 2: pageWidthInPixels = static_cast<float>(JSValueToNumber(context, arguments[0], exception)); @@ -940,6 +938,18 @@ static JSValueRef setAllowUniversalAccessFromFileURLsCallback(JSContextRef conte return JSValueMakeUndefined(context); } +static JSValueRef setAllowFileAccessFromFileURLsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + // Has mac & windows implementation + if (argumentCount < 1) + return JSValueMakeUndefined(context); + + LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); + controller->setAllowFileAccessFromFileURLs(JSValueToBoolean(context, arguments[0])); + + return JSValueMakeUndefined(context); +} + static JSValueRef setTabKeyCyclesThroughElementsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { // Has mac & windows implementation @@ -1252,6 +1262,22 @@ static JSValueRef addUserStyleSheetCallback(JSContextRef context, JSObjectRef, J return JSValueMakeUndefined(context); } +static JSValueRef apiTestNewWindowDataLoadBaseURLCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + if (argumentCount != 2) + return JSValueMakeUndefined(context); + + JSRetainPtr<JSStringRef> utf8Data(Adopt, JSValueToStringCopy(context, arguments[0], exception)); + ASSERT(!*exception); + + JSRetainPtr<JSStringRef> baseURL(Adopt, JSValueToStringCopy(context, arguments[1], exception)); + ASSERT(!*exception); + + LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); + controller->apiTestNewWindowDataLoadBaseURL(utf8Data.get(), baseURL.get()); + return JSValueMakeUndefined(context); +} + // Static Values static JSValueRef getGlobalFlagCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) @@ -1328,6 +1354,7 @@ JSStaticFunction* LayoutTestController::staticFunctions() { "addDisallowedURL", addDisallowedURLCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "addUserScript", addUserScriptCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "addUserStyleSheet", addUserStyleSheetCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "apiTestNewWindowDataLoadBaseURL", apiTestNewWindowDataLoadBaseURLCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "clearAllDatabases", clearAllDatabasesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "clearBackForwardList", clearBackForwardListCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "clearPersistentUserStyleSheet", clearPersistentUserStyleSheetCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -1380,6 +1407,7 @@ JSStaticFunction* LayoutTestController::staticFunctions() { "repaintSweepHorizontally", repaintSweepHorizontallyCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setAcceptsEditing", setAcceptsEditingCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setAllowUniversalAccessFromFileURLs", setAllowUniversalAccessFromFileURLsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "setAllowFileAccessFromFileURLs", setAllowFileAccessFromFileURLsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setAlwaysAcceptCookies", setAlwaysAcceptCookiesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setAppCacheMaximumSize", setAppCacheMaximumSizeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setAuthenticationPassword", setAuthenticationPasswordCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -1492,3 +1520,6 @@ void LayoutTestController::setPOSIXLocale(JSStringRef locale) JSStringGetUTF8CString(locale, localeBuf, sizeof(localeBuf)); setlocale(LC_ALL, localeBuf); } + +const unsigned LayoutTestController::maxViewWidth = 800; +const unsigned LayoutTestController::maxViewHeight = 600; diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.h b/WebKitTools/DumpRenderTree/LayoutTestController.h index 5f9df50..3add32a 100644 --- a/WebKitTools/DumpRenderTree/LayoutTestController.h +++ b/WebKitTools/DumpRenderTree/LayoutTestController.h @@ -69,6 +69,7 @@ public: void removeAllVisitedLinks(); void setAcceptsEditing(bool acceptsEditing); void setAllowUniversalAccessFromFileURLs(bool); + void setAllowFileAccessFromFileURLs(bool); void setAppCacheMaximumSize(unsigned long long quota); void setAuthorAndUserStylesEnabled(bool); void setCacheModel(int); @@ -232,6 +233,13 @@ public: void evaluateScriptInIsolatedWorld(unsigned worldId, JSObjectRef globalObject, JSStringRef script); void setPOSIXLocale(JSStringRef locale); + + // The following API test functions should probably be moved to platform-specific + // unit tests outside of DRT once they exist. + void apiTestNewWindowDataLoadBaseURL(JSStringRef utf8Data, JSStringRef baseURL); + + static const unsigned maxViewWidth; + static const unsigned maxViewHeight; private: bool m_dumpAsPDF; diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp index e69da73..8e278f5 100644 --- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp +++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp @@ -176,6 +176,11 @@ enum { ID_TEST_RELOAD_PLUGINS_AND_PAGES, ID_TEST_GET_BROWSER_PROPERTY, ID_TEST_SET_BROWSER_PROPERTY, + ID_REMEMBER, + ID_GET_REMEMBERED_OBJECT, + ID_GET_AND_FORGET_REMEMBERED_OBJECT, + ID_REF_COUNT, + ID_SET_STATUS, NUM_METHOD_IDENTIFIERS }; @@ -205,7 +210,12 @@ static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = { "reloadPluginsNoPages", "reloadPluginsAndPages", "testGetBrowserProperty", - "testSetBrowserProperty" + "testSetBrowserProperty", + "remember", + "getRememberedObject", + "getAndForgetRememberedObject", + "refCount", + "setStatus" }; static NPUTF8* createCStringFromNPVariant(const NPVariant* variant) @@ -747,6 +757,22 @@ bool testWindowOpen(NPP npp) return false; } +static bool testSetStatus(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result) +{ + char* message = 0; + if (argCount && NPVARIANT_IS_STRING(args[0])) { + NPString statusString = NPVARIANT_TO_STRING(args[0]); + message = toCString(statusString); + } + + browser->status(obj->npp, message); + + free(message); + return true; +} + +static NPObject* rememberedObject; + static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* result) { PluginObject* plugin = reinterpret_cast<PluginObject*>(header); @@ -807,7 +833,29 @@ static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* a } else if (name == pluginMethodIdentifiers[ID_TEST_SET_BROWSER_PROPERTY]) { browser->setproperty(plugin->npp, NPVARIANT_TO_OBJECT(args[0]), stringVariantToIdentifier(args[1]), &args[2]); return true; - } + } else if (name == pluginMethodIdentifiers[ID_REMEMBER]) { + if (rememberedObject) + browser->releaseobject(rememberedObject); + rememberedObject = NPVARIANT_TO_OBJECT(args[0]); + browser->retainobject(rememberedObject); + VOID_TO_NPVARIANT(*result); + return true; + } else if (name == pluginMethodIdentifiers[ID_GET_REMEMBERED_OBJECT]) { + assert(rememberedObject); + browser->retainobject(rememberedObject); + OBJECT_TO_NPVARIANT(rememberedObject, *result); + return true; + } else if (name == pluginMethodIdentifiers[ID_GET_AND_FORGET_REMEMBERED_OBJECT]) { + assert(rememberedObject); + OBJECT_TO_NPVARIANT(rememberedObject, *result); + rememberedObject = 0; + return true; + } else if (name == pluginMethodIdentifiers[ID_REF_COUNT]) { + uint32_t refCount = NPVARIANT_TO_OBJECT(args[0])->referenceCount; + INT32_TO_NPVARIANT(refCount, *result); + return true; + } else if (name == pluginMethodIdentifiers[ID_SET_STATUS]) + return testSetStatus(plugin, args, argCount, result); return false; } diff --git a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp index 39430cf..a2fc79b 100644 --- a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp +++ b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp @@ -94,8 +94,6 @@ GSList* webViewList = 0; // current b/f item at the end of the previous test static WebKitWebHistoryItem* prevTestBFItem = NULL; -const unsigned maxViewHeight = 600; -const unsigned maxViewWidth = 800; const unsigned historyItemIndent = 8; static gchar* autocorrectURL(const gchar* url) @@ -335,6 +333,8 @@ static void resetDefaultsToConsistentValues() "minimum-font-size", 1, "enable-caret-browsing", FALSE, "enable-page-cache", FALSE, + "auto-resize-window", TRUE, + "enable-java-applet", FALSE, NULL); webkit_web_frame_clear_main_frame_name(mainFrame); @@ -477,8 +477,8 @@ static void runTest(const string& testPathOrURL) bool isSVGW3CTest = (gLayoutTestController->testPathOrURL().find("svg/W3C-SVG-1.1") != string::npos); GtkAllocation size; size.x = size.y = 0; - size.width = isSVGW3CTest ? 480 : maxViewWidth; - size.height = isSVGW3CTest ? 360 : maxViewHeight; + size.width = isSVGW3CTest ? 480 : LayoutTestController::maxViewWidth; + size.height = isSVGW3CTest ? 360 : LayoutTestController::maxViewHeight; gtk_window_resize(GTK_WINDOW(window), size.width, size.height); gtk_widget_size_allocate(container, &size); diff --git a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp index 422e2c2..668b852 100644 --- a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp +++ b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp @@ -348,6 +348,15 @@ void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool flag) g_object_set(G_OBJECT(settings), "enable-universal-access-from-file-uris", flag, NULL); } +void LayoutTestController::setAllowFileAccessFromFileURLs(bool flag) +{ + WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); + ASSERT(view); + + WebKitWebSettings* settings = webkit_web_view_get_settings(view); + g_object_set(G_OBJECT(settings), "enable-file-access-from-file-uris", flag, NULL); +} + void LayoutTestController::setAuthorAndUserStylesEnabled(bool flag) { // FIXME: implement @@ -586,3 +595,8 @@ void LayoutTestController::removeAllVisitedLinks() { // FIXME: Implement this. } + +void LayoutTestController::apiTestNewWindowDataLoadBaseURL(JSStringRef utf8Data, JSStringRef baseURL) +{ + +} diff --git a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm index 7a4429b..c7ddf21 100644 --- a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm +++ b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm @@ -134,9 +134,6 @@ static RetainPtr<CFStringRef> persistentUserStyleSheetLocation; static WebHistoryItem *prevTestBFItem = nil; // current b/f item at the end of the previous test -const unsigned maxViewHeight = 600; -const unsigned maxViewWidth = 800; - #if __OBJC2__ static void swizzleAllMethods(Class imposter, Class original) { @@ -279,7 +276,7 @@ static void activateFonts() WebView *createWebViewAndOffscreenWindow() { - NSRect rect = NSMakeRect(0, 0, maxViewWidth, maxViewHeight); + NSRect rect = NSMakeRect(0, 0, LayoutTestController::maxViewWidth, LayoutTestController::maxViewHeight); WebView *webView = [[WebView alloc] initWithFrame:rect frameName:nil groupName:@"org.webkit.DumpRenderTree"]; [webView setUIDelegate:uiDelegate]; @@ -396,6 +393,7 @@ static void resetDefaultsToConsistentValues() WebPreferences *preferences = [WebPreferences standardPreferences]; [preferences setAllowUniversalAccessFromFileURLs:YES]; + [preferences setAllowFileAccessFromFileURLs:YES]; [preferences setStandardFontFamily:@"Times"]; [preferences setFixedFontFamily:@"Courier"]; [preferences setSerifFontFamily:@"Times"]; @@ -1020,7 +1018,7 @@ static void sizeWebViewForCurrentTest() if (isSVGW3CTest) [[mainFrame webView] setFrameSize:NSMakeSize(480, 360)]; else - [[mainFrame webView] setFrameSize:NSMakeSize(maxViewWidth, maxViewHeight)]; + [[mainFrame webView] setFrameSize:NSMakeSize(LayoutTestController::maxViewWidth, LayoutTestController::maxViewHeight)]; } static const char *methodNameStringForFailedTest() diff --git a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm index b726e72..66ba5f0 100644 --- a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm +++ b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm @@ -334,6 +334,11 @@ void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool enabled) [[[mainFrame webView] preferences] setAllowUniversalAccessFromFileURLs:enabled]; } +void LayoutTestController::setAllowFileAccessFromFileURLs(bool enabled) +{ + [[[mainFrame webView] preferences] setAllowFileAccessFromFileURLs:enabled]; +} + void LayoutTestController::setPopupBlockingEnabled(bool popupBlockingEnabled) { [[[mainFrame webView] preferences] setJavaScriptCanOpenWindowsAutomatically:!popupBlockingEnabled]; @@ -617,3 +622,67 @@ void LayoutTestController::evaluateScriptInIsolatedWorld(unsigned worldID, JSObj [mainFrame _stringByEvaluatingJavaScriptFromString:scriptNS withGlobalObject:globalObject inScriptWorld:world]; } + +@interface APITestDelegate : NSObject +{ + bool* m_condition; +} +@end + +@implementation APITestDelegate + +- (id)initWithCompletionCondition:(bool*)condition +{ + [super init]; + ASSERT(condition); + m_condition = condition; + *m_condition = false; + return self; +} + +- (void)webView:(WebView *)sender didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame +{ + printf("API Test load failed\n"); + *m_condition = true; +} + +- (void)webView:(WebView *)sender didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame +{ + printf("API Test load failed provisional\n"); + *m_condition = true; +} + +- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame +{ + printf("API Test load succeeded\n"); + *m_condition = true; +} + +@end + +void LayoutTestController::apiTestNewWindowDataLoadBaseURL(JSStringRef utf8Data, JSStringRef baseURL) +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + + RetainPtr<CFStringRef> utf8DataCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, utf8Data)); + RetainPtr<CFStringRef> baseURLCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, baseURL)); + + WebView *webView = [[WebView alloc] initWithFrame:NSZeroRect frameName:@"" groupName:@""]; + + bool done = false; + APITestDelegate *delegate = [[APITestDelegate alloc] initWithCompletionCondition:&done]; + [webView setFrameLoadDelegate:delegate]; + + [[webView mainFrame] loadData:[(NSString *)utf8DataCF.get() dataUsingEncoding:NSUTF8StringEncoding] MIMEType:@"text/html" textEncodingName:@"utf-8" baseURL:[NSURL URLWithString:(NSString *)baseURLCF.get()]]; + + while (!done) { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantPast]]; + [pool release]; + } + + [webView close]; + [webView release]; + [delegate release]; + [pool release]; +} diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp index c16a786..43f1318 100644 --- a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp +++ b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp @@ -135,7 +135,6 @@ WebPage::WebPage(QObject* parent, DumpRenderTree* drt) globalSettings->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, true); globalSettings->setAttribute(QWebSettings::JavascriptEnabled, true); globalSettings->setAttribute(QWebSettings::PrivateBrowsingEnabled, false); - globalSettings->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, false); connect(this, SIGNAL(geometryChangeRequested(const QRect &)), this, SLOT(setViewGeometry(const QRect & ))); @@ -324,6 +323,7 @@ DumpRenderTree::DumpRenderTree() m_mainView->resize(QSize(maxViewWidth, maxViewHeight)); m_page = new WebPage(m_mainView, this); m_mainView->setPage(m_page); + m_mainView->setContextMenuPolicy(Qt::NoContextMenu); // create our controllers. This has to be done before connectFrame, // as it exports there to the JavaScript DOM window. @@ -412,10 +412,23 @@ void DumpRenderTree::resetToConsistentStateBeforeTesting() setlocale(LC_ALL, ""); } +static bool isWebInspectorTest(const QUrl& url) +{ + if (url.path().contains("inspector/")) + return true; + return false; +} + void DumpRenderTree::open(const QUrl& url) { resetToConsistentStateBeforeTesting(); + if (isWebInspectorTest(m_page->mainFrame()->url())) + layoutTestController()->closeWebInspector(); + + if (isWebInspectorTest(url)) + layoutTestController()->showWebInspector(); + // W3C SVG tests expect to be 480x360 bool isW3CTest = url.toString().contains("svg/W3C-SVG-1.1"); int width = isW3CTest ? 480 : maxViewWidth; diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h index 00d7ae4..8d80f87 100644 --- a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h +++ b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h @@ -158,6 +158,7 @@ public: WebPage(QObject* parent, DumpRenderTree*); virtual ~WebPage(); QWebInspector* webInspector(); + void closeWebInspector(); QWebPage *createWindow(QWebPage::WebWindowType); diff --git a/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp b/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp index 73a9934..1ef2d3f 100644 --- a/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp +++ b/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp @@ -274,6 +274,8 @@ void EventSender::contextClick() QApplication::sendEvent(m_page, &event); QMouseEvent event2(QEvent::MouseButtonRelease, m_mousePos, Qt::RightButton, Qt::RightButton, Qt::NoModifier); QApplication::sendEvent(m_page, &event2); + QContextMenuEvent event3(QContextMenuEvent::Mouse, m_mousePos); + QApplication::sendEvent(m_page->view(), &event3); } void EventSender::scheduleAsynchronousClick() @@ -397,18 +399,28 @@ void EventSender::sendTouchEvent(QEvent::Type type) void EventSender::zoomPageIn() { - QWebFrame* frame = m_page->mainFrame(); - if (frame) + if (QWebFrame* frame = m_page->mainFrame()) frame->setZoomFactor(frame->zoomFactor() * ZOOM_STEP); } void EventSender::zoomPageOut() { - QWebFrame* frame = m_page->mainFrame(); - if (frame) + if (QWebFrame* frame = m_page->mainFrame()) frame->setZoomFactor(frame->zoomFactor() / ZOOM_STEP); } +void EventSender::textZoomIn() +{ + if (QWebFrame* frame = m_page->mainFrame()) + frame->setTextSizeMultiplier(frame->textSizeMultiplier() * ZOOM_STEP); +} + +void EventSender::textZoomOut() +{ + if (QWebFrame* frame = m_page->mainFrame()) + frame->setTextSizeMultiplier(frame->textSizeMultiplier() / ZOOM_STEP); +} + QWebFrame* EventSender::frameUnderMouse() const { QWebFrame* frame = m_page->mainFrame(); diff --git a/WebKitTools/DumpRenderTree/qt/EventSenderQt.h b/WebKitTools/DumpRenderTree/qt/EventSenderQt.h index f6cfc7c..38bca89 100644 --- a/WebKitTools/DumpRenderTree/qt/EventSenderQt.h +++ b/WebKitTools/DumpRenderTree/qt/EventSenderQt.h @@ -68,6 +68,8 @@ public slots: void touchEnd(); void zoomPageIn(); void zoomPageOut(); + void textZoomIn(); + void textZoomOut(); void clearTouchPoints(); void releaseTouchPoint(int index); diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp index 51c1181..a26bc3d 100644 --- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp +++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp @@ -41,6 +41,7 @@ extern void qt_dump_frame_loader(bool b); extern void qt_dump_resource_load_callbacks(bool b); extern void qt_drt_setFrameSetFlatteningEnabled(QWebPage*, bool); extern void qt_drt_setJavaScriptProfilingEnabled(QWebFrame*, bool enabled); +extern void qt_drt_setTimelineProfilingEnabled(QWebPage*, bool enabled); extern bool qt_drt_pauseAnimation(QWebFrame*, const QString& name, double time, const QString& elementId); extern bool qt_drt_pauseTransitionOfProperty(QWebFrame*, const QString& name, double time, const QString& elementId); extern bool qt_drt_pauseSVGAnimation(QWebFrame*, const QString& animationId, double time, const QString& elementId); @@ -51,6 +52,10 @@ extern void qt_drt_whiteListAccessFromOrigin(const QString& sourceOrigin, const extern QString qt_drt_counterValueForElementById(QWebFrame* qFrame, const QString& id); extern int qt_drt_workerThreadCount(); extern int qt_drt_pageNumberForElementById(QWebFrame* qFrame, const QString& id, float width, float height); +extern int qt_drt_numberOfPages(QWebFrame* qFrame, float width, float height); +extern void qt_drt_webinspector_executeScript(QWebPage* page, long callId, const QString& script); +extern void qt_drt_webinspector_show(QWebPage *page); +extern void qt_drt_webinspector_close(QWebPage *page); LayoutTestController::LayoutTestController(WebCore::DumpRenderTree* drt) : QObject() @@ -285,15 +290,22 @@ QString LayoutTestController::decodeHostName(const QString& host) return decoded; } + +void LayoutTestController::closeWebInspector() +{ + qt_drt_webinspector_close(m_drt->webPage()); + m_drt->webPage()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, false); +} + void LayoutTestController::showWebInspector() { m_drt->webPage()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); - m_drt->webPage()->webInspector()->show(); + qt_drt_webinspector_show(m_drt->webPage()); } -void LayoutTestController::hideWebInspector() +void LayoutTestController::evaluateInWebInspector(long callId, const QString& script) { - m_drt->webPage()->webInspector()->hide(); + qt_drt_webinspector_executeScript(m_drt->webPage(), callId, script); } void LayoutTestController::setFrameSetFlatteningEnabled(bool enabled) @@ -306,12 +318,22 @@ void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool enabled) m_drt->webPage()->settings()->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, enabled); } +void LayoutTestController::setAllowFileAccessFromFileURLs(bool enabled) +{ + m_drt->webPage()->settings()->setAttribute(QWebSettings::LocalContentCanAccessFileUrls, enabled); +} + void LayoutTestController::setJavaScriptProfilingEnabled(bool enable) { m_topLoadingFrame->page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); qt_drt_setJavaScriptProfilingEnabled(m_topLoadingFrame, enable); } +void LayoutTestController::setTimelineProfilingEnabled(bool enable) +{ + qt_drt_setTimelineProfilingEnabled(m_drt->webPage(), enable); +} + void LayoutTestController::setFixedContentsSize(int width, int height) { m_topLoadingFrame->page()->setPreferredContentsSize(QSize(width, height)); @@ -473,3 +495,8 @@ int LayoutTestController::pageNumberForElementById(const QString& id, float widt return qt_drt_pageNumberForElementById(m_drt->webPage()->mainFrame(), id, width, height); } + +int LayoutTestController::numberOfPages(float width, float height) +{ + return qt_drt_numberOfPages(m_drt->webPage()->mainFrame(), width, height); +} diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h index 64cbcc9..d73794e 100644 --- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h +++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h @@ -115,11 +115,14 @@ public slots: QString decodeHostName(const QString& host); void dumpSelectionRect() const {} void showWebInspector(); - void hideWebInspector(); + void closeWebInspector(); + void evaluateInWebInspector(long callId, const QString& script); void setFrameSetFlatteningEnabled(bool enable); void setAllowUniversalAccessFromFileURLs(bool enable); + void setAllowFileAccessFromFileURLs(bool enable); void setJavaScriptProfilingEnabled(bool enable); + void setTimelineProfilingEnabled(bool enable); void setFixedContentsSize(int width, int height); void setPrivateBrowsingEnabled(bool enable); void setPopupBlockingEnabled(bool enable); @@ -150,6 +153,7 @@ public slots: void setDomainRelaxationForbiddenForURLScheme(bool forbidden, const QString& scheme); int workerThreadCount(); int pageNumberForElementById(const QString& id, float width = 0, float height = 0); + int numberOfPages(float width, float height); private slots: void processWork(); diff --git a/WebKitTools/DumpRenderTree/qt/main.cpp b/WebKitTools/DumpRenderTree/qt/main.cpp index efcda57..7d72982 100644 --- a/WebKitTools/DumpRenderTree/qt/main.cpp +++ b/WebKitTools/DumpRenderTree/qt/main.cpp @@ -37,9 +37,7 @@ #include <qdir.h> #include <qdebug.h> #include <qfont.h> -#include <qwebsettings.h> #include <qwebdatabase.h> -#include <qdesktopservices.h> #include <qtimer.h> #include <qwindowsstyle.h> @@ -161,8 +159,6 @@ int main(int argc, char* argv[]) if (args.contains(QLatin1String("--pixel-tests"))) dumper.setDumpPixels(true); - QString dbDir = QDesktopServices::storageLocation(QDesktopServices::DataLocation) + QDir::separator() + "qtwebkitdrt"; - QWebSettings::setOfflineStoragePath(dbDir); QWebDatabase::removeAllDatabases(); if (args.contains(QLatin1String("-"))) { diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp index 261b9e6..ddfca95 100644 --- a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp +++ b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp @@ -107,9 +107,6 @@ LayoutTestController* gLayoutTestController = 0; UINT_PTR waitToDumpWatchdog = 0; -const unsigned maxViewWidth = 800; -const unsigned maxViewHeight = 600; - void setPersistentUserStyleSheetLocation(CFStringRef url) { persistentUserStyleSheetLocation = url; @@ -667,8 +664,8 @@ void dump() width = 480; height = 360; } else { - width = maxViewWidth; - height = maxViewHeight; + width = LayoutTestController::maxViewWidth; + height = LayoutTestController::maxViewHeight; } ::SetWindowPos(webViewWindow, 0, 0, 0, width, height, SWP_NOMOVE); @@ -787,6 +784,7 @@ static void resetDefaultsToConsistentValues(IWebPreferences* preferences) COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences); if (prefsPrivate) { prefsPrivate->setAllowUniversalAccessFromFileURLs(TRUE); + prefsPrivate->setAllowFileAccessFromFileURLs(TRUE); prefsPrivate->setAuthorAndUserStylesEnabled(TRUE); prefsPrivate->setDeveloperExtrasEnabled(FALSE); prefsPrivate->setExperimentalNotificationsEnabled(TRUE); @@ -1097,6 +1095,8 @@ WindowToWebViewMap& windowToWebViewMap() IWebView* createWebViewAndOffscreenWindow(HWND* webViewWindow) { + unsigned maxViewWidth = LayoutTestController::maxViewWidth; + unsigned maxViewHeight = LayoutTestController::maxViewHeight; HWND hostWindow = CreateWindowEx(WS_EX_TOOLWINDOW, kDumpRenderTreeClassName, TEXT("DumpRenderTree"), WS_POPUP, -maxViewWidth, -maxViewHeight, maxViewWidth, maxViewHeight, 0, 0, GetModuleHandle(0), 0); diff --git a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp index 34fd2e6..9f84488 100644 --- a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp +++ b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp @@ -406,6 +406,23 @@ void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool enabled) prefsPrivate->setAllowUniversalAccessFromFileURLs(enabled); } +void LayoutTestController::setAllowFileAccessFromFileURLs(bool enabled) +{ + COMPtr<IWebView> webView; + if (FAILED(frame->webView(&webView))) + return; + + COMPtr<IWebPreferences> preferences; + if (FAILED(webView->preferences(&preferences))) + return; + + COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences); + if (!prefsPrivate) + return; + + prefsPrivate->setAllowFileAccessFromFileURLs(enabled); +} + void LayoutTestController::setPopupBlockingEnabled(bool enabled) { COMPtr<IWebView> webView; @@ -1121,14 +1138,34 @@ JSRetainPtr<JSStringRef> LayoutTestController::counterValueForElementById(JSStri return counterValueJS; } -int LayoutTestController::pageNumberForElementById(JSStringRef, float, float) +int LayoutTestController::pageNumberForElementById(JSStringRef id, float pageWidthInPixels, float pageHeightInPixels) { - // FIXME: implement - return -1; + COMPtr<IWebFramePrivate> framePrivate(Query, frame); + if (!framePrivate) + return 0; + + wstring idWstring = jsStringRefToWString(id); + BSTR idBSTR = SysAllocStringLen((OLECHAR*)idWstring.c_str(), idWstring.length()); + int pageNumber = -1; + if (FAILED(framePrivate->pageNumberForElementById(idBSTR, pageWidthInPixels, pageHeightInPixels, &pageNumber))) + pageNumber = -1; + SysFreeString(idBSTR); + return pageNumber; } -int LayoutTestController::numberOfPages(float, float) +int LayoutTestController::numberOfPages(float pageWidthInPixels, float pageHeightInPixels) { - // FIXME: implement - return -1; + COMPtr<IWebFramePrivate> framePrivate(Query, frame); + if (!framePrivate) + return 0; + + int pageNumber = -1; + if (FAILED(framePrivate->numberOfPages(pageWidthInPixels, pageHeightInPixels, &pageNumber))) + pageNumber = -1; + return pageNumber; +} + +void LayoutTestController::apiTestNewWindowDataLoadBaseURL(JSStringRef utf8Data, JSStringRef baseURL) +{ + } diff --git a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp index 3bc84cd..ce1bda5 100644 --- a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp +++ b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp @@ -180,6 +180,11 @@ void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool enabled) // FIXME: implement } +void LayoutTestController::setAllowFileAccessFromFileURLs(bool enabled) +{ + // FIXME: implement +} + void LayoutTestController::setAuthorAndUserStylesEnabled(bool flag) { // FIXME: implement @@ -375,4 +380,9 @@ int LayoutTestController::numberOfPages(float, float) { // FIXME: implement return -1; -}
\ No newline at end of file +} + +void LayoutTestController::apiTestNewWindowDataLoadBaseURL(JSStringRef utf8Data, JSStringRef baseURL) +{ + +} |