diff options
author | Steve Block <steveblock@google.com> | 2010-04-27 16:31:00 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-05-11 14:42:12 +0100 |
commit | dcc8cf2e65d1aa555cce12431a16547e66b469ee (patch) | |
tree | 92a8d65cd5383bca9749f5327fb5e440563926e6 /WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp | |
parent | ccac38a6b48843126402088a309597e682f40fe6 (diff) | |
download | external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.zip external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.gz external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.bz2 |
Merge webkit.org at r58033 : Initial merge by git
Change-Id: If006c38561af287c50cd578d251629b51e4d8cd1
Diffstat (limited to 'WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp')
-rw-r--r-- | WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp | 203 |
1 files changed, 163 insertions, 40 deletions
diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp index a26bc3d..b95fe23 100644 --- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp +++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp @@ -28,6 +28,7 @@ */ #include "config.h" #include "LayoutTestControllerQt.h" +#include "../../../WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h" #include "DumpRenderTreeQt.h" #include "WorkQueue.h" @@ -36,32 +37,23 @@ #include <QLocale> #include <qwebsettings.h> +extern void qt_wrt_setViewMode(QWebPage* page, const QString& mode); extern void qt_dump_editing_callbacks(bool b); 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); -extern int qt_drt_numberOfActiveAnimations(QWebFrame*); -extern void qt_drt_setDomainRelaxationForbiddenForURLScheme(bool forbidden, const QString& scheme); - -extern void qt_drt_whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains); -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); +extern void qt_set_will_send_request_returns_null_on_redirect(bool b); +extern void qt_set_will_send_request_returns_null(bool b); +extern void qt_set_will_send_request_clear_headers(const QStringList& headers); + +extern void qt_dump_notification(bool b); LayoutTestController::LayoutTestController(WebCore::DumpRenderTree* drt) : QObject() , m_drt(drt) { + qRegisterMetaType<QWebElement>("QWebElement"); reset(); + qt_dump_notification(true); } void LayoutTestController::reset() @@ -85,6 +77,9 @@ void LayoutTestController::reset() qt_dump_editing_callbacks(false); qt_dump_frame_loader(false); qt_dump_resource_load_callbacks(false); + qt_set_will_send_request_returns_null_on_redirect(false); + qt_set_will_send_request_returns_null(false); + qt_set_will_send_request_clear_headers(QStringList()); emit hidePage(); } @@ -136,12 +131,17 @@ void LayoutTestController::waitUntilDone() { //qDebug() << ">>>>waitForDone"; m_waitForDone = true; - m_timeoutTimer.start(15000, this); + m_timeoutTimer.start(30000, this); } QString LayoutTestController::counterValueForElementById(const QString& id) { - return qt_drt_counterValueForElementById(m_drt->webPage()->mainFrame(), id); + return DumpRenderTreeSupportQt::counterValueForElementById(m_drt->webPage()->mainFrame(), id); +} + +void LayoutTestController::setViewModeMediaFeature(const QString& mode) +{ + qt_wrt_setViewMode(m_drt->webPage(), mode); } int LayoutTestController::webHistoryItemCount() @@ -188,6 +188,17 @@ int LayoutTestController::windowCount() return m_drt->windowCount(); } +void LayoutTestController::grantDesktopNotificationPermission(const QString& origin) +{ + // FIXME: Implement for notification security +} + +bool LayoutTestController::checkDesktopNotificationPermission(const QString& origin) +{ + // FIXME: Implement for notification security + return true; +} + void LayoutTestController::display() { emit showPage(); @@ -220,6 +231,21 @@ void LayoutTestController::dumpResourceLoadCallbacks() qt_dump_resource_load_callbacks(true); } +void LayoutTestController::setWillSendRequestReturnsNullOnRedirect(bool enabled) +{ + qt_set_will_send_request_returns_null_on_redirect(enabled); +} + +void LayoutTestController::setWillSendRequestReturnsNull(bool enabled) +{ + qt_set_will_send_request_returns_null(enabled); +} + +void LayoutTestController::setWillSendRequestClearHeader(const QStringList& headers) +{ + qt_set_will_send_request_clear_headers(headers); +} + void LayoutTestController::queueBackNavigation(int howFarBackward) { //qDebug() << ">>>queueBackNavigation" << howFarBackward; @@ -290,27 +316,36 @@ QString LayoutTestController::decodeHostName(const QString& host) return decoded; } +void LayoutTestController::setMediaType(const QString& type) +{ + DumpRenderTreeSupportQt::setMediaType(m_drt->webPage()->mainFrame(), type); +} void LayoutTestController::closeWebInspector() { - qt_drt_webinspector_close(m_drt->webPage()); + DumpRenderTreeSupportQt::webInspectorClose(m_drt->webPage()); m_drt->webPage()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, false); } +void LayoutTestController::setDeveloperExtrasEnabled(bool enabled) +{ + m_drt->webPage()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, enabled); +} + void LayoutTestController::showWebInspector() { m_drt->webPage()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); - qt_drt_webinspector_show(m_drt->webPage()); + DumpRenderTreeSupportQt::webInspectorShow(m_drt->webPage()); } void LayoutTestController::evaluateInWebInspector(long callId, const QString& script) { - qt_drt_webinspector_executeScript(m_drt->webPage(), callId, script); + DumpRenderTreeSupportQt::webInspectorExecuteScript(m_drt->webPage(), callId, script); } -void LayoutTestController::setFrameSetFlatteningEnabled(bool enabled) +void LayoutTestController::setFrameFlatteningEnabled(bool enabled) { - qt_drt_setFrameSetFlatteningEnabled(m_drt->webPage(), enabled); + DumpRenderTreeSupportQt::setFrameFlatteningEnabled(m_drt->webPage(), enabled); } void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool enabled) @@ -323,15 +358,20 @@ void LayoutTestController::setAllowFileAccessFromFileURLs(bool enabled) m_drt->webPage()->settings()->setAttribute(QWebSettings::LocalContentCanAccessFileUrls, enabled); } +void LayoutTestController::setAppCacheMaximumSize(unsigned long long quota) +{ + m_drt->webPage()->settings()->setOfflineWebApplicationCacheQuota(quota); +} + void LayoutTestController::setJavaScriptProfilingEnabled(bool enable) { - m_topLoadingFrame->page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); - qt_drt_setJavaScriptProfilingEnabled(m_topLoadingFrame, enable); + setDeveloperExtrasEnabled(enable); + DumpRenderTreeSupportQt::setJavaScriptProfilingEnabled(m_topLoadingFrame, enable); } void LayoutTestController::setTimelineProfilingEnabled(bool enable) { - qt_drt_setTimelineProfilingEnabled(m_drt->webPage(), enable); + DumpRenderTreeSupportQt::setTimelineProfilingEnabled(m_drt->webPage(), enable); } void LayoutTestController::setFixedContentsSize(int width, int height) @@ -344,6 +384,11 @@ void LayoutTestController::setPrivateBrowsingEnabled(bool enable) m_drt->webPage()->settings()->setAttribute(QWebSettings::PrivateBrowsingEnabled, enable); } +void LayoutTestController::setSpatialNavigationEnabled(bool enable) +{ + m_drt->webPage()->settings()->setAttribute(QWebSettings::SpatialNavigationEnabled, enable); +} + void LayoutTestController::setPopupBlockingEnabled(bool enable) { m_drt->webPage()->settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, !enable); @@ -367,12 +412,12 @@ void LayoutTestController::setMainFrameIsFirstResponder(bool isFirst) void LayoutTestController::setXSSAuditorEnabled(bool enable) { - // Set XSSAuditorEnabled globally so that windows created by the test inherit it too. + // Set XSSAuditingEnabled globally so that windows created by the test inherit it too. // resetSettings() will call this to reset the page and global setting to false again. // Needed by http/tests/security/xssAuditor/link-opens-new-window.html QWebSettings* globalSettings = QWebSettings::globalSettings(); - globalSettings->setAttribute(QWebSettings::XSSAuditorEnabled, enable); - m_drt->webPage()->settings()->setAttribute(QWebSettings::XSSAuditorEnabled, enable); + globalSettings->setAttribute(QWebSettings::XSSAuditingEnabled, enable); + m_drt->webPage()->settings()->setAttribute(QWebSettings::XSSAuditingEnabled, enable); } bool LayoutTestController::pauseAnimationAtTimeOnElementWithId(const QString& animationName, @@ -381,7 +426,7 @@ bool LayoutTestController::pauseAnimationAtTimeOnElementWithId(const QString& an { QWebFrame* frame = m_drt->webPage()->mainFrame(); Q_ASSERT(frame); - return qt_drt_pauseAnimation(frame, animationName, time, elementId); + return DumpRenderTreeSupportQt::pauseAnimation(frame, animationName, time, elementId); } bool LayoutTestController::pauseTransitionAtTimeOnElementWithId(const QString& propertyName, @@ -390,7 +435,7 @@ bool LayoutTestController::pauseTransitionAtTimeOnElementWithId(const QString& p { QWebFrame* frame = m_drt->webPage()->mainFrame(); Q_ASSERT(frame); - return qt_drt_pauseTransitionOfProperty(frame, propertyName, time, elementId); + return DumpRenderTreeSupportQt::pauseTransitionOfProperty(frame, propertyName, time, elementId); } bool LayoutTestController::sampleSVGAnimationForElementAtTime(const QString& animationId, @@ -399,14 +444,14 @@ bool LayoutTestController::sampleSVGAnimationForElementAtTime(const QString& ani { QWebFrame* frame = m_drt->webPage()->mainFrame(); Q_ASSERT(frame); - return qt_drt_pauseSVGAnimation(frame, animationId, time, elementId); + return DumpRenderTreeSupportQt::pauseSVGAnimation(frame, animationId, time, elementId); } unsigned LayoutTestController::numberOfActiveAnimations() const { QWebFrame* frame = m_drt->webPage()->mainFrame(); Q_ASSERT(frame); - return qt_drt_numberOfActiveAnimations(frame); + return DumpRenderTreeSupportQt::numberOfActiveAnimations(frame); } void LayoutTestController::disableImageLoading() @@ -432,9 +477,14 @@ void LayoutTestController::clearAllDatabases() QWebDatabase::removeAllDatabases(); } -void LayoutTestController::whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains) +void LayoutTestController::addOriginAccessWhitelistEntry(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains) +{ + DumpRenderTreeSupportQt::whiteListAccessFromOrigin(sourceOrigin, destinationProtocol, destinationHost, allowDestinationSubdomains); +} + +void LayoutTestController::removeOriginAccessWhitelistEntry(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains) { - qt_drt_whiteListAccessFromOrigin(sourceOrigin, destinationProtocol, destinationHost, allowDestinationSubdomains); + // FIXME: Implement. } void LayoutTestController::waitForPolicyDelegate() @@ -457,6 +507,10 @@ void LayoutTestController::overridePreference(const QString& name, const QVarian settings->setFontSize(QWebSettings::DefaultFontSize, value.toInt()); else if (name == "WebKitUsesPageCachePreferenceKey") QWebSettings::setMaximumPagesInCache(value.toInt()); + else if (name == "WebKitEnableCaretBrowsing") + setCaretBrowsingEnabled(value.toBool()); + else if (name == "WebKitPluginsEnabled") + settings->setAttribute(QWebSettings::PluginsEnabled, value.toBool()); else printf("ERROR: LayoutTestController::overridePreference() does not support the '%s' preference\n", name.toLatin1().data()); @@ -467,6 +521,11 @@ void LayoutTestController::setUserStyleSheetLocation(const QString& url) m_userStyleSheetLocation = QUrl(url); } +void LayoutTestController::setCaretBrowsingEnabled(bool value) +{ + DumpRenderTreeSupportQt::setCaretBrowsingEnabled(m_drt->webPage(), value); +} + void LayoutTestController::setUserStyleSheetEnabled(bool enabled) { if (enabled) @@ -477,12 +536,12 @@ void LayoutTestController::setUserStyleSheetEnabled(bool enabled) void LayoutTestController::setDomainRelaxationForbiddenForURLScheme(bool forbidden, const QString& scheme) { - qt_drt_setDomainRelaxationForbiddenForURLScheme(forbidden, scheme); + DumpRenderTreeSupportQt::setDomainRelaxationForbiddenForURLScheme(forbidden, scheme); } int LayoutTestController::workerThreadCount() { - return qt_drt_workerThreadCount(); + return DumpRenderTreeSupportQt::workerThreadCount(); } int LayoutTestController::pageNumberForElementById(const QString& id, float width, float height) @@ -493,10 +552,74 @@ int LayoutTestController::pageNumberForElementById(const QString& id, float widt height = m_drt->webPage()->viewportSize().height(); } - return qt_drt_pageNumberForElementById(m_drt->webPage()->mainFrame(), id, width, height); + return DumpRenderTreeSupportQt::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); + return DumpRenderTreeSupportQt::numberOfPages(m_drt->webPage()->mainFrame(), width, height); +} + +bool LayoutTestController::callShouldCloseOnWebView() +{ + // FIXME: Implement for testing fix for https://bugs.webkit.org/show_bug.cgi?id=27481 + return false; +} + +void LayoutTestController::setScrollbarPolicy(const QString& orientation, const QString& policy) +{ + Qt::Orientation o; + Qt::ScrollBarPolicy p; + + if (orientation == "vertical") + o = Qt::Vertical; + else if (orientation == "horizontal") + o = Qt::Horizontal; + else + return; + + if (policy == "on") + p = Qt::ScrollBarAlwaysOn; + else if (policy == "auto") + p = Qt::ScrollBarAsNeeded; + else if (policy == "off") + p = Qt::ScrollBarAlwaysOff; + else + return; + + m_drt->webPage()->mainFrame()->setScrollBarPolicy(o, p); +} + +void LayoutTestController::setSmartInsertDeleteEnabled(bool enable) +{ + DumpRenderTreeSupportQt::setSmartInsertDeleteEnabled(m_drt->webPage(), enable); } + +void LayoutTestController::setSelectTrailingWhitespaceEnabled(bool enable) +{ + DumpRenderTreeSupportQt::setSelectTrailingWhitespaceEnabled(m_drt->webPage(), enable); +} + +void LayoutTestController::execCommand(const QString& name, const QString& value) +{ + DumpRenderTreeSupportQt::executeCoreCommandByName(m_drt->webPage(), name, value); +} + +bool LayoutTestController::isCommandEnabled(const QString& name) const +{ + return DumpRenderTreeSupportQt::isCommandEnabled(m_drt->webPage(), name); +} + +QString LayoutTestController::markerTextForListItem(const QWebElement& listItem) +{ + return DumpRenderTreeSupportQt::markerTextForListItem(listItem); +} + +void LayoutTestController::authenticateSession(const QString&, const QString&, const QString&) +{ + // FIXME: If there is a concept per-session (per-process) credential storage, the credentials should be added to it for later use. +} + + +const unsigned LayoutTestController::maxViewWidth = 800; +const unsigned LayoutTestController::maxViewHeight = 600; |