diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-23 15:08:59 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-23 15:09:20 +0100 |
commit | 061d58bc0fa016cfeed744fd3e4663460635d69b (patch) | |
tree | ad9b8b032c803e1c9054c23fa1b7a0f1976bf98f /Tools | |
parent | 470286ecfe79d59df14944e5b5d34630fc739391 (diff) | |
download | qtwebkit-061d58bc0fa016cfeed744fd3e4663460635d69b.tar.gz |
Imported WebKit commit 8eb048315f36fa33731f28694630fe4a3c2cbc99 (http://svn.webkit.org/repository/webkit/trunk@135602)
New snapshot that fixes various bugs
Change-Id: Icb6ce541a26a9f500d087821ce4b83a8d8a5474a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'Tools')
34 files changed, 539 insertions, 97 deletions
diff --git a/Tools/ChangeLog b/Tools/ChangeLog index fbacc95f3..59f37ca69 100644 --- a/Tools/ChangeLog +++ b/Tools/ChangeLog @@ -1,3 +1,277 @@ +2012-11-23 Sudarsana Nagineni <sudarsana.nagineni@intel.com> + + [EFL][WK2] Add support for PlatformWebView::simulateSpacebarKeyPress() in TestWebKitAPI + https://bugs.webkit.org/show_bug.cgi?id=103123 + + Reviewed by Kenneth Rohde Christiansen. + + Add support for PlatformWebView::simulateSpacebarKeyPress() and enable + WebKit2 API test ResponsivenessTimerDoesntFireEarly. + + * TestWebKitAPI/PlatformEfl.cmake: Enable ResponsivenessTimerDoesntFireEarly + test. + * TestWebKitAPI/efl/PlatformUtilities.cpp: + (TestWebKitAPI::Util::sleep): Use usleep() instead of sleep since the + test case is passing 0.5 seconds to sleep. + * TestWebKitAPI/efl/PlatformWebView.cpp: + (TestWebKitAPI::PlatformWebView::simulateSpacebarKeyPress): Implemented. + (TestWebKitAPI): + +2012-11-23 Wojciech Bielawski <w.bielawski@samsung.com> + + [WK2][WKTR] WebKitTestRunner needs eventSender.contextClick() + https://bugs.webkit.org/show_bug.cgi?id=86881 + + Reviewed by Kenneth Rohde Christiansen. + + eventSender object extended with contextClick() method in WebKitTestRunner. + contextClick() method returns an array of menu items objects with field 'title' containing title of single + context menu entry. According to some tests menu items objects shall also support 'click()' method, but it's not + delivered in this patch. + + * WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl: + * WebKitTestRunner/InjectedBundle/EventSendingController.cpp: + (WTR::EventSendingController::contextClick): + (WTR): + * WebKitTestRunner/InjectedBundle/EventSendingController.h: + (EventSendingController): + +2012-11-23 Simon Hausmann <simon.hausmann@digia.com> + + [Qt] Compiling against QtWebkit API requires QT_DLL to be defined + https://bugs.webkit.org/show_bug.cgi?id=102942 + + Reviewed by Tor Arne Vestbø. + + Remove the requirement of having QT_DLL defined in order for the QWEBKIT_EXPORT + macro to be defined as Q_DECL_IMPORT. Instead unify the export macro definition + to follow the same rules as other Qt 5 modules, with the exception that instead of + QT_BUILD_WEBKIT_LIB we continue to use BUILDING_WEBKIT, because that's used also + in other cross-platform header files to determine the correct meaning of export + macros. + + * qmake/mkspecs/features/default_post.prf: + * qmake/mkspecs/features/win32/default_post.prf: + +2012-11-23 Simon Hausmann <simon.hausmann@digia.com> + + [Qt] QWebPage::shouldInterruptJavaScript should be virtual in Qt 5 + https://bugs.webkit.org/show_bug.cgi?id=103111 + + Reviewed by Kenneth Rohde Christiansen. + + This function was added as a slot during Qt 4.x times because adding + virtual functions breaks binary compatibility. This constraint is gone + with the initial release of WebKit with Qt 5, and therefore we can + make it virtual now. + + The change is fully source compatible as existing "re-implementations" + as slots will now be called through it being a virtual function. They + become unused slots. + + * DumpRenderTree/qt/DumpRenderTreeQt.h: + (WebCore::WebPage::shouldInterruptJavaScript): + (WebPage): + * QtTestBrowser/webpage.h: + (WebPage): + +2012-11-22 Peter Beverloo <peter@chromium.org> + + [Chromium] Return an accurate exit code when running Android suites, and wait after restarting adb as root + https://bugs.webkit.org/show_bug.cgi?id=103065 + + Reviewed by Dirk Pranke. + + This addresses two further reliability issues in the Android test running + scripts. Firstly, the run_tests.py script needs to have the --exit_code + argument passed in order to return non-zero codes, which we need for the + build master to distinguish failures from successful runs. + + Secondly, it modifies the layout test runner to briefly wait (through + the wait-for-device command) after requesting a device to switch to root + mode. Without this waiting period, commands might get lost and thereby + unexpectedly fail. + + * Scripts/run-api-tests: + * Scripts/run-chromium-webkit-unit-tests: + * Scripts/webkitpy/layout_tests/port/chromium_android.py: + (ChromiumAndroidDriver._setup_test): + (ChromiumAndroidDriver._restart_adb_as_root): + +2012-11-22 Simon Hausmann <simon.hausmann@digia.com>, Pierre Rossi <pierre.rossi@digia.com> + + [Qt] Separate QWidget dependant code into separate WebKitWidgets static library + https://bugs.webkit.org/show_bug.cgi?id=102800 + + Reviewed by Tor Arne Vestbø. + + This patch separates code that needs to use QWidget related APIs in + WebKit/qt/WebCoreSupport and Api from code that doesn't. This means for + example FrameLoaderClientQt.cpp remains in the WebKit1 static library, + while qwebpage.cpp and qwebframe.cpp become part of the WebKitWidgets + static library. WebKit1 is compiled without QT += widgets and therefore + any widget related dependency has been moved "up" and out of WebKit1 into + the WebKitWidgets library. + + Between the code in WebKit.a and WebKitWidgets.a new adapters and + interfaces have been introduced, such as QWebPageAdapter and + QWebFrameAdapter. QWebPageAdapter, when used from WebKit1, is a way to + call out into the API layer, implemented by QWebPage (QWebPagePrivate). + The other way around if QWebPage wants to access WebCore or + WebCoreSupport related functionality, it will go through + QWebPageAdapater (as base class). The separation in the direction up + into the API layer is complete with this patch, no code in WebKit1 + depends on QtWidgets. The separation the other way around, code in the + API layer not using any WebCore types, is not complete yet. + + Some classes such as QWebSettings, QWebElement or + DumpRenderTreeSupportQt remain in WebKit1. While they are API layer, + they do not depend on widget related Qt APIs and they make much more + use of WebCore internal APIs and therefore are easier to keep in + WebKit1. + + In the future we plan to place a real shared library boundary between + WebKit1 and WebKitWidgets, by keeping the WebKit1 static library as + part of the QtWebKit shared library and by turning the WebKitWidgets + static library into a shared one. + + * DumpRenderTree/qt/DumpRenderTreeQt.cpp: + (WebCore::WebPage::resetSettings): + (WebCore::WebPage::createWindow): + (WebCore::DumpRenderTree::DumpRenderTree): + (WebCore::DumpRenderTree::resetToConsistentStateBeforeTesting): + (WebCore::DumpRenderTree::initJSObjects): + (WebCore::DumpRenderTree::dumpFrameScrollPosition): + (WebCore::DumpRenderTree::dumpFramesAsText): + (WebCore::DumpRenderTree::dump): + (WebCore::DumpRenderTree::createWindow): + (WebCore::DumpRenderTree::pageAdapter): + (WebCore): + (WebCore::DumpRenderTree::mainFrameAdapter): + * DumpRenderTree/qt/DumpRenderTreeQt.h: + (DumpRenderTree): + * DumpRenderTree/qt/EventSenderQt.cpp: + (EventSender::contextClick): + (EventSender::scalePageBy): + * DumpRenderTree/qt/TestRunnerQt.cpp: + (TestRunner::reset): + (TestRunner::display): + (TestRunner::closeWebInspector): + (TestRunner::showWebInspector): + (TestRunner::evaluateInWebInspector): + (TestRunner::setFrameFlatteningEnabled): + (TestRunner::goBack): + (TestRunner::setDefersLoading): + (TestRunner::pauseAnimationAtTimeOnElementWithId): + (TestRunner::pauseTransitionAtTimeOnElementWithId): + (TestRunner::numberOfActiveAnimations): + (TestRunner::setCaretBrowsingEnabled): + (TestRunner::setAuthorAndUserStylesEnabled): + (TestRunner::callShouldCloseOnWebView): + (TestRunner::setSmartInsertDeleteEnabled): + (TestRunner::setSelectTrailingWhitespaceEnabled): + (TestRunner::execCommand): + (TestRunner::isCommandEnabled): + (TestRunner::findString): + (TestRunner::elementDoesAutoCompleteForElementWithId): + (TestRunner::setMockDeviceOrientation): + (TestRunner::setGeolocationPermission): + (TestRunner::numberOfPendingGeolocationPermissionRequests): + (TestRunner::setMockGeolocationPositionUnavailableError): + (TestRunner::setMockGeolocationPosition): + (TestRunner::evaluateScriptInIsolatedWorld): + (TestRunner::addUserStyleSheet): + (TestRunner::setMinimumTimerInterval): + * DumpRenderTree/qt/TextInputControllerQt.cpp: + (TextInputController::selectedRange): + (TextInputController::firstRectForCharacterRange): + (TextInputController::unmarkText): + * DumpRenderTree/qt/WorkQueueItemQt.cpp: + (LoadAlternateHTMLStringItem::invoke): + * qmake/mkspecs/features/default_post.prf: + * qmake/mkspecs/features/production_build.prf: + * qmake/mkspecs/features/webkit_modules.prf: + * qmake/mkspecs/modules/webkitwidgets.prf: Added. + +2012-11-22 Christophe Dumez <christophe.dumez@intel.com> + + WebKitTestRunner needs layoutTestController.setCacheModel + https://bugs.webkit.org/show_bug.cgi?id=42684 + + Reviewed by Kenneth Rohde Christiansen. + + Add support for testRunner.setCacheModel to WebKitTestRunner. + + * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: + * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: + (WTR::InjectedBundle::beginTesting): + * WebKitTestRunner/InjectedBundle/TestRunner.cpp: + (WTR::TestRunner::setCacheModel): + (WTR): + * WebKitTestRunner/InjectedBundle/TestRunner.h: + (TestRunner): + +2012-11-22 Balazs Kelemen <kbalazs@webkit.org> + + [Qt][WTR] TestController::platformRunUntil should not do busy waiting + https://bugs.webkit.org/show_bug.cgi?id=101327 + + Reviewed by Simon Hausmann. + + Avoid busy waiting for events in platformRunUntil while making + sure we don't change the behavior of modal event loops. + + * WebKitTestRunner/TestController.cpp: + (WTR::TestController::~TestController): + * WebKitTestRunner/TestController.h: + (TestController): + * WebKitTestRunner/efl/TestControllerEfl.cpp: + (WTR::TestController::platformDestroy): + (WTR): + * WebKitTestRunner/gtk/TestControllerGtk.cpp: + (WTR::TestController::platformDestroy): + (WTR): + * WebKitTestRunner/mac/TestControllerMac.mm: + (WTR::TestController::platformDestroy): + (WTR): + * WebKitTestRunner/qt/TestControllerQt.cpp: + (TestController::RunLoop): Helper class to handle + the event loop logic + (WTR): + (WTR::TestController::RunLoop::RunLoop): + (WTR::TestController::RunLoop::runUntil): Use QEventLoop to implement + the run loop. This is the appropriate API to push the WaitForMoreEvents + flag to QCoreApplication::processEvents and also being able to exit the + loop if we have timed out. + (WTR::TestController::RunLoop::notifyDone): + (WTR::TestController::RunLoop::timerFired): + (WTR::TestController::RunLoop::runModal): + (WTR::TestController::notifyDone): + (WTR::TestController::platformInitialize): + (WTR::TestController::platformDestroy): + (WTR::TestController::platformRunUntil): + (WTR::TestController::runModal): + * WebKitTestRunner/win/TestControllerWin.cpp: + (WTR::TestController::platformDestroy): + (WTR): + +2012-11-22 Sudarsana Nagineni <sudarsana.nagineni@intel.com> + + [EFL][WK2] Enable WKPreferences and AboutBlankLoad API tests + https://bugs.webkit.org/show_bug.cgi?id=102926 + + Reviewed by Kenneth Rohde Christiansen. + + Add missing bits needed by WKPreferences and AboutBlankLoad API + tests in the test harness and enable these tests on EFL port. + + * TestWebKitAPI/PlatformEfl.cmake: + * TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp: + (TestWebKitAPI::TEST): + * TestWebKitAPI/efl/PlatformUtilities.cpp: + (TestWebKitAPI::Util::MIMETypeForWKURLResponse): + (Util): + 2012-11-21 Zan Dobersek <zandobersek@gmail.com> [GTK][WTR] Implement AccessibilityUIElement::stringValue diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp index 34ee5ad4a..16c237866 100755 --- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp +++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp @@ -36,6 +36,7 @@ #include "DumpRenderTreeSupportQt.h" #include "EventSenderQt.h" #include "GCControllerQt.h" +#include "InitWebKitQt.h" #include "QtTestSupport.h" #include "TestRunnerQt.h" #include "TextInputControllerQt.h" @@ -62,19 +63,14 @@ #include <QProgressBar> #include <QUndoStack> #include <QUrl> - -#include <qwebsettings.h> -#include <qwebsecurityorigin.h> - #include <limits.h> #include <locale.h> - +#include <qwebsecurityorigin.h> +#include <qwebsettings.h> #ifndef Q_OS_WIN #include <unistd.h> #endif -#include <qdebug.h> - namespace WebCore { const int databaseDefaultQuota = 5 * 1024 * 1024; @@ -206,14 +202,14 @@ void WebPage::resetSettings() QWebSettings::setMaximumPagesInCache(0); // reset to default settings()->setUserStyleSheetUrl(QUrl()); // reset to default - DumpRenderTreeSupportQt::setMinimumTimerInterval(this, DumpRenderTreeSupportQt::defaultMinimumTimerInterval()); + DumpRenderTreeSupportQt::setMinimumTimerInterval(handle(), DumpRenderTreeSupportQt::defaultMinimumTimerInterval()); - DumpRenderTreeSupportQt::resetInternalsObject(mainFrame()); + DumpRenderTreeSupportQt::resetInternalsObject(mainFrame()->handle()); m_pendingGeolocationRequests.clear(); } -QWebPage *WebPage::createWindow(QWebPage::WebWindowType) +QWebPage* WebPage::createWindow(QWebPage::WebWindowType) { return m_drt->createWindow(); } @@ -399,6 +395,7 @@ DumpRenderTree::DumpRenderTree() if (viewMode == "graphics") setGraphicsBased(true); + WebKit::initializeWebKitWidgets(); DumpRenderTreeSupportQt::initialize(); // Set running in DRT mode for qwebpage to create testable objects. @@ -421,7 +418,7 @@ DumpRenderTree::DumpRenderTree() } // Use a frame group name for all pages created by DumpRenderTree to allow // testing of cross-page frame lookup. - DumpRenderTreeSupportQt::webPageSetGroupName(m_page, "org.webkit.qt.DumpRenderTree"); + DumpRenderTreeSupportQt::webPageSetGroupName(pageAdapter(), "org.webkit.qt.DumpRenderTree"); m_mainView->setContextMenuPolicy(Qt::NoContextMenu); m_mainView->resize(QSize(TestRunner::maxViewWidth, TestRunner::maxViewHeight)); @@ -470,7 +467,7 @@ DumpRenderTree::DumpRenderTree() QObject::connect(this, SIGNAL(quit()), qApp, SLOT(quit()), Qt::QueuedConnection); DumpRenderTreeSupportQt::setDumpRenderTreeModeEnabled(true); - DumpRenderTreeSupportQt::setInteractiveFormValidationEnabled(webPage(), true); + DumpRenderTreeSupportQt::setInteractiveFormValidationEnabled(pageAdapter(), true); DumpRenderTreeSupportQt::enableMockScrollbars(); QFocusEvent event(QEvent::FocusIn, Qt::ActiveWindowFocusReason); @@ -541,9 +538,9 @@ void DumpRenderTree::resetToConsistentStateBeforeTesting(const QUrl& url) #endif clearHistory(m_page); - DumpRenderTreeSupportQt::scalePageBy(m_page->mainFrame(), 1, QPoint(0, 0)); - DumpRenderTreeSupportQt::clearFrameName(m_page->mainFrame()); - DumpRenderTreeSupportQt::removeUserStyleSheets(m_page); + DumpRenderTreeSupportQt::scalePageBy(mainFrameAdapter(), 1, QPoint(0, 0)); + DumpRenderTreeSupportQt::clearFrameName(mainFrameAdapter()); + DumpRenderTreeSupportQt::removeUserStyleSheets(pageAdapter()); m_page->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAsNeeded); m_page->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAsNeeded); @@ -561,7 +558,7 @@ void DumpRenderTree::resetToConsistentStateBeforeTesting(const QUrl& url) DumpRenderTreeSupportQt::resetOriginAccessWhiteLists(); - DumpRenderTreeSupportQt::setWindowsBehaviorAsEditingBehavior(m_page); + DumpRenderTreeSupportQt::setWindowsBehaviorAsEditingBehavior(pageAdapter()); QLocale::setDefault(QLocale::c()); @@ -570,7 +567,7 @@ void DumpRenderTree::resetToConsistentStateBeforeTesting(const QUrl& url) setlocale(LC_ALL, ""); #endif - DumpRenderTreeSupportQt::clearOpener(m_page->mainFrame()); + DumpRenderTreeSupportQt::clearOpener(mainFrameAdapter()); } static bool isGlobalHistoryTest(const QUrl& url) @@ -739,7 +736,7 @@ void DumpRenderTree::initJSObjects() frame->addToJavaScriptWindowObject(QLatin1String("eventSender"), m_eventSender); frame->addToJavaScriptWindowObject(QLatin1String("textInputController"), m_textInputController); frame->addToJavaScriptWindowObject(QLatin1String("GCController"), m_gcController); - DumpRenderTreeSupportQt::injectInternalsObject(frame); + DumpRenderTreeSupportQt::injectInternalsObject(frame->handle()); } void DumpRenderTree::showPage() @@ -757,7 +754,7 @@ void DumpRenderTree::hidePage() QString DumpRenderTree::dumpFrameScrollPosition(QWebFrame* frame) { - if (!frame || !DumpRenderTreeSupportQt::hasDocumentElement(frame)) + if (!frame || !DumpRenderTreeSupportQt::hasDocumentElement(frame->handle())) return QString(); QString result; @@ -779,7 +776,7 @@ QString DumpRenderTree::dumpFrameScrollPosition(QWebFrame* frame) QString DumpRenderTree::dumpFramesAsText(QWebFrame* frame) { - if (!frame || !DumpRenderTreeSupportQt::hasDocumentElement(frame)) + if (!frame || !DumpRenderTreeSupportQt::hasDocumentElement(frame->handle())) return QString(); QString result; @@ -907,7 +904,7 @@ void DumpRenderTree::dump() fprintf(stdout, "Source:\n\n%s\n", markup.toUtf8().constData()); } - QString mimeType = DumpRenderTreeSupportQt::responseMimeType(mainFrame); + QString mimeType = DumpRenderTreeSupportQt::responseMimeType(mainFrame->handle()); if (mimeType == "text/plain") m_controller->dumpAsText(); @@ -947,11 +944,11 @@ void DumpRenderTree::dump() mainFrame->render(&painter); painter.end(); } else - image = DumpRenderTreeSupportQt::paintPagesWithBoundaries(mainFrame); + image = DumpRenderTreeSupportQt::paintPagesWithBoundaries(mainFrame->handle()); - if (DumpRenderTreeSupportQt::trackRepaintRects(m_page->mainFrame())) { + if (DumpRenderTreeSupportQt::trackRepaintRects(mainFrameAdapter())) { QVector<QRect> repaintRects; - DumpRenderTreeSupportQt::getTrackedRepaintRects(m_page->mainFrame(), repaintRects); + DumpRenderTreeSupportQt::getTrackedRepaintRects(mainFrameAdapter(), repaintRects); QImage mask(image.size(), image.format()); mask.fill(QColor(0, 0, 0, 0.66 * 255)); @@ -963,7 +960,7 @@ void DumpRenderTree::dump() QPainter painter(&image); painter.drawImage(image.rect(), mask); - DumpRenderTreeSupportQt::setTrackRepaintRects(m_page->mainFrame(), false); + DumpRenderTreeSupportQt::setTrackRepaintRects(mainFrameAdapter(), false); } QCryptographicHash hash(QCryptographicHash::Md5); @@ -1098,7 +1095,7 @@ QWebPage *DumpRenderTree::createWindow() // Use a frame group name for all pages created by DumpRenderTree to allow // testing of cross-page frame lookup. - DumpRenderTreeSupportQt::webPageSetGroupName(page, "org.webkit.qt.DumpRenderTree"); + DumpRenderTreeSupportQt::webPageSetGroupName(page->handle(), "org.webkit.qt.DumpRenderTree"); return page; } @@ -1134,6 +1131,16 @@ void DumpRenderTree::switchFocus(bool focused) } +QWebPageAdapter* DumpRenderTree::pageAdapter() const +{ + return m_page->handle(); +} + +QWebFrameAdapter* DumpRenderTree::mainFrameAdapter() const +{ + return m_page->mainFrame()->handle(); +} + QList<WebPage*> DumpRenderTree::getAllPages() const { QList<WebPage*> pages; diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h index 98429c44e..7a6f76fb0 100644 --- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h +++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h @@ -53,7 +53,8 @@ class QUrl; class QFile; QT_END_NAMESPACE -class QWebFrame; +class QWebFrameAdapter; +class QWebPageAdapter; class TestRunner; class DumpRenderTreeSupportQt; @@ -97,6 +98,9 @@ public: void switchFocus(bool focused); WebPage *webPage() const { return m_page; } + QWebPageAdapter *pageAdapter() const; + QWebFrameAdapter *mainFrameAdapter() const; + QList<WebPage*> getAllPages() const; void processArgsLine(const QStringList&); @@ -200,8 +204,9 @@ public: void permissionSet(QWebPage::Feature feature); + virtual bool shouldInterruptJavaScript() { return false; } + public Q_SLOTS: - bool shouldInterruptJavaScript() { return false; } void requestPermission(QWebFrame* frame, QWebPage::Feature feature); void cancelPermission(QWebFrame* frame, QWebPage::Feature feature); diff --git a/Tools/DumpRenderTree/qt/EventSenderQt.cpp b/Tools/DumpRenderTree/qt/EventSenderQt.cpp index dcf9f1bb2..80be13178 100644 --- a/Tools/DumpRenderTree/qt/EventSenderQt.cpp +++ b/Tools/DumpRenderTree/qt/EventSenderQt.cpp @@ -431,7 +431,7 @@ QStringList EventSender::contextClick() QContextMenuEvent ctxEvent(QContextMenuEvent::Mouse, m_mousePos); sendEvent(m_page->view(), &ctxEvent); } - return DumpRenderTreeSupportQt::contextMenu(m_page); + return DumpRenderTreeSupportQt::contextMenu(m_page->handle()); } void EventSender::scheduleAsynchronousClick() @@ -616,7 +616,7 @@ void EventSender::textZoomOut() void EventSender::scalePageBy(float scaleFactor, float x, float y) { if (QWebFrame* frame = m_page->mainFrame()) - DumpRenderTreeSupportQt::scalePageBy(frame, scaleFactor, QPoint(x, y)); + DumpRenderTreeSupportQt::scalePageBy(frame->handle(), scaleFactor, QPoint(x, y)); } QWebFrame* EventSender::frameUnderMouse() const diff --git a/Tools/DumpRenderTree/qt/TestRunnerQt.cpp b/Tools/DumpRenderTree/qt/TestRunnerQt.cpp index 6067514f0..d93505fc5 100644 --- a/Tools/DumpRenderTree/qt/TestRunnerQt.cpp +++ b/Tools/DumpRenderTree/qt/TestRunnerQt.cpp @@ -92,7 +92,7 @@ void TestRunner::reset() DumpRenderTreeSupportQt::setCustomPolicyDelegate(false, false); DumpRenderTreeSupportQt::dumpHistoryCallbacks(false); DumpRenderTreeSupportQt::dumpVisitedLinksCallbacks(false); - DumpRenderTreeSupportQt::resetGeolocationMock(m_drt->webPage()); + DumpRenderTreeSupportQt::resetGeolocationMock(m_drt->pageAdapter()); setIconDatabaseEnabled(false); clearAllDatabases(); // The default state for DRT is to block third-party cookies, mimicing the Mac port @@ -243,7 +243,7 @@ void TestRunner::simulateLegacyWebNotificationClick(const QString& title) void TestRunner::display() { - DumpRenderTreeSupportQt::setTrackRepaintRects(m_topLoadingFrame, true); + DumpRenderTreeSupportQt::setTrackRepaintRects(m_topLoadingFrame->handle(), true); emit showPage(); } @@ -417,7 +417,7 @@ QString TestRunner::decodeHostName(const QString& host) void TestRunner::closeWebInspector() { - DumpRenderTreeSupportQt::webInspectorClose(m_drt->webPage()); + DumpRenderTreeSupportQt::webInspectorClose(m_drt->pageAdapter()); m_drt->webPage()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, false); } @@ -434,27 +434,27 @@ void TestRunner::setAsynchronousSpellCheckingEnabled(bool) void TestRunner::showWebInspector() { m_drt->webPage()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); - DumpRenderTreeSupportQt::webInspectorShow(m_drt->webPage()); + DumpRenderTreeSupportQt::webInspectorShow(m_drt->pageAdapter()); } void TestRunner::evaluateInWebInspector(long callId, const QString& script) { - DumpRenderTreeSupportQt::webInspectorExecuteScript(m_drt->webPage(), callId, script); + DumpRenderTreeSupportQt::webInspectorExecuteScript(m_drt->pageAdapter(), callId, script); } void TestRunner::setFrameFlatteningEnabled(bool enabled) { - DumpRenderTreeSupportQt::setFrameFlatteningEnabled(m_drt->webPage(), enabled); + DumpRenderTreeSupportQt::setFrameFlatteningEnabled(m_drt->pageAdapter(), enabled); } void TestRunner::goBack() { - DumpRenderTreeSupportQt::goBack(m_drt->webPage()); + DumpRenderTreeSupportQt::goBack(m_drt->pageAdapter()); } void TestRunner::setDefersLoading(bool flag) { - DumpRenderTreeSupportQt::setDefersLoading(m_drt->webPage(), flag); + DumpRenderTreeSupportQt::setDefersLoading(m_drt->pageAdapter(), flag); } void TestRunner::setAllowUniversalAccessFromFileURLs(bool enabled) @@ -544,7 +544,7 @@ bool TestRunner::pauseAnimationAtTimeOnElementWithId(const QString& animationNam { QWebFrame* frame = m_drt->webPage()->mainFrame(); Q_ASSERT(frame); - return DumpRenderTreeSupportQt::pauseAnimation(frame, animationName, time, elementId); + return DumpRenderTreeSupportQt::pauseAnimation(frame->handle(), animationName, time, elementId); } bool TestRunner::pauseTransitionAtTimeOnElementWithId(const QString& propertyName, @@ -553,14 +553,14 @@ bool TestRunner::pauseTransitionAtTimeOnElementWithId(const QString& propertyNam { QWebFrame* frame = m_drt->webPage()->mainFrame(); Q_ASSERT(frame); - return DumpRenderTreeSupportQt::pauseTransitionOfProperty(frame, propertyName, time, elementId); + return DumpRenderTreeSupportQt::pauseTransitionOfProperty(frame->handle(), propertyName, time, elementId); } unsigned TestRunner::numberOfActiveAnimations() const { QWebFrame* frame = m_drt->webPage()->mainFrame(); Q_ASSERT(frame); - return DumpRenderTreeSupportQt::numberOfActiveAnimations(frame); + return DumpRenderTreeSupportQt::numberOfActiveAnimations(frame->handle()); } void TestRunner::disableImageLoading() @@ -698,12 +698,12 @@ void TestRunner::setUserStyleSheetLocation(const QString& url) void TestRunner::setCaretBrowsingEnabled(bool value) { - DumpRenderTreeSupportQt::setCaretBrowsingEnabled(m_drt->webPage(), value); + DumpRenderTreeSupportQt::setCaretBrowsingEnabled(m_drt->pageAdapter(), value); } void TestRunner::setAuthorAndUserStylesEnabled(bool value) { - DumpRenderTreeSupportQt::setAuthorAndUserStylesEnabled(m_drt->webPage(), value); + DumpRenderTreeSupportQt::setAuthorAndUserStylesEnabled(m_drt->pageAdapter(), value); } void TestRunner::setUserStyleSheetEnabled(bool enabled) @@ -728,7 +728,7 @@ int TestRunner::workerThreadCount() bool TestRunner::callShouldCloseOnWebView() { - return DumpRenderTreeSupportQt::shouldClose(m_drt->webPage()->mainFrame()); + return DumpRenderTreeSupportQt::shouldClose(m_drt->mainFrameAdapter()); } void TestRunner::setScrollbarPolicy(const QString& orientation, const QString& policy) @@ -757,27 +757,27 @@ void TestRunner::setScrollbarPolicy(const QString& orientation, const QString& p void TestRunner::setSmartInsertDeleteEnabled(bool enable) { - DumpRenderTreeSupportQt::setSmartInsertDeleteEnabled(m_drt->webPage(), enable); + DumpRenderTreeSupportQt::setSmartInsertDeleteEnabled(m_drt->pageAdapter(), enable); } void TestRunner::setSelectTrailingWhitespaceEnabled(bool enable) { - DumpRenderTreeSupportQt::setSelectTrailingWhitespaceEnabled(m_drt->webPage(), enable); + DumpRenderTreeSupportQt::setSelectTrailingWhitespaceEnabled(m_drt->pageAdapter(), enable); } void TestRunner::execCommand(const QString& name, const QString& value) { - DumpRenderTreeSupportQt::executeCoreCommandByName(m_drt->webPage(), name, value); + DumpRenderTreeSupportQt::executeCoreCommandByName(m_drt->pageAdapter(), name, value); } bool TestRunner::isCommandEnabled(const QString& name) const { - return DumpRenderTreeSupportQt::isCommandEnabled(m_drt->webPage(), name); + return DumpRenderTreeSupportQt::isCommandEnabled(m_drt->pageAdapter(), name); } bool TestRunner::findString(const QString& string, const QStringList& optionArray) { - return DumpRenderTreeSupportQt::findString(m_drt->webPage(), string, optionArray); + return DumpRenderTreeSupportQt::findString(m_drt->pageAdapter(), string, optionArray); } QString TestRunner::markerTextForListItem(const QWebElement& listItem) @@ -792,7 +792,7 @@ QVariantMap TestRunner::computedStyleIncludingVisitedInfo(const QWebElement& ele bool TestRunner::elementDoesAutoCompleteForElementWithId(const QString& elementId) { - return DumpRenderTreeSupportQt::elementDoesAutoCompleteForElementWithId(m_drt->webPage()->mainFrame(), elementId); + return DumpRenderTreeSupportQt::elementDoesAutoCompleteForElementWithId(m_drt->mainFrameAdapter(), elementId); } void TestRunner::authenticateSession(const QString&, const QString&, const QString&) @@ -812,7 +812,7 @@ void TestRunner::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bo { QList<WebCore::WebPage*> pages = m_drt->getAllPages(); foreach (WebCore::WebPage* page, pages) - DumpRenderTreeSupportQt::setMockDeviceOrientation(page, canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma); + DumpRenderTreeSupportQt::setMockDeviceOrientation(page->handle(), canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma); } void TestRunner::setGeolocationPermission(bool allow) @@ -820,7 +820,7 @@ void TestRunner::setGeolocationPermission(bool allow) setGeolocationPermissionCommon(allow); QList<WebCore::WebPage*> pages = m_drt->getAllPages(); foreach (WebCore::WebPage* page, pages) - DumpRenderTreeSupportQt::setMockGeolocationPermission(page, allow); + DumpRenderTreeSupportQt::setMockGeolocationPermission(page->handle(), allow); } int TestRunner::numberOfPendingGeolocationPermissionRequests() @@ -828,7 +828,7 @@ int TestRunner::numberOfPendingGeolocationPermissionRequests() int pendingPermissionCount = 0; QList<WebCore::WebPage*> pages = m_drt->getAllPages(); foreach (WebCore::WebPage* page, pages) - pendingPermissionCount += DumpRenderTreeSupportQt::numberOfPendingGeolocationPermissionRequests(page); + pendingPermissionCount += DumpRenderTreeSupportQt::numberOfPendingGeolocationPermissionRequests(page->handle()); return pendingPermissionCount; } @@ -843,14 +843,14 @@ void TestRunner::setMockGeolocationPositionUnavailableError(const QString& messa { QList<WebCore::WebPage*> pages = m_drt->getAllPages(); foreach (WebCore::WebPage* page, pages) - DumpRenderTreeSupportQt::setMockGeolocationPositionUnavailableError(page, message); + DumpRenderTreeSupportQt::setMockGeolocationPositionUnavailableError(page->handle(), message); } void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy) { QList<WebCore::WebPage*> pages = m_drt->getAllPages(); foreach (WebCore::WebPage* page, pages) - DumpRenderTreeSupportQt::setMockGeolocationPosition(page, latitude, longitude, accuracy); + DumpRenderTreeSupportQt::setMockGeolocationPosition(page->handle(), latitude, longitude, accuracy); } void TestRunner::addMockSpeechInputResult(const QString& result, double confidence, const QString& language) @@ -878,12 +878,12 @@ void TestRunner::evaluateScriptInIsolatedWorldAndReturnValue(int worldID, const void TestRunner::evaluateScriptInIsolatedWorld(int worldID, const QString& script) { - DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld(m_drt->webPage()->mainFrame(), worldID, script); + DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld(m_drt->mainFrameAdapter(), worldID, script); } void TestRunner::addUserStyleSheet(const QString& sourceCode) { - DumpRenderTreeSupportQt::addUserStyleSheet(m_drt->webPage(), sourceCode); + DumpRenderTreeSupportQt::addUserStyleSheet(m_drt->pageAdapter(), sourceCode); } void TestRunner::removeAllVisitedLinks() @@ -900,7 +900,7 @@ void TestRunner::addURLToRedirect(const QString& origin, const QString& destinat void TestRunner::setMinimumTimerInterval(double minimumTimerInterval) { - DumpRenderTreeSupportQt::setMinimumTimerInterval(m_drt->webPage(), minimumTimerInterval); + DumpRenderTreeSupportQt::setMinimumTimerInterval(m_drt->pageAdapter(), minimumTimerInterval); } void TestRunner::originsWithLocalStorage() diff --git a/Tools/DumpRenderTree/qt/TextInputControllerQt.cpp b/Tools/DumpRenderTree/qt/TextInputControllerQt.cpp index d5645a523..38e489d78 100644 --- a/Tools/DumpRenderTree/qt/TextInputControllerQt.cpp +++ b/Tools/DumpRenderTree/qt/TextInputControllerQt.cpp @@ -149,15 +149,15 @@ void TextInputController::insertText(const QString& string) QVariantList TextInputController::selectedRange() { - return DumpRenderTreeSupportQt::selectedRange(qobject_cast<QWebPage*>(parent())); + return DumpRenderTreeSupportQt::selectedRange(qobject_cast<QWebPage*>(parent())->handle()); } QVariantList TextInputController::firstRectForCharacterRange(int location, int length) { - return DumpRenderTreeSupportQt::firstRectForCharacterRange(qobject_cast<QWebPage*>(parent()), location, length); + return DumpRenderTreeSupportQt::firstRectForCharacterRange(qobject_cast<QWebPage*>(parent())->handle(), location, length); } void TextInputController::unmarkText() { - DumpRenderTreeSupportQt::confirmComposition(qobject_cast<QWebPage*>(parent()), 0); + DumpRenderTreeSupportQt::confirmComposition(qobject_cast<QWebPage*>(parent())->handle(), 0); } diff --git a/Tools/DumpRenderTree/qt/WorkQueueItemQt.cpp b/Tools/DumpRenderTree/qt/WorkQueueItemQt.cpp index b09336667..7cf9fcaf1 100644 --- a/Tools/DumpRenderTree/qt/WorkQueueItemQt.cpp +++ b/Tools/DumpRenderTree/qt/WorkQueueItemQt.cpp @@ -81,7 +81,7 @@ bool LoadAlternateHTMLStringItem::invoke() const if (!frame) return false; - DumpRenderTreeSupportQt::setAlternateHtml(frame, m_content, QUrl(m_baseURL), QUrl(m_failingURL)); + DumpRenderTreeSupportQt::setAlternateHtml(frame->handle(), m_content, QUrl(m_baseURL), QUrl(m_failingURL)); return true; } diff --git a/Tools/QtTestBrowser/webpage.h b/Tools/QtTestBrowser/webpage.h index 9f98212d0..0965b56c9 100644 --- a/Tools/QtTestBrowser/webpage.h +++ b/Tools/QtTestBrowser/webpage.h @@ -52,10 +52,11 @@ public: QString userAgentForUrl(const QUrl& url) const; void setInterruptingJavaScriptEnabled(bool enabled) { m_interruptingJavaScriptEnabled = enabled; } + virtual bool shouldInterruptJavaScript(); + public Q_SLOTS: void openUrlInDefaultBrowser(const QUrl& url = QUrl()); void setUserAgent(const QString& ua) { m_userAgent = ua; } - bool shouldInterruptJavaScript(); void authenticationRequired(QNetworkReply*, QAuthenticator*); void requestPermission(QWebFrame* frame, QWebPage::Feature feature); void featurePermissionRequestCanceled(QWebFrame* frame, QWebPage::Feature feature); diff --git a/Tools/Scripts/run-api-tests b/Tools/Scripts/run-api-tests index 5913cee8f..ca71ac541 100755 --- a/Tools/Scripts/run-api-tests +++ b/Tools/Scripts/run-api-tests @@ -83,7 +83,7 @@ setConfiguration(); # When running TestWebKitAPI for Chromium on Android, defer to the test runner in # Chromium as we can't execute the binary locally. if (isChromiumAndroid()) { - my @runTestCommand = ('build/android/run_tests.py', '--verbose', '--webkit', '--out-directory', sourceDir() . '/out', '-s', 'TestWebKitAPI'); + my @runTestCommand = ('build/android/run_tests.py', '--verbose', '--webkit', '--exit_code', '--out-directory', sourceDir() . '/out', '-s', 'TestWebKitAPI'); if (configuration() eq "Release") { push @runTestCommand, '--release'; } diff --git a/Tools/Scripts/run-chromium-webkit-unit-tests b/Tools/Scripts/run-chromium-webkit-unit-tests index 33c7cc25e..114f77af7 100755 --- a/Tools/Scripts/run-chromium-webkit-unit-tests +++ b/Tools/Scripts/run-chromium-webkit-unit-tests @@ -38,7 +38,7 @@ setConfiguration(); # Defer to Android's test runners for running webkit_unit_tests on a device. if (checkForArgumentAndRemoveFromARGV('--platform=chromium-android')) { - my @runTestCommand = ('build/android/run_tests.py', '--verbose', '--webkit', '--out-directory', sourceDir() . '/out', '-s', 'webkit_unit_tests'); + my @runTestCommand = ('build/android/run_tests.py', '--verbose', '--webkit', '--exit_code', '--out-directory', sourceDir() . '/out', '-s', 'webkit_unit_tests'); if (configuration() eq "Release") { push @runTestCommand, '--release'; } diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py index 2924f24e2..a077dc92e 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py @@ -354,7 +354,7 @@ class ChromiumAndroidDriver(driver.Driver): if self._has_setup: return - self._run_adb_command(['root']) + self._restart_adb_as_root() self._setup_md5sum_and_push_data_if_needed() self._has_setup = True self._setup_performance() @@ -425,6 +425,15 @@ class ChromiumAndroidDriver(driver.Driver): for resource in TEST_RESOURCES_TO_PUSH: self._push_file_if_needed(self._port.layout_tests_dir() + '/' + resource, DEVICE_LAYOUT_TESTS_DIR + resource) + def _restart_adb_as_root(self): + output = self._run_adb_command(['root']) + if 'adbd is already running as root' in output: + return + elif 'restarting adbd as root' in output: + self._run_adb_command(['wait-for-device']) + else: + self._log_error('Unrecognized output from adb root: %s' % output) + def _run_adb_command(self, cmd, ignore_error=False): self._log_debug('Run adb command: ' + str(cmd)) if ignore_error: diff --git a/Tools/TestWebKitAPI/PlatformEfl.cmake b/Tools/TestWebKitAPI/PlatformEfl.cmake index d6d913005..c6ea7302c 100644 --- a/Tools/TestWebKitAPI/PlatformEfl.cmake +++ b/Tools/TestWebKitAPI/PlatformEfl.cmake @@ -44,6 +44,7 @@ SET(webkit2_api_harness_SOURCES # Release builds before adding it to test_webkit2_api_BINARIES. SET(test_webkit2_api_BINARIES + AboutBlankLoad CookieManager DOMWindowExtensionNoCache DocumentStartUserScriptAlertCrash @@ -65,7 +66,9 @@ SET(test_webkit2_api_BINARIES ParentFrame PreventEmptyUserAgent PrivateBrowsingPushStateNoHistoryCallback + ResponsivenessTimerDoesntFireEarly WKConnection + WKPreferences WKString WKStringJSString WKURL @@ -87,12 +90,9 @@ ADD_DEFINITIONS(-DTHEME_DIR="${THEME_BINARY_DIR}") # Tests disabled because of missing features on the test harness: # -# AboutBlankLoad # HitTestResultNodeHandle # MouseMoveAfterCrash -# ResponsivenessTimerDoesntFireEarly # SpacebarScrolling -# WKPreferences # # Flaky test, fails on Release but passes on Debug: # diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp index 5c0751bb0..3c4bedaf4 100644 --- a/Tools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp +++ b/Tools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp @@ -57,7 +57,7 @@ TEST(WebKit2, WKPreferencesDefaults) static const char* expectedCursiveFontFamily = "Apple Chancery"; static const char* expectedFantasyFontFamily = "Papyrus"; static const char* expectedPictographFontFamily = "Apple Color Emoji"; -#elif PLATFORM(GTK) +#elif PLATFORM(GTK) || PLATFORM(EFL) static const char* expectedStandardFontFamily = "Times"; static const char* expectedFixedFontFamily = "Courier New"; static const char* expectedSerifFontFamily = "Times"; diff --git a/Tools/TestWebKitAPI/efl/PlatformUtilities.cpp b/Tools/TestWebKitAPI/efl/PlatformUtilities.cpp index 96745459f..65c54e1a7 100644 --- a/Tools/TestWebKitAPI/efl/PlatformUtilities.cpp +++ b/Tools/TestWebKitAPI/efl/PlatformUtilities.cpp @@ -42,7 +42,7 @@ void run(bool* done) void sleep(double seconds) { - sleep(seconds); + usleep(seconds * 1000000); } WKURLRef createURLForResource(const char* resource, const char* extension) @@ -64,6 +64,11 @@ WKURLRef URLForNonExistentResource() return WKURLCreateWithUTF8CString("file:///does-not-exist.html"); } +WKRetainPtr<WKStringRef> MIMETypeForWKURLResponse(WKURLResponseRef wkResponse) +{ + return adoptWK(WKURLResponseCopyMIMEType(wkResponse)); +} + } // namespace Util } // namespace TestWebKitAPI diff --git a/Tools/TestWebKitAPI/efl/PlatformWebView.cpp b/Tools/TestWebKitAPI/efl/PlatformWebView.cpp index 2e87f7087..acec6ed84 100644 --- a/Tools/TestWebKitAPI/efl/PlatformWebView.cpp +++ b/Tools/TestWebKitAPI/efl/PlatformWebView.cpp @@ -80,4 +80,12 @@ WKPageRef PlatformWebView::page() const return WKViewGetPage(toAPI(m_view)); } +void PlatformWebView::simulateSpacebarKeyPress() +{ + Evas* evas = ecore_evas_get(m_window); + evas_object_focus_set(m_view, true); + evas_event_feed_key_down(evas, "space", "space", " ", 0, 0, 0); + evas_event_feed_key_up(evas, "space", "space", " ", 0, 1, 0); +} + } // namespace TestWebKitAPI diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl b/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl index 52a7a5b62..1d62c9b23 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl +++ b/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl @@ -29,6 +29,7 @@ interface EventSendingController { void mouseMoveTo(in long x, in long y); void mouseScrollBy(in long x, in long y); void continuousMouseScrollBy(in long x, in long y, in [Optional] boolean paged); + object contextClick(); void scheduleAsynchronousClick(); void leapForward(in long milliseconds); diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl b/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl index 6dad1b2bd..354d2b580 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl +++ b/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl @@ -72,6 +72,7 @@ interface TestRunner { void setTabKeyCyclesThroughElements(in boolean enabled); void setSerializeHTTPLoads(); void dispatchPendingLoadRequests(); + void setCacheModel(in int model); // Special DOM functions. void clearBackForwardList(); diff --git a/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp b/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp index bf6d9bcb1..4ee7821b8 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp @@ -319,6 +319,37 @@ void EventSendingController::continuousMouseScrollBy(int x, int y, bool paged) WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0); } +JSValueRef EventSendingController::contextClick() +{ + WKBundlePageRef page = InjectedBundle::shared().page()->page(); + WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(page); + JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame); +#if ENABLE(CONTEXT_MENUS) + // Do mouse context click. + mouseDown(2, 0); + mouseUp(2, 0); + + WKRetainPtr<WKArrayRef> entriesNames = adoptWK(WKBundlePageCopyContextMenuItemTitles(page)); + JSRetainPtr<JSStringRef> jsPropertyName(Adopt, JSStringCreateWithUTF8CString("title")); + size_t entriesSize = WKArrayGetSize(entriesNames.get()); + OwnArrayPtr<JSValueRef> jsValuesArray = adoptArrayPtr(new JSValueRef[entriesSize]); + for (size_t i = 0; i < entriesSize; ++i) { + ASSERT(WKGetTypeID(WKArrayGetItemAtIndex(entriesNames.get(), i)) == WKStringGetTypeID()); + + WKStringRef wkEntryName = static_cast<WKStringRef>(WKArrayGetItemAtIndex(entriesNames.get(), i)); + JSObjectRef jsItemObject = JSObjectMake(context, /* JSClassRef */0, /* privData */0); + JSRetainPtr<JSStringRef> jsNameCopy(Adopt, WKStringCopyJSString(wkEntryName)); + JSValueRef jsEntryName = JSValueMakeString(context, jsNameCopy.get()); + JSObjectSetProperty(context, jsItemObject, jsPropertyName.get(), jsEntryName, kJSPropertyAttributeReadOnly, 0); + jsValuesArray[i] = jsItemObject; + } + + return JSObjectMakeArray(context, entriesSize, jsValuesArray.get(), 0); +#else + return JSValueMakeUndefined(context); +#endif +} + #ifdef USE_WEBPROCESS_EVENT_SIMULATION void EventSendingController::updateClickCount(WKEventMouseButton button) { diff --git a/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h b/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h index 413b91cd1..69c54f926 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h +++ b/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h @@ -52,6 +52,7 @@ public: void mouseMoveTo(int x, int y); void mouseScrollBy(int x, int y); void continuousMouseScrollBy(int x, int y, bool paged); + JSValueRef contextClick(); void leapForward(int milliseconds); void scheduleAsynchronousClick(); diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp index 0684d6df2..fa7939d3e 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp @@ -256,6 +256,7 @@ void InjectedBundle::beginTesting(WKDictionaryRef settings) WKBundleSetAlwaysAcceptCookies(m_bundle, false); WKBundleSetSerialLoadingEnabled(m_bundle, false); WKBundleSetShadowDOMEnabled(m_bundle, true); + WKBundleSetCacheModel(m_bundle, 1 /*CacheModelDocumentBrowser*/); WKBundleRemoveAllUserContent(m_bundle, m_pageGroup); diff --git a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp index a294da7d4..10fccc23e 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp @@ -755,6 +755,11 @@ void TestRunner::dispatchPendingLoadRequests() WKBundleDispatchPendingLoadRequests(InjectedBundle::shared().bundle()); } +void TestRunner::setCacheModel(int model) +{ + WKBundleSetCacheModel(InjectedBundle::shared().bundle(), model); +} + void TestRunner::grantWebNotificationPermission(JSStringRef origin) { WKRetainPtr<WKStringRef> originWK = toWK(origin); diff --git a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h index 48b922c49..3a974a989 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h +++ b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h @@ -112,6 +112,7 @@ public: void setTabKeyCyclesThroughElements(bool); void setSerializeHTTPLoads(); void dispatchPendingLoadRequests(); + void setCacheModel(int); // Special DOM functions. JSValueRef computedStyleIncludingVisitedInfo(JSValueRef element); diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp index 145c27087..0e47f3c24 100644 --- a/Tools/WebKitTestRunner/TestController.cpp +++ b/Tools/WebKitTestRunner/TestController.cpp @@ -109,6 +109,7 @@ TestController::TestController(int argc, const char* argv[]) TestController::~TestController() { + platformDestroy(); } static WKRect getWindowFrame(WKPageRef page, const void* clientInfo) diff --git a/Tools/WebKitTestRunner/TestController.h b/Tools/WebKitTestRunner/TestController.h index 56c3c4702..332e33b70 100644 --- a/Tools/WebKitTestRunner/TestController.h +++ b/Tools/WebKitTestRunner/TestController.h @@ -92,6 +92,7 @@ private: bool runTest(const char* pathOrURL); void platformInitialize(); + void platformDestroy(); void platformInitializeContext(); void platformRunUntil(bool& done, double timeout); void platformDidCommitLoadForFrame(WKPageRef, WKFrameRef); @@ -182,6 +183,11 @@ private: OwnPtr<EventSenderProxy> m_eventSenderProxy; #endif +#if PLATFORM(QT) + class RunLoop; + RunLoop* m_runLoop; +#endif + WorkQueueManager m_workQueueManager; }; diff --git a/Tools/WebKitTestRunner/efl/TestControllerEfl.cpp b/Tools/WebKitTestRunner/efl/TestControllerEfl.cpp index f68351d7b..6f514ff2e 100644 --- a/Tools/WebKitTestRunner/efl/TestControllerEfl.cpp +++ b/Tools/WebKitTestRunner/efl/TestControllerEfl.cpp @@ -57,6 +57,10 @@ void TestController::platformInitialize() } } +void TestController::platformDestroy() +{ +} + void TestController::platformRunUntil(bool& condition, double timeout) { if (timeout == m_noTimeout) { diff --git a/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp b/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp index 90bdb7279..4aeb65fc7 100644 --- a/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp +++ b/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp @@ -54,6 +54,10 @@ void TestController::platformInitialize() { } +void TestController::platformDestroy() +{ +} + static gboolean timeoutCallback(gpointer) { fprintf(stderr, "FAIL: TestControllerRunLoop timed out.\n"); diff --git a/Tools/WebKitTestRunner/mac/TestControllerMac.mm b/Tools/WebKitTestRunner/mac/TestControllerMac.mm index 3b68a0073..fbae25617 100644 --- a/Tools/WebKitTestRunner/mac/TestControllerMac.mm +++ b/Tools/WebKitTestRunner/mac/TestControllerMac.mm @@ -40,6 +40,10 @@ void TestController::platformInitialize() { } +void TestController::platformDestroy() +{ +} + void TestController::initializeInjectedBundlePath() { NSString *nsBundlePath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"WebKitTestRunnerInjectedBundle.bundle"]; diff --git a/Tools/WebKitTestRunner/qt/TestControllerQt.cpp b/Tools/WebKitTestRunner/qt/TestControllerQt.cpp index 04ddb8b76..9d3515c82 100644 --- a/Tools/WebKitTestRunner/qt/TestControllerQt.cpp +++ b/Tools/WebKitTestRunner/qt/TestControllerQt.cpp @@ -32,44 +32,106 @@ #include <cstdlib> #include <QCoreApplication> -#include <QElapsedTimer> #include <QEventLoop> #include <QFileInfo> #include <QLibrary> #include <QObject> -#include <qquickwebview_p.h> +#include <QTimer> #include <QtGlobal> +#include <qquickwebview_p.h> #include <wtf/Platform.h> #include <wtf/text/WTFString.h> namespace WTR { -void TestController::notifyDone() +class TestController::RunLoop : public QObject { + Q_OBJECT +public: + RunLoop(); + + void runUntil(double timeout); + void notifyDone(); + void runModal(PlatformWebView*); +public Q_SLOTS: + void timerFired(); +private: + QEventLoop m_runUntilLoop; + QEventLoop m_modalLoop; + QTimer m_runUntilLoopTimer; + bool m_runUntilLoopClosePending; +}; + +TestController::RunLoop::RunLoop() + : m_runUntilLoopClosePending(false) { + m_runUntilLoopTimer.setSingleShot(true); + QObject::connect(&m_runUntilLoopTimer, SIGNAL(timeout()), this, SLOT(timerFired())); } -void TestController::platformInitialize() +void TestController::RunLoop::runUntil(double timeout) { - QQuickWebView::platformInitialize(); + ASSERT(!m_runUntilLoop.isRunning()); + if (timeout) { + const int timeoutInMilliSecs = timeout * 1000; + m_runUntilLoopTimer.start(timeoutInMilliSecs); + } + m_runUntilLoop.exec(QEventLoop::ExcludeUserInputEvents); } -void TestController::platformRunUntil(bool& condition, double timeout) +void TestController::RunLoop::notifyDone() { - if (qgetenv("QT_WEBKIT2_DEBUG") == "1" || timeout == m_noTimeout) { - // Never timeout if we are debugging or not meant to timeout. - while (!condition) - QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents, 50); + if (m_modalLoop.isRunning()) { + // Wait for the modal loop first. We only kill it if we timeout. + m_runUntilLoopClosePending = true; return; } - int timeoutInMSecs = timeout * 1000; - QElapsedTimer timer; - timer.start(); - while (!condition) { - if (timer.elapsed() > timeoutInMSecs) - return; - QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents, timeoutInMSecs - timer.elapsed()); + m_runUntilLoopTimer.stop(); + m_runUntilLoop.exit(); +} + +void TestController::RunLoop::timerFired() +{ + if (m_modalLoop.isRunning()) { + m_runUntilLoopClosePending = true; + m_modalLoop.exit(); + return; } + + m_runUntilLoop.exit(); +} + +void TestController::RunLoop::runModal(PlatformWebView* view) +{ + ASSERT(!m_modalLoop.isRunning()); + view->setModalEventLoop(&m_modalLoop); + m_modalLoop.exec(QEventLoop::ExcludeUserInputEvents); + + if (m_runUntilLoopClosePending) + m_runUntilLoop.exit(); +} + +void TestController::notifyDone() +{ + m_runLoop->notifyDone(); +} + +void TestController::platformInitialize() +{ + m_runLoop = new RunLoop; + QQuickWebView::platformInitialize(); +} + +void TestController::platformDestroy() +{ + delete m_runLoop; +} + +void TestController::platformRunUntil(bool& condition, double timeout) +{ + UNUSED_PARAM(condition); + const bool shouldTimeout = !(qgetenv("QT_WEBKIT2_DEBUG") == "1" || timeout == m_noTimeout); + m_runLoop->runUntil(shouldTimeout ? timeout : 0); } static bool isExistingLibrary(const QString& path) @@ -113,9 +175,7 @@ void TestController::platformInitializeContext() void TestController::runModal(PlatformWebView* view) { - QEventLoop eventLoop; - view->setModalEventLoop(&eventLoop); - eventLoop.exec(QEventLoop::ExcludeUserInputEvents); + shared().m_runLoop->runModal(view); } const char* TestController::platformLibraryPathForTesting() @@ -124,3 +184,5 @@ const char* TestController::platformLibraryPathForTesting() } } // namespace WTR + +#include "TestControllerQt.moc" diff --git a/Tools/WebKitTestRunner/win/TestControllerWin.cpp b/Tools/WebKitTestRunner/win/TestControllerWin.cpp index ba4f753b4..8f2eaaf48 100644 --- a/Tools/WebKitTestRunner/win/TestControllerWin.cpp +++ b/Tools/WebKitTestRunner/win/TestControllerWin.cpp @@ -121,6 +121,10 @@ void TestController::platformInitialize() webProcessCrashingEvent = ::CreateEventA(0, FALSE, FALSE, webProcessCrashingEventName); } +void TestController::platformDestroy() +{ +} + void TestController::initializeInjectedBundlePath() { CFStringRef exeContainerPath = CFURLCopyFileSystemPath(CFURLCreateCopyDeletingLastPathComponent(0, CFBundleCopyExecutableURL(CFBundleGetMainBundle())), kCFURLWindowsPathStyle); diff --git a/Tools/qmake/mkspecs/features/default_post.prf b/Tools/qmake/mkspecs/features/default_post.prf index 4776d1d92..dc5e438c1 100644 --- a/Tools/qmake/mkspecs/features/default_post.prf +++ b/Tools/qmake/mkspecs/features/default_post.prf @@ -156,7 +156,7 @@ contains(TEMPLATE, lib) { DEFINES += BUILDING_$${TARGET} # Triggers the right export macro for the QtWebKit API (see qwebkitglobal.h) - DEFINES += BUILDING_WEBKIT + !contains(QT, webkitwidgets): DEFINES += BUILDING_WEBKIT # Prevent name clashes when building both debug and release. Qt5's module # system already takes care of this for the top level QtWebKit library. @@ -177,7 +177,7 @@ contains(QT, webkitwidgets) { # need to link to any intermediate shared libraries. force_static_libs_as_shared { WEBKIT += wtf javascriptcore webcore - build?(webkit1): WEBKIT += webkit1 + build?(webkit1): WEBKIT += webkitwidgets webkit1 build?(webkit2): WEBKIT += webkit2 } diff --git a/Tools/qmake/mkspecs/features/production_build.prf b/Tools/qmake/mkspecs/features/production_build.prf index b3f36abb4..c980d09d0 100644 --- a/Tools/qmake/mkspecs/features/production_build.prf +++ b/Tools/qmake/mkspecs/features/production_build.prf @@ -8,7 +8,7 @@ CONFIG *= use_all_in_one_files # by compiling any static library like WTF or JSC with release flags instead and keep debug # symbols for the static libraries that implement API. linux-*|win32-g++*:if(CONFIG(debug, debug|release)|contains(QT_CONFIG,separate_debug_info)):contains(TEMPLATE, lib):staticlib { - !equals(TARGET, WebKit2):!equals(TARGET, WebKit1) { + !equals(TARGET, WebKit2):!equals(TARGET, WebKitWidgets) { CONFIG += no_debug_info CONFIG -= separate_debug_info QMAKE_CFLAGS += $$QMAKE_CFLAGS_RELEASE diff --git a/Tools/qmake/mkspecs/features/webkit_modules.prf b/Tools/qmake/mkspecs/features/webkit_modules.prf index b2f335364..505b82658 100644 --- a/Tools/qmake/mkspecs/features/webkit_modules.prf +++ b/Tools/qmake/mkspecs/features/webkit_modules.prf @@ -7,7 +7,7 @@ # Reorder libraries so that the link and include order is correct, # and make sure the case matches the original case. -libraries = WebKit1 WebKit2 WebCore ANGLE JavaScriptCore WTF +libraries = WebKitWidgets WebKit1 WebKit2 WebCore ANGLE JavaScriptCore WTF for(library, libraries) { contains(WEBKIT, $$lower($$library)) { WEBKIT -= $$lower($$library) diff --git a/Tools/qmake/mkspecs/features/win32/default_post.prf b/Tools/qmake/mkspecs/features/win32/default_post.prf index 93861ef0a..acf2e861b 100644 --- a/Tools/qmake/mkspecs/features/win32/default_post.prf +++ b/Tools/qmake/mkspecs/features/win32/default_post.prf @@ -39,5 +39,3 @@ shared:contains(TEMPLATE, lib) { GENERATED_SOURCES += $$forwarded_exports.target } -# To ensure the Qt export macros are set to dllexport -contains(TEMPLATE, lib):!contains(QT, webkitwidgets): DEFINES += QT_MAKEDLL diff --git a/Tools/qmake/mkspecs/modules/webkitwidgets.prf b/Tools/qmake/mkspecs/modules/webkitwidgets.prf new file mode 100644 index 000000000..ca1643c8d --- /dev/null +++ b/Tools/qmake/mkspecs/modules/webkitwidgets.prf @@ -0,0 +1,9 @@ +# ------------------------------------------------------------------- +# Module file for WebKitWidget, used by targets that depend on WebKitWidget +# +# See 'Tools/qmake/README' for an overview of the build system +# ------------------------------------------------------------------- + +WEBKIT.webkitwidgets.root_source_dir = $${ROOT_WEBKIT_DIR}/Source/WebKit + +include($${WEBKIT.webkitwidgets.root_source_dir}/WebKitWidgets.pri) |