[WK2] [WTR] WebKitTestRunner needs testRunner.queueForwardNavigation
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Oct 2012 12:12:50 +0000 (12:12 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Oct 2012 12:12:50 +0000 (12:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=99700

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

Tools:

Implemented testRunner.queueForwardNavigation, made little refactoring in Work Queue
to obviate code duplication.

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::queueBackNavigation):
(WTR):
(WTR::InjectedBundle::queueForwardNavigation):
* WebKitTestRunner/InjectedBundle/InjectedBundle.h:
(InjectedBundle):
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::queueForwardNavigation):
(WTR):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
(TestRunner):
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
* WebKitTestRunner/WorkQueueManager.cpp:
(NavigationItem):
(WTR::NavigationItem::NavigationItem):
(WTR::NavigationItem::invoke):
(WTR):
(WTR::WorkQueueManager::queueBackNavigation):
(WTR::WorkQueueManager::queueForwardNavigation):
* WebKitTestRunner/WorkQueueManager.h:
(WorkQueueManager):

LayoutTests:

Unskipped http/tests/cache/subresource-failover-to-network.html for WK2 ports.

* platform/wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@132206 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/wk2/TestExpectations
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
Tools/WebKitTestRunner/TestInvocation.cpp
Tools/WebKitTestRunner/WorkQueueManager.cpp
Tools/WebKitTestRunner/WorkQueueManager.h

index 8c811bf..b7f9b99 100644 (file)
@@ -1,3 +1,14 @@
+2012-10-23  Mikhail Pozdnyakov  <mikhail.pozdnyakov@intel.com>
+
+        [WK2] [WTR] WebKitTestRunner needs testRunner.queueForwardNavigation
+        https://bugs.webkit.org/show_bug.cgi?id=99700
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Unskipped http/tests/cache/subresource-failover-to-network.html for WK2 ports.
+
+        * platform/wk2/TestExpectations:
+
 2012-10-23  Allan Sandfeld Jensen  <allan.jensen@digia.com>
 
         [Qt] REGRESSION (r130851): fast/text/word-space-with-kerning.html fails
index 936263e..76cf3eb 100644 (file)
@@ -293,10 +293,6 @@ 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 testRunner.queueForwardNavigation
-# <https://bugs.webkit.org/show_bug.cgi?id=99700>
-http/tests/cache/subresource-failover-to-network.html
-
 # WebKitTestRunner needs layoutTestController.setCacheModel
 # <https://bugs.webkit.org/show_bug.cgi?id=42684>
 fast/dom/HTMLScriptElement/nested-execution.html
index 6429e44..bee2ff0 100644 (file)
@@ -1,3 +1,37 @@
+2012-10-23  Mikhail Pozdnyakov  <mikhail.pozdnyakov@intel.com>
+
+        [WK2] [WTR] WebKitTestRunner needs testRunner.queueForwardNavigation
+        https://bugs.webkit.org/show_bug.cgi?id=99700
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Implemented testRunner.queueForwardNavigation, made little refactoring in Work Queue
+        to obviate code duplication.
+
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+        (WTR::InjectedBundle::queueBackNavigation):
+        (WTR):
+        (WTR::InjectedBundle::queueForwardNavigation):
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
+        (InjectedBundle):
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::queueForwardNavigation):
+        (WTR):
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+        (TestRunner):
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
+        * WebKitTestRunner/WorkQueueManager.cpp:
+        (NavigationItem):
+        (WTR::NavigationItem::NavigationItem):
+        (WTR::NavigationItem::invoke):
+        (WTR):
+        (WTR::WorkQueueManager::queueBackNavigation):
+        (WTR::WorkQueueManager::queueForwardNavigation):
+        * WebKitTestRunner/WorkQueueManager.h:
+        (WorkQueueManager):
+
 2012-10-23  Simon Hausmann  <simon.hausmann@digia.com>
 
         Unreviewed trivial Qt build fix: Fix build without USE_3D_GRAPHICS
index f9f6199..75a190f 100644 (file)
@@ -184,6 +184,7 @@ interface TestRunner {
 
     // Work queue.
     void queueBackNavigation(in unsigned long howFarBackward);
+    void queueForwardNavigation(in unsigned long howFarForward);
     void queueLoad(in DOMString url, in DOMString target);
     void queueReload();
     void queueLoadingScript(in DOMString script);
index d64a734..790b857 100644 (file)
@@ -479,7 +479,16 @@ void InjectedBundle::queueBackNavigation(unsigned howFarBackward)
 
     WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("QueueBackNavigation"));
     WKRetainPtr<WKUInt64Ref> messageBody(AdoptWK, WKUInt64Create(howFarBackward));
-    WKBundlePostMessage(m_bundle, messageName.get(),  messageBody.get());
+    WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
+}
+
+void InjectedBundle::queueForwardNavigation(unsigned howFarForward)
+{
+    m_useWorkQueue = true;
+
+    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("QueueForwardNavigation"));
+    WKRetainPtr<WKUInt64Ref> messageBody(AdoptWK, WKUInt64Create(howFarForward));
+    WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
 }
 
 void InjectedBundle::queueLoad(WKStringRef url, WKStringRef target)
index f3d2034..b7d0e64 100644 (file)
@@ -102,6 +102,7 @@ public:
     bool shouldProcessWorkQueue() const;
     void processWorkQueue();
     void queueBackNavigation(unsigned howFarBackward);
+    void queueForwardNavigation(unsigned howFarForward);
     void queueLoad(WKStringRef url, WKStringRef target);
     void queueReload();
     void queueLoadingScript(WKStringRef script);
index 23b5f34..6a50dbb 100644 (file)
@@ -839,6 +839,11 @@ void TestRunner::queueBackNavigation(unsigned howFarBackward)
     InjectedBundle::shared().queueBackNavigation(howFarBackward);
 }
 
+void TestRunner::queueForwardNavigation(unsigned howFarForward)
+{
+    InjectedBundle::shared().queueForwardNavigation(howFarForward);
+}
+
 void TestRunner::queueLoad(JSStringRef url, JSStringRef target)
 {
     WKRetainPtr<WKURLRef> baseURLWK(AdoptWK, WKBundleFrameCopyURL(WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page())));
index f92e342..5f64764 100644 (file)
@@ -263,6 +263,7 @@ public:
 
     // Work queue.
     void queueBackNavigation(unsigned howFarBackward);
+    void queueForwardNavigation(unsigned howFarForward);
     void queueLoad(JSStringRef url, JSStringRef target);
     void queueReload();
     void queueLoadingScript(JSStringRef script);
index fd94232..7b43f7b 100644 (file)
@@ -447,6 +447,13 @@ void TestInvocation::didReceiveMessageFromInjectedBundle(WKStringRef messageName
         return;
     }
 
+    if (WKStringIsEqualToUTF8CString(messageName, "QueueForwardNavigation")) {
+        ASSERT(WKGetTypeID(messageBody) == WKUInt64GetTypeID());
+        uint64_t stepCount = WKUInt64GetValue(static_cast<WKUInt64Ref>(messageBody));
+        TestController::shared().workQueueManager().queueForwardNavigation(stepCount);
+        return;
+    }
+
     if (WKStringIsEqualToUTF8CString(messageName, "QueueLoad")) {
         ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
         WKDictionaryRef loadDataDictionary = static_cast<WKDictionaryRef>(messageBody);
index 7383579..f1ef694 100644 (file)
@@ -87,6 +87,18 @@ public:
     WKRetainPtr<WKStringRef> m_script;
 };
 
+class NavigationItem : public WorkQueueItem {
+public:
+    explicit NavigationItem(int index) : m_index(index) { }
+
+    WorkQueueItem::Type invoke() const
+    {
+        return goToItemAtIndex(m_index) ? WorkQueueItem::Loading : WorkQueueItem::NonLoading;
+    }
+
+    unsigned m_index;
+};
+
 WorkQueueManager::WorkQueueManager()
     : m_processing(false)
 {
@@ -143,16 +155,12 @@ void WorkQueueManager::queueLoad(const String& url, const String& target)
 
 void WorkQueueManager::queueBackNavigation(unsigned howFarBackward)
 {
-    class BackNavigationItem : public WorkQueueItem {
-    public:
-        explicit BackNavigationItem(unsigned howFarBackward) : m_howFarBackward(howFarBackward) { }
-
-        WorkQueueItem::Type invoke() const { return goToItemAtIndex(-m_howFarBackward) ? WorkQueueItem::Loading : WorkQueueItem::NonLoading; }
-
-        unsigned m_howFarBackward;
-    };
+    enqueue(new NavigationItem(-howFarBackward));
+}
 
-    enqueue(new BackNavigationItem(howFarBackward));
+void WorkQueueManager::queueForwardNavigation(unsigned howFarForward)
+{
+    enqueue(new NavigationItem(howFarForward));
 }
 
 void WorkQueueManager::queueReload()
index b9a22dd..50d74da 100644 (file)
@@ -44,6 +44,7 @@ public:
 
     void queueLoad(const String& url, const String& target);
     void queueBackNavigation(unsigned howFarBackward);
+    void queueForwardNavigation(unsigned howFarForward);
     void queueReload();
     void queueLoadingScript(const String& script);
     void queueNonLoadingScript(const String& script);