WebKitTestRunner needs testRunner.queueLoad

https://bugs.webkit.org/show_bug.cgi?id=42674

Patch by Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> on 2012-10-17
Reviewed by Kenneth Rohde Christiansen.

Tools:

Added testRunner.queueLoad() and testRunner.queueBackNavigation() implementation to WTR including
Work Queue implementation. Work Queue is managed by WorkQueueManager which belongs to UI process
(as the needed functionality, like loading initiation, has to be invoked from UI process) and
exchanges messages with Injected bundle.

* WebKitTestRunner/CMakeLists.txt:
* WebKitTestRunner/GNUmakefile.am:
* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::InjectedBundle):
(WTR::InjectedBundle::didReceiveMessage):
(WTR::InjectedBundle::done):
(WTR::InjectedBundle::shouldProcessWorkQueue):
(WTR):
(WTR::InjectedBundle::processWorkQueue):
(WTR::InjectedBundle::queueBackNavigation):
(WTR::InjectedBundle::queueLoad):
* WebKitTestRunner/InjectedBundle/InjectedBundle.h:
(InjectedBundle):
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame):
(WTR::InjectedBundlePage::didFinishLoadForFrame):
(WTR::InjectedBundlePage::didFailLoadWithErrorForFrame):
(WTR::InjectedBundlePage::locationChangeForFrame):
(WTR):
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
(InjectedBundlePage):
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::queueBackNavigation):
(WTR):
(WTR::TestRunner::queueLoad):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
(TestRunner):
* WebKitTestRunner/Target.pri:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetStateToConsistentValues):
* WebKitTestRunner/TestController.h:
(WTR::TestController::workQueueManager):
(TestController):
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
* WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
* WebKitTestRunner/WorkQueueManager.cpp: Added.
(WTR):
(WTR::mainPage):
(WTR::goToItemAtIndex):
(WTR::WorkQueueManager::WorkQueueManager):
(WTR::WorkQueueManager::clearWorkQueue):
(WTR::WorkQueueManager::processWorkQueue):
(WTR::WorkQueueManager::queueLoad):
(WTR::WorkQueueManager::queueBackNavigation):
(WTR::WorkQueueManager::enqueue):
* WebKitTestRunner/WorkQueueManager.h: Added.
(WTR):
(WorkQueueManager):
(WTR::WorkQueueManager::isWorkQueueEmpty):
(WorkQueueItem):
(WTR::WorkQueueManager::WorkQueueItem::~WorkQueueItem):
* WebKitTestRunner/win/WebKitTestRunner.vcproj:

LayoutTests:

Unskipped corresponding tests for WK2 and WK2 EFL, put those which still failing to appropriate groups.

* platform/efl-wk2/TestExpectations:
* platform/wk2/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131560 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 5a03090a
2012-10-17 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com>
WebKitTestRunner needs testRunner.queueLoad
https://bugs.webkit.org/show_bug.cgi?id=42674
Reviewed by Kenneth Rohde Christiansen.
Unskipped corresponding tests for WK2 and WK2 EFL, put those which still failing to appropriate groups.
* platform/efl-wk2/TestExpectations:
* platform/wk2/TestExpectations:
2012-10-17 Douglas Stockwell <dstockwell@chromium.org>
Content of replaced elements should be trimmed to the content edge curve.
......
......@@ -172,11 +172,8 @@ webkit.org/b/72698 media/audio-garbage-collect.html
# FAILING TESTS
#////////////////////////////////////////////////////////////////////////////////////////
# WebKitTestRunner needs an implementation for testRunner.queueLoad
webkit.org/b/42674 fast/dom/navigation-type-back-forward.html [ Failure ]
webkit.org/b/42674 fast/dom/navigation-type-navigate.html [ Failure ]
# WebKitTestRunner needs an implementation for testRunner.queueReload
webkit.org/b/42674 fast/dom/navigation-type-reload.html [ Failure ]
webkit.org/b/42674 http/tests/navigation/response204.html [ Failure ]
# WebKitTestRunner needs an implementation for testRunner.titleTextDirection
webkit.org/b/93470 fast/dom/title-directionality-removeChild.html [ Failure ]
......
......@@ -292,7 +292,7 @@ svg/custom/manually-parsed-embedded-svg-allowed-in-dashboard.html
svg/custom/manually-parsed-svg-allowed-in-dashboard.html
svg/custom/svg-allowed-in-dashboard-object.html
# WebKitTestRunner needs layoutTestController.queueReload
# WebKitTestRunner needs testRunner.queueReload
# <https://bugs.webkit.org/show_bug.cgi?id=42672>
fast/css/compare-content-style.html
fast/frames/frame-display-none-focus.html
......@@ -300,68 +300,38 @@ fast/loader/display-image-unset-can-block-image-and-can-reload-in-place.html
fast/loader/images-enabled-unset-can-block-image-and-can-reload-in-place.html
fast/loader/reload-policy-delegate.html
http/tests/navigation/fallback-anchor-reload.html
http/tests/navigation/reload-subframe-frame.html
http/tests/navigation/reload-subframe-iframe.html
http/tests/navigation/reload-subframe-object.html
# WebKitTestRunner needs layoutTestController.queueLoad
# <https://bugs.webkit.org/show_bug.cgi?id=42674>
http/tests/navigation/back-twice-without-commit.html
http/tests/xmlhttprequest/basic-auth-nopassword.html
http/tests/xmlhttprequest/basic-auth-nouser.html
http/tests/navigation/forward-and-cancel.html
fast/frames/frame-navigation.html
fast/history/go-back-to-changed-name.html
http/tests/navigation/anchor-basic.html
# WebKitTestRunner needs testRunner.queueNonLoadingScript
# <https://bugs.webkit.org/show_bug.cgi?id=98141>
http/tests/navigation/anchor-goback.html
http/tests/navigation/anchor-subframeload.html
http/tests/navigation/back-to-slow-frame.html
http/tests/navigation/error404-basic.html
http/tests/navigation/error404-goback.html
http/tests/navigation/error404-subframeload.html
http/tests/navigation/javascriptlink-basic.html
http/tests/navigation/javascriptlink-frames.html
http/tests/navigation/javascriptlink-goback.html
http/tests/navigation/javascriptlink-subframeload.html
http/tests/navigation/metaredirect-basic.html
http/tests/navigation/metaredirect-frames.html
http/tests/navigation/metaredirect-goback.html
http/tests/navigation/metaredirect-subframeload.html
http/tests/navigation/post-goback-same-url.html
http/tests/navigation/post-goback2.html
http/tests/navigation/postredirect-basic.html
http/tests/navigation/postredirect-frames.html
http/tests/navigation/postredirect-goback1.html
http/tests/navigation/postredirect-goback2.html
http/tests/navigation/postredirect-reload.html
http/tests/navigation/redirect-cycle.html
http/tests/navigation/redirect302-basic.html
http/tests/navigation/redirect302-frames.html
http/tests/navigation/redirect302-goback.html
http/tests/navigation/redirect302-metaredirect.html
http/tests/navigation/redirect302-subframeload.html
http/tests/navigation/relativeanchor-basic.html
http/tests/navigation/relativeanchor-frames.html
http/tests/navigation/relativeanchor-goback.html
http/tests/navigation/reload-subframe-frame.html
http/tests/navigation/reload-subframe-iframe.html
http/tests/navigation/reload-subframe-object.html
http/tests/navigation/response204.html
http/tests/navigation/restore-form-state-https.html
http/tests/navigation/slowmetaredirect-basic.html
http/tests/navigation/slowtimerredirect-basic.html
http/tests/navigation/success200-basic.html
http/tests/navigation/success200-frames-loadsame.html
http/tests/navigation/success200-frames.html
http/tests/navigation/success200-goback.html
http/tests/navigation/success200-loadsame.html
http/tests/navigation/success200-reload.html
http/tests/navigation/success200-subframeload.html
http/tests/navigation/timerredirect-basic.html
http/tests/navigation/timerredirect-frames.html
http/tests/navigation/timerredirect-goback.html
http/tests/navigation/timerredirect-subframeload.html
# WebKitTestRunner needs layoutTestController.queueLoadingScript
# WebKitTestRunner needs testRunner.queueLoadingScript
# <https://bugs.webkit.org/show_bug.cgi?id=42675>
http/tests/cache/subresource-failover-to-network.html
http/tests/navigation/forward-and-cancel.html
http/tests/navigation/post-goback-same-url.html
http/tests/navigation/postredirect-reload.html
# WebKitTestRunner needs layoutTestController.setCacheModel
# <https://bugs.webkit.org/show_bug.cgi?id=42684>
......@@ -552,6 +522,8 @@ http/tests/loading/authentication-after-redirect-stores-wrong-credentials/authen
http/tests/loading/basic-auth-resend-wrong-credentials.html
http/tests/loading/basic-credentials-sent-automatically.html
http/tests/security/401-logout/401-logout.php
http/tests/xmlhttprequest/basic-auth-nopassword.html
http/tests/xmlhttprequest/basic-auth-nouser.html
http/tests/xmlhttprequest/remember-bad-password.html
http/tests/xmlhttprequest/failed-auth.html
http/tests/misc/401-alternative-content.php
......@@ -774,6 +746,17 @@ http/tests/download/inherited-encoding.html
# WebFrameLoaderClient::canHandleRequest() has to be implemented.
http/tests/misc/redirect-to-external-url.html
# testRunner.queueLoad should consider given target.
fast/frames/frame-navigation.html
http/tests/navigation/anchor-subframeload.html
http/tests/navigation/error404-subframeload.html
http/tests/navigation/javascriptlink-subframeload.html
http/tests/navigation/metaredirect-subframeload.html
http/tests/navigation/redirect302-subframeload.html
http/tests/navigation/response204.html
http/tests/navigation/success200-subframeload.html
http/tests/navigation/timerredirect-subframeload.html
### END OF (2) Classified failures without bug reports (yet)
########################################
......
2012-10-17 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com>
WebKitTestRunner needs testRunner.queueLoad
https://bugs.webkit.org/show_bug.cgi?id=42674
Reviewed by Kenneth Rohde Christiansen.
Added testRunner.queueLoad() and testRunner.queueBackNavigation() implementation to WTR including
Work Queue implementation. Work Queue is managed by WorkQueueManager which belongs to UI process
(as the needed functionality, like loading initiation, has to be invoked from UI process) and
exchanges messages with Injected bundle.
* WebKitTestRunner/CMakeLists.txt:
* WebKitTestRunner/GNUmakefile.am:
* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::InjectedBundle):
(WTR::InjectedBundle::didReceiveMessage):
(WTR::InjectedBundle::done):
(WTR::InjectedBundle::shouldProcessWorkQueue):
(WTR):
(WTR::InjectedBundle::processWorkQueue):
(WTR::InjectedBundle::queueBackNavigation):
(WTR::InjectedBundle::queueLoad):
* WebKitTestRunner/InjectedBundle/InjectedBundle.h:
(InjectedBundle):
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame):
(WTR::InjectedBundlePage::didFinishLoadForFrame):
(WTR::InjectedBundlePage::didFailLoadWithErrorForFrame):
(WTR::InjectedBundlePage::locationChangeForFrame):
(WTR):
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
(InjectedBundlePage):
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::queueBackNavigation):
(WTR):
(WTR::TestRunner::queueLoad):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
(TestRunner):
* WebKitTestRunner/Target.pri:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetStateToConsistentValues):
* WebKitTestRunner/TestController.h:
(WTR::TestController::workQueueManager):
(TestController):
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
* WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
* WebKitTestRunner/WorkQueueManager.cpp: Added.
(WTR):
(WTR::mainPage):
(WTR::goToItemAtIndex):
(WTR::WorkQueueManager::WorkQueueManager):
(WTR::WorkQueueManager::clearWorkQueue):
(WTR::WorkQueueManager::processWorkQueue):
(WTR::WorkQueueManager::queueLoad):
(WTR::WorkQueueManager::queueBackNavigation):
(WTR::WorkQueueManager::enqueue):
* WebKitTestRunner/WorkQueueManager.h: Added.
(WTR):
(WorkQueueManager):
(WTR::WorkQueueManager::isWorkQueueEmpty):
(WorkQueueItem):
(WTR::WorkQueueManager::WorkQueueItem::~WorkQueueItem):
* WebKitTestRunner/win/WebKitTestRunner.vcproj:
2012-10-16 Andy Estes <aestes@apple.com>
[WebKit2] Create Objective-C API for adding and removing user scripts
......
......@@ -10,6 +10,7 @@ SET(WebKitTestRunner_SOURCES
${WEBKIT_TESTRUNNER_DIR}/TestController.cpp
${WEBKIT_TESTRUNNER_DIR}/TestInvocation.cpp
${WEBKIT_TESTRUNNER_DIR}/WebNotificationProvider.cpp
${WEBKIT_TESTRUNNER_DIR}/WorkQueueManager.cpp
)
SET(WebKitTestRunner_LIBRARIES
......
......@@ -31,7 +31,9 @@ Programs_WebKitTestRunner_SOURCES = \
Tools/WebKitTestRunner/TestInvocation.h \
Tools/WebKitTestRunner/WebNotificationProvider.cpp \
Tools/WebKitTestRunner/WebNotificationProvider.h \
Tools/WebKitTestRunner/WebKitTestRunnerPrefix.h
Tools/WebKitTestRunner/WebKitTestRunnerPrefix.h \
Tools/WebKitTestRunner/WorkQueueManager.cpp \
Tools/WebKitTestRunner/WorkQueueManager.h
Programs_WebKitTestRunner_CPPFLAGS = \
-include Tools/WebKitTestRunner/WebKitTestRunnerPrefix.h \
......
......@@ -181,5 +181,9 @@ interface TestRunner {
void setMockGeolocationPositionUnavailableError(in DOMString errorMessage);
boolean callShouldCloseOnWebView();
// Work queue.
void queueBackNavigation(in unsigned long howFarBackward);
void queueLoad(in DOMString url, in DOMString target);
};
......@@ -54,6 +54,7 @@ InjectedBundle::InjectedBundle()
, m_state(Idle)
, m_dumpPixels(false)
, m_useWaitToDumpWatchdogTimer(true)
, m_useWorkQueue(false)
{
}
......@@ -190,6 +191,11 @@ void InjectedBundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messag
if (WKStringIsEqualToUTF8CString(messageName, "CallSetBackingScaleFactorCallback")) {
m_testRunner->callSetBackingScaleFactorCallback();
return;
}
if (WKStringIsEqualToUTF8CString(messageName, "WorkQueueProcessedCallback")) {
if (!topLoadingFrame() && !m_testRunner->waitToDump())
page()->dump();
return;
}
WKRetainPtr<WKStringRef> errorMessageName(AdoptWK, WKStringCreateWithUTF8CString("Error"));
......@@ -272,6 +278,8 @@ void InjectedBundle::done()
{
m_state = Stopping;
m_useWorkQueue = false;
page()->stopLoading();
setTopLoadingFrame(0);
......@@ -446,4 +454,49 @@ void InjectedBundle::setCustomPolicyDelegate(bool enabled, bool permissive)
WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
}
bool InjectedBundle::shouldProcessWorkQueue() const
{
if (!m_useWorkQueue)
return false;
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("IsWorkQueueEmpty"));
WKTypeRef resultToPass = 0;
WKBundlePostSynchronousMessage(m_bundle, messageName.get(), 0, &resultToPass);
WKRetainPtr<WKBooleanRef> isEmpty(AdoptWK, static_cast<WKBooleanRef>(resultToPass));
return !WKBooleanGetValue(isEmpty.get());
}
void InjectedBundle::processWorkQueue()
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("ProcessWorkQueue"));
WKBundlePostMessage(m_bundle, messageName.get(), 0);
}
void InjectedBundle::queueBackNavigation(unsigned howFarBackward)
{
m_useWorkQueue = true;
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("QueueBackNavigation"));
WKRetainPtr<WKUInt64Ref> messageBody(AdoptWK, WKUInt64Create(howFarBackward));
WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
}
void InjectedBundle::queueLoad(WKStringRef url, WKStringRef target)
{
m_useWorkQueue = true;
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("QueueLoad"));
WKRetainPtr<WKMutableDictionaryRef> loadData(AdoptWK, WKMutableDictionaryCreate());
WKRetainPtr<WKStringRef> urlKey(AdoptWK, WKStringCreateWithUTF8CString("url"));
WKDictionaryAddItem(loadData.get(), urlKey.get(), url);
WKRetainPtr<WKStringRef> targetKey(AdoptWK, WKStringCreateWithUTF8CString("target"));
WKDictionaryAddItem(loadData.get(), targetKey.get(), target);
WKBundlePostMessage(m_bundle, messageName.get(), loadData.get());
}
} // namespace WTR
......@@ -98,6 +98,12 @@ public:
// Policy delegate.
void setCustomPolicyDelegate(bool enabled, bool permissive);
// Work queue.
bool shouldProcessWorkQueue() const;
void processWorkQueue();
void queueBackNavigation(unsigned howFarBackward);
void queueLoad(WKStringRef url, WKStringRef target);
private:
InjectedBundle();
~InjectedBundle();
......@@ -144,6 +150,7 @@ private:
bool m_dumpPixels;
bool m_useWaitToDumpWatchdogTimer;
bool m_useWorkQueue;
WKRetainPtr<WKImageRef> m_pixelResult;
WKRetainPtr<WKArrayRef> m_repaintRects;
......
......@@ -772,7 +772,7 @@ void InjectedBundlePage::didReceiveServerRedirectForProvisionalLoadForFrame(WKBu
InjectedBundle::shared().stringBuilder()->appendLiteral(" - didReceiveServerRedirectForProvisionalLoadForFrame\n");
}
void InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame(WKBundleFrameRef frame, WKErrorRef error)
void InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame(WKBundleFrameRef frame, WKErrorRef)
{
if (!InjectedBundle::shared().isTestRunning())
return;
......@@ -782,14 +782,7 @@ void InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame(WKBundleFrameRe
InjectedBundle::shared().stringBuilder()->appendLiteral(" - didFailProvisionalLoadWithError\n");
}
if (frame != InjectedBundle::shared().topLoadingFrame())
return;
InjectedBundle::shared().setTopLoadingFrame(0);
if (InjectedBundle::shared().testRunner()->waitToDump())
return;
InjectedBundle::shared().done();
frameDidChangeLocation(frame);
}
void InjectedBundlePage::didCommitLoadForFrame(WKBundleFrameRef frame)
......@@ -973,14 +966,7 @@ void InjectedBundlePage::didFinishLoadForFrame(WKBundleFrameRef frame)
InjectedBundle::shared().stringBuilder()->appendLiteral(" - didFinishLoadForFrame\n");
}
if (frame != InjectedBundle::shared().topLoadingFrame())
return;
InjectedBundle::shared().setTopLoadingFrame(0);
if (InjectedBundle::shared().testRunner()->waitToDump())
return;
InjectedBundle::shared().page()->dump();
frameDidChangeLocation(frame, /*shouldDump*/ true);
}
void InjectedBundlePage::didFailLoadWithErrorForFrame(WKBundleFrameRef frame, WKErrorRef)
......@@ -993,14 +979,7 @@ void InjectedBundlePage::didFailLoadWithErrorForFrame(WKBundleFrameRef frame, WK
InjectedBundle::shared().stringBuilder()->appendLiteral(" - didFailLoadWithError\n");
}
if (frame != InjectedBundle::shared().topLoadingFrame())
return;
InjectedBundle::shared().setTopLoadingFrame(0);
if (InjectedBundle::shared().testRunner()->waitToDump())
return;
InjectedBundle::shared().done();
frameDidChangeLocation(frame);
}
void InjectedBundlePage::didReceiveTitleForFrame(WKStringRef title, WKBundleFrameRef frame)
......@@ -1889,4 +1868,25 @@ void InjectedBundlePage::platformDidStartProvisionalLoadForFrame(WKBundleFrameRe
}
#endif
void InjectedBundlePage::frameDidChangeLocation(WKBundleFrameRef frame, bool shouldDump)
{
if (frame != InjectedBundle::shared().topLoadingFrame())
return;
InjectedBundle::shared().setTopLoadingFrame(0);
if (InjectedBundle::shared().testRunner()->waitToDump())
return;
if (InjectedBundle::shared().shouldProcessWorkQueue()) {
InjectedBundle::shared().processWorkQueue();
return;
}
if (shouldDump)
InjectedBundle::shared().page()->dump();
else
InjectedBundle::shared().done();
}
} // namespace WTR
......@@ -174,6 +174,8 @@ private:
void platformDidStartProvisionalLoadForFrame(WKBundleFrameRef);
void frameDidChangeLocation(WKBundleFrameRef, bool shouldDump = false);
WKBundlePageRef m_page;
WKRetainPtr<WKBundleScriptWorldRef> m_world;
WKRetainPtr<WKBundleBackForwardListItemRef> m_previousTestBackForwardListItem;
......
......@@ -48,6 +48,7 @@
#include <wtf/HashMap.h>
#include <wtf/OwnArrayPtr.h>
#include <wtf/PassOwnArrayPtr.h>
#include <wtf/text/CString.h>
#include <wtf/text/StringBuilder.h>
#if ENABLE(WEB_INTENTS)
......@@ -832,4 +833,18 @@ bool TestRunner::callShouldCloseOnWebView()
return WKBundleFrameCallShouldCloseOnWebView(mainFrame);
}
void TestRunner::queueBackNavigation(unsigned howFarBackward)
{
InjectedBundle::shared().queueBackNavigation(howFarBackward);
}
void TestRunner::queueLoad(JSStringRef url, JSStringRef target)
{
WKRetainPtr<WKURLRef> baseURLWK(AdoptWK, WKBundleFrameCopyURL(WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page())));
WKRetainPtr<WKURLRef> urlWK(AdoptWK, WKURLCreateWithBaseURL(baseURLWK.get(), toWTFString(toWK(url)).utf8().data()));
WKRetainPtr<WKStringRef> urlStringWK(AdoptWK, WKURLCopyString(urlWK.get()));
InjectedBundle::shared().queueLoad(urlStringWK.get(), toWK(target).get());
}
} // namespace WTR
......@@ -261,6 +261,9 @@ public:
bool callShouldCloseOnWebView();
void queueBackNavigation(unsigned howFarBackward);
void queueLoad(JSStringRef url, JSStringRef target);
private:
static const double waitToDumpWatchdogTimerInterval;
......
......@@ -15,7 +15,8 @@ HEADERS += \
StringFunctions.h \
TestController.h \
TestInvocation.h \
WebNotificationProvider.h
WebNotificationProvider.h \
WorkQueueManager.h
SOURCES += \
$${ROOT_WEBKIT_DIR}/Tools/DumpRenderTree/qt/QtInitializeTestFonts.cpp \
......@@ -27,7 +28,8 @@ SOURCES += \
GeolocationProviderMock.cpp \
TestController.cpp \
TestInvocation.cpp \
WebNotificationProvider.cpp
WebNotificationProvider.cpp \
WorkQueueManager.cpp
DESTDIR = $${ROOT_BUILD_DIR}/bin
......
......@@ -530,6 +530,8 @@ bool TestController::resetStateToConsistentValues()
// Reset Custom Policy Delegate.
setCustomPolicyDelegate(false, false);
m_workQueueManager.clearWorkQueue();
// Reset main page back to about:blank
m_doneResetting = false;
......
......@@ -27,6 +27,7 @@
#define TestController_h
#include "WebNotificationProvider.h"
#include "WorkQueueManager.h"
#include <GeolocationProviderMock.h>
#include <WebKit2/WKRetainPtr.h>
#include <string>
......@@ -78,6 +79,8 @@ public:
bool resetStateToConsistentValues();
WorkQueueManager& workQueueManager() { return m_workQueueManager; }
private:
void initialize(int argc, const char* argv[]);
void run();
......@@ -172,6 +175,8 @@ private:
bool m_policyDelegatePermissive;
EventSenderProxy* m_eventSenderProxy;
WorkQueueManager m_workQueueManager;
};
} // namespace WTR
......
......@@ -430,6 +430,35 @@ void TestInvocation::didReceiveMessageFromInjectedBundle(WKStringRef messageName
return;
}
if (WKStringIsEqualToUTF8CString(messageName, "ProcessWorkQueue")) {
if (TestController::shared().workQueueManager().processWorkQueue()) {
WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("WorkQueueProcessedCallback"));
WKContextPostMessageToInjectedBundle(TestController::shared().context(), messageName.get(), 0);
}
return;
}
if (WKStringIsEqualToUTF8CString(messageName, "QueueBackNavigation")) {
ASSERT(WKGetTypeID(messageBody) == WKUInt64GetTypeID());
uint64_t stepCount = WKUInt64GetValue(static_cast<WKUInt64Ref>(messageBody));
TestController::shared().workQueueManager().queueBackNavigation(stepCount);
return;
}
if (WKStringIsEqualToUTF8CString(messageName, "QueueLoad")) {
ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
WKDictionaryRef loadDataDictionary = static_cast<WKDictionaryRef>(messageBody);
WKRetainPtr<WKStringRef> urlKey(AdoptWK, WKStringCreateWithUTF8CString("url"));
WKStringRef urlWK = static_cast<WKStringRef>(WKDictionaryGetItemForKey(loadDataDictionary, urlKey.get()));
WKRetainPtr<WKStringRef> targetKey(AdoptWK, WKStringCreateWithUTF8CString("target"));
WKStringRef targetWK = static_cast<WKStringRef>(WKDictionaryGetItemForKey(loadDataDictionary, targetKey.get()));
TestController::shared().workQueueManager().queueLoad(toWTFString(urlWK), toWTFString(targetWK));
return;
}
ASSERT_NOT_REACHED();
}
......@@ -442,6 +471,12 @@ WKRetainPtr<WKTypeRef> TestInvocation::didReceiveSynchronousMessageFromInjectedB
return 0;
}
if (WKStringIsEqualToUTF8CString(messageName, "IsWorkQueueEmpty")) {
bool isEmpty = TestController::shared().workQueueManager().isWorkQueueEmpty();
WKRetainPtr<WKTypeRef> result(AdoptWK, WKBooleanCreate(isEmpty));
return result;
}
ASSERT_NOT_REACHED();
return 0;
}
......
......@@ -30,7 +30,7 @@
29210EB4144CACD500835BB5 /* AccessibilityTextMarker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29210EB1144CACD400835BB5 /* AccessibilityTextMarker.cpp */; };
29210EB5144CACD500835BB5 /* AccessibilityTextMarkerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29210EB3144CACD400835BB5 /* AccessibilityTextMarkerMac.mm */; };
29210EDA144CC3EA00835BB5 /* AccessibilityUIElementMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29210EAB144CACB200835BB5 /* AccessibilityUIElementMac.mm */; };
29210EDA144CC3EA00835BB6 /* AccessibilityCommonMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29210EAB144CACB200835BB6 /* AccessibilityUIElementMac.mm */; };
29210EDA144CC3EA00835BB6 /* AccessibilityCommonMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29210EAB144CACB200835BB6 /* AccessibilityCommonMac.mm */; };
29210EDB144CD47900835BB5 /* JSAccessibilityController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 583913D014335E95008307E5 /* JSAccessibilityController.cpp */; };
29210EE1144CDB2600835BB5 /* JSAccessibilityUIElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29210EDB146727E711835BB5 /* JSAccessibilityUIElement.cpp */; };
29A8FCCB145EF02E009045A6 /* JSAccessibilityTextMarker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29210EE1144CDE6789815EE5 /* JSAccessibilityTextMarker.cpp */; };
......@@ -38,6 +38,7 @@
29A8FCE2145F037B009045A6 /* AccessibilityTextMarkerRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29A8FCE1145F037B009045A6 /* AccessibilityTextMarkerRange.cpp */; };
29A8FCE5145F0464009045A6 /* AccessibilityTextMarkerRangeMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29A8FCE4145F0464009045A6 /* AccessibilityTextMarkerRangeMac.mm */; };
3164C8F015D1ADA100EF1FE0 /* WebNotificationProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3164C8EF15D1ADA100EF1FE0 /* WebNotificationProvider.cpp */; };
4429FC5F1627089600F66D8B /* WorkQueueManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4429FC5E1627089600F66D8B /* WorkQueueManager.cpp */; };
5322FB4313FDA0CD0041ABCC /* CyclicRedundancyCheck.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5322FB4113FDA0CD0041ABCC /* CyclicRedundancyCheck.cpp */; };
5322FB4613FDA0EA0041ABCC /* PixelDumpSupport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5322FB4413FDA0EA0041ABCC /* PixelDumpSupport.cpp */; };
5641E2D014335E95008307E5 /* JSTextInputController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5641E2CE14335E95008307E5 /* JSTextInputController.cpp */; };
......@@ -133,6 +134,8 @@
378D442213346D00006A777B /* config.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; };
41230E16138C78BF00BCCFCA /* libWebCoreTestSupport.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libWebCoreTestSupport.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
4181731B138AD39D0057AAA4 /* WebCoreTestSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebCoreTestSupport.h; path = WebCoreTestSupport/WebCoreTestSupport.h; sourceTree = BUILT_PRODUCTS_DIR; };
4429FC5E1627089600F66D8B /* WorkQueueManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkQueueManager.cpp; sourceTree = "<group>"; };
4429FC611627089600F66D8B /* WorkQueueManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkQueueManager.h; sourceTree = "<group>"; };
5322FB4113FDA0CD0041ABCC /* CyclicRedundancyCheck.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CyclicRedundancyCheck.cpp; sourceTree = "<group>"; };
5322FB4213FDA0CD0041ABCC /* CyclicRedundancyCheck.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CyclicRedundancyCheck.h; sourceTree = "<group>"; };
5322FB4413FDA0EA0041ABCC /* PixelDumpSupport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PixelDumpSupport.cpp; sourceTree = "<group>"; };
......@@ -274,6 +277,8 @@
BC251A1711D16774002EBC01 /* WebKitTestRunnerPrefix.h */,
3110BE0F15BA011400D216AC /* WebNotificationProvider.h */,
3164C8EF15D1ADA100EF1FE0 /* WebNotificationProvider.cpp */,
4429FC611627089600F66D8B /* WorkQueueManager.h */,
4429FC5E1627089600F66D8B /* WorkQueueManager.cpp */,
);
name = TestRunner;
sourceTree = "<group>";
......@@ -585,6 +590,7 @@
BC9192051333E4F8003011DC /* TestInvocationCG.cpp in Sources */,
5670B8281386FCA5002EB355 /* EventSenderProxy.mm in Sources */,
3164C8F015D1ADA100EF1FE0 /* WebNotificationProvider.cpp in Sources */,
4429FC5F1627089600F66D8B /* WorkQueueManager.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......