2011-01-18 Maciej Stachowiak <mjs@apple.com>
authormjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Jan 2011 03:16:35 +0000 (03:16 +0000)
committermjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Jan 2011 03:16:35 +0000 (03:16 +0000)
        Reviewed by Sam Weinig.

        WebKitTestRunner should track loading more like DumpRenderTree
        https://bugs.webkit.org/show_bug.cgi?id=52692

        Change load tracking to track the current top loading frame, in the manner of DumpRenderTree.
        This makes some tests that call notifyDone multiple times pass.

        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
        (WTR::InjectedBundle::InjectedBundle):
        (WTR::InjectedBundle::done):
        * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
        (WTR::InjectedBundle::topLoadingFrame):
        (WTR::InjectedBundle::setTopLoadingFrame):
        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
        (WTR::InjectedBundlePage::InjectedBundlePage):
        (WTR::InjectedBundlePage::stopLoading):
        (WTR::InjectedBundlePage::didStartProvisionalLoadForFrame):
        (WTR::InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame):
        (WTR::InjectedBundlePage::didFinishLoadForFrame):
        (WTR::InjectedBundlePage::didFailLoadWithErrorForFrame):
        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
        (WTR::LayoutTestController::notifyDone):
        * WebKitTestRunner/TestController.cpp:
        (WTR::TestController::didReceiveMessageFromInjectedBundle):
2011-01-18  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Sam Weinig.

        WebKitTestRunner should track loading more like DumpRenderTree
        https://bugs.webkit.org/show_bug.cgi?id=52692

        Relax the message check in didSaveFrameToPageCache a bit more, since
        layout tests were still hitting the old one.

        * UIProcess/WebPageProxy.cpp:
        (WebKit::isDisconnectedFrame):
        (WebKit::WebPageProxy::didSaveFrameToPageCache):

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

14 files changed:
LayoutTests/editing/pasteboard/copy-null-characters.html
LayoutTests/fast/events/scroll-event-does-not-bubble.html
LayoutTests/platform/mac-wk2/Skipped
LayoutTests/transitions/remove-transition-style.html
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/WebPageProxy.cpp
Tools/ChangeLog
Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm
Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
Tools/WebKitTestRunner/TestController.cpp

index c92ab8b46cf1050d398fa99c5b90386451eca58c..8ee26d6f3e9abe5694034ca357b580d1ca33d03c 100644 (file)
@@ -18,6 +18,7 @@ function runTest()
     var destinationRichText = document.getElementById("destination-rich-text");
     sel.setPosition(destinationRichText, 0);
     document.execCommand("Paste");
+    alert(destinationRichText.innerHTML);
 
     var destinationPlainText = document.getElementById("destination-plain-text");
     destinationPlainText.focus();
@@ -29,6 +30,8 @@ function runTest()
         results.innerText = "Plain text field has the wrong value (expected " +
             JSON.stringify(expectedPlainTextValue) + " but found " +
             JSON.stringify(destinationPlainText.value) + ").";
+        Markup.dump(document.body);
+        Markup.notifyDone();
         return;
     }
 
@@ -52,6 +55,8 @@ function runTest()
         results.innerText = "Plain text field has the wrong value (expected " +
             JSON.stringify(expectedPlainTextValue2) + " but found " +
             JSON.stringify(destinationPlainText.value) + ").";
+        Markup.dump(document.body);
+        Markup.notifyDone();
         return;
     }
 
index 1e85113f77433de8abee6f367151e5203e2eed40..0686350ba094c5b8746a8ff5fc7a3f7c545a4e50 100644 (file)
@@ -14,6 +14,9 @@ function divScrolled() {
         document.getElementById('result').innerHTML = 'SUCCESS: div.onscroll was called, but window.onscroll was not.'; 
     // Don't call notifyDone straight away, in case there's another scroll event coming/bubbling.
     doneTimeout = setTimeout(function() {
+
+        // Don't pollute the test result with nonsense.
+        document.getElementById('container').innerHTML = '';
         if (window.layoutTestController)
             layoutTestController.notifyDone();
         }, 100);    
@@ -32,9 +35,6 @@ function runTest() {
     div.onscroll = divScrolled;
     window.onscroll = windowScrolled;
     div.scrollByLines(1);
-    
-    // Don't pollute the test result with nonsense.
-    div.innerHTML = '';
 }
 
 </script>
index 087bd2613a8b025081cdbbc682b2788d20c67e8c..72391467c0cc78b8e6cd92f0b910c3dd59ee208b 100644 (file)
@@ -976,6 +976,7 @@ java
 
 # WebKit2 needs layoutTestController.overridePreference
 # <https://bugs.webkit.org/show_bug.cgi?id=42197>
+http/tests/navigation/go-back-to-error-page.html
 http/tests/navigation/ping-cookie.html
 plugins/application-plugin-plugins-disabled.html
 fast/canvas/webgl/context-lost-restored.html
@@ -1084,6 +1085,7 @@ media/restore-from-page-cache.html
 
 # Pasteboard doesn't work in WebKit2
 # <https://bugs.webkit.org/show_bug.cgi?id=42317>
+editing/pasteboard/copy-null-characters.html
 editing/execCommand/4128080-2.html
 editing/execCommand/5939887.html
 editing/execCommand/copy-without-selection.html
@@ -2333,3 +2335,24 @@ http/tests/media/video-buffered.html
 # These require DRT setSerializeHTTPLoads implementation for WebKit2 to be reliable.
 http/tests/local/link-stylesheet-load-order.html
 http/tests/local/link-stylesheet-load-order-preload.html
+
+
+# Transitions sometimes don't stop when they should
+transitions/hang-with-bad-transition-list.html
+transitions/remove-transition-style.html
+transitions/repeated-firing-background-color.html
+transitions/zero-duration-with-non-zero-delay-end.html
+
+
+# CSSValue and CSSPrimitiveValue prototypes are wrong
+fast/dom/global-constructors.html
+
+# WebKit2 doesn't support tiled layers
+compositing/tiling/huge-layer-resize.html
+
+# Unexplained plugin failures
+plugins/destroy-reentry.html
+platform/mac/plugins/testplugin-onnew-onpaint.html
+plugins/destroy-stream-twice.html
+plugins/embed-inside-object.html
+plugins/no-mime-with-valid-extension.html
index 371f81ef1c198c7f2e564636c61d7466f949724f..548d615880e1a4a5a9d8aee85410bca4c4379eed 100644 (file)
@@ -51,6 +51,7 @@
     function startTransition()
     {
       var box = document.getElementById('box');
+      box.addEventListener("webkitTransitionEnd", function() { alert("end"); }, false);
       box.className = 'animated';
       window.setTimeout(function() {
         box.style.opacity = '0.5';
@@ -67,4 +68,4 @@
 
 <div id="results"></div>
 </body>
-</html>
\ No newline at end of file
+</html>
index 9779e1aaf85a7a705f65d3052a22b33a57eb9561..72d950e20a68467b5fdb7ed8a9be20c61513d765 100644 (file)
@@ -1,3 +1,17 @@
+2011-01-18  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        WebKitTestRunner should track loading more like DumpRenderTree
+        https://bugs.webkit.org/show_bug.cgi?id=52692
+        
+        Relax the message check in didSaveFrameToPageCache a bit more, since
+        layout tests were still hitting the old one.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::isDisconnectedFrame):
+        (WebKit::WebPageProxy::didSaveFrameToPageCache):
+
 2011-01-18  Brady Eidson  <beidson@apple.com>
 
         Reviewed by Darin Adler.
index 4ff6888981821533ce49a2f047e09eb5e0a98454..2693f9a21294eea03a3397f0fd92e119ddf3af7f 100644 (file)
@@ -1082,6 +1082,11 @@ void WebPageProxy::didCreateSubframe(uint64_t frameID, uint64_t parentFrameID)
     parentFrame->appendChild(subFrame.get());
 }
 
+static bool isDisconnectedFrame(WebFrameProxy* frame)
+{
+    return !frame->page() || !frame->page()->mainFrame() || !frame->isDescendantOf(frame->page()->mainFrame());
+}
+
 void WebPageProxy::didSaveFrameToPageCache(uint64_t frameID)
 {
     MESSAGE_CHECK(m_mainFrame);
@@ -1089,7 +1094,7 @@ void WebPageProxy::didSaveFrameToPageCache(uint64_t frameID)
     WebFrameProxy* subframe = process()->webFrame(frameID);
     MESSAGE_CHECK(subframe);
 
-    if (!subframe->parentFrame())
+    if (isDisconnectedFrame(subframe))
         return;
 
     MESSAGE_CHECK(subframe->isDescendantOf(m_mainFrame.get()));
index 8cbfcc3eb0c0479c3bd0a38805bbc65af042cbd5..9e83431c83986a2886d32c1dda33fb5eeb8a4312 100644 (file)
@@ -1,3 +1,32 @@
+2011-01-18  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        WebKitTestRunner should track loading more like DumpRenderTree
+        https://bugs.webkit.org/show_bug.cgi?id=52692
+
+        Change load tracking to track the current top loading frame, in the manner of DumpRenderTree.
+        This makes some tests that call notifyDone multiple times pass.
+        
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+        (WTR::InjectedBundle::InjectedBundle):
+        (WTR::InjectedBundle::done):
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
+        (WTR::InjectedBundle::topLoadingFrame):
+        (WTR::InjectedBundle::setTopLoadingFrame):
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+        (WTR::InjectedBundlePage::InjectedBundlePage):
+        (WTR::InjectedBundlePage::stopLoading):
+        (WTR::InjectedBundlePage::didStartProvisionalLoadForFrame):
+        (WTR::InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame):
+        (WTR::InjectedBundlePage::didFinishLoadForFrame):
+        (WTR::InjectedBundlePage::didFailLoadWithErrorForFrame):
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
+        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
+        (WTR::LayoutTestController::notifyDone):
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::didReceiveMessageFromInjectedBundle):
+
 2011-01-18  Mihai Parparita  <mihaip@chromium.org>
 
         Reviewed by Kent Tamura.
index a69195172717c91f66b8279bf5de773114df3134..5903f786123581dd646b8f44c04cef1b269f3e29 100644 (file)
@@ -266,6 +266,8 @@ unsigned LayoutTestController::workerThreadCount() const
 
 void LayoutTestController::notifyDone()
 {
+    puts("notifyDone");
+
     if (m_waitToDump && !topLoadingFrame && !WorkQueue::shared()->count())
         dump();
     m_waitToDump = false;
index 999ca3accc8a9197f921aa7e9f88677747ff6fff..972a606bf55f1408878f9df8f6902bdb9733373e 100644 (file)
@@ -47,6 +47,7 @@ InjectedBundle& InjectedBundle::shared()
 
 InjectedBundle::InjectedBundle()
     : m_bundle(0)
+    , m_topLoadingFrame(0)
     , m_state(Idle)
 {
 }
@@ -161,6 +162,7 @@ void InjectedBundle::done()
     m_state = Stopping;
 
     page()->stopLoading();
+    setTopLoadingFrame(0);
 
     WKRetainPtr<WKStringRef> doneMessageName(AdoptWK, WKStringCreateWithUTF8CString("Done"));
     WKRetainPtr<WKStringRef> doneMessageBody(AdoptWK, WKStringCreateWithUTF8CString(m_outputStream.str().c_str()));
index c1d8b37f977fbdd70e0cf2c0588828d777c566ef..9778441aea198b3065735b10a1c17f82f16c1f3b 100644 (file)
@@ -65,6 +65,9 @@ public:
 
     bool isTestRunning() { return m_state == Testing; }
 
+    WKBundleFrameRef topLoadingFrame() { return m_topLoadingFrame; }
+    void setTopLoadingFrame(WKBundleFrameRef frame) { m_topLoadingFrame = frame; }
+
 private:
     InjectedBundle();
     ~InjectedBundle();
@@ -89,6 +92,8 @@ private:
     RefPtr<GCController> m_gcController;
     RefPtr<EventSendingController> m_eventSendingController;
 
+    WKBundleFrameRef m_topLoadingFrame;
+
     std::ostringstream m_outputStream;
     
     enum State {
index 4bcb3c810716cc1fbeadd6d4b9985eaf20326dc6..c90f914c8725501627d6d14d1555a31d13704ccf 100644 (file)
@@ -37,6 +37,8 @@
 #include <WebKit2/WKBundleFramePrivate.h>
 #include <WebKit2/WKBundlePagePrivate.h>
 
+#include <WebKit2/WKStringCF.h>
+
 using namespace std;
 
 namespace WTR {
@@ -168,7 +170,6 @@ static ostream& operator<<(ostream& out, WKBundleFrameRef frame)
 InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page)
     : m_page(page)
     , m_world(AdoptWK, WKBundleScriptWorldCreateWorld())
-    , m_isLoading(false)
 {
     WKBundlePageLoaderClient loaderClient = {
         0,
@@ -233,7 +234,6 @@ InjectedBundlePage::~InjectedBundlePage()
 void InjectedBundlePage::stopLoading()
 {
     WKBundlePageStopLoading(m_page);
-    m_isLoading = false;
 }
 
 void InjectedBundlePage::reset()
@@ -334,8 +334,9 @@ void InjectedBundlePage::didStartProvisionalLoadForFrame(WKBundleFrameRef frame)
     if (!InjectedBundle::shared().isTestRunning())
         return;
 
-    if (frame == WKBundlePageGetMainFrame(m_page))
-        m_isLoading = true;
+    if (InjectedBundle::shared().topLoadingFrame())
+        return;
+    InjectedBundle::shared().setTopLoadingFrame(frame);
 }
 
 void InjectedBundlePage::didReceiveServerRedirectForProvisionalLoadForFrame(WKBundleFrameRef frame)
@@ -344,6 +345,17 @@ void InjectedBundlePage::didReceiveServerRedirectForProvisionalLoadForFrame(WKBu
 
 void InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame(WKBundleFrameRef frame, WKErrorRef error)
 {
+    if (!InjectedBundle::shared().isTestRunning())
+        return;
+
+    if (frame != InjectedBundle::shared().topLoadingFrame())
+        return;
+    InjectedBundle::shared().setTopLoadingFrame(0);
+
+    if (InjectedBundle::shared().layoutTestController()->waitToDump())
+        return;
+
+    InjectedBundle::shared().done();
 }
 
 void InjectedBundlePage::didCommitLoadForFrame(WKBundleFrameRef frame)
@@ -475,18 +487,14 @@ void InjectedBundlePage::didFinishLoadForFrame(WKBundleFrameRef frame)
     if (!InjectedBundle::shared().isTestRunning())
         return;
 
-    if (!WKBundleFrameIsMainFrame(frame))
-        return;
-
-    m_isLoading = false;
-
-    if (this != InjectedBundle::shared().page())
+    if (frame != InjectedBundle::shared().topLoadingFrame())
         return;
+    InjectedBundle::shared().setTopLoadingFrame(0);
 
     if (InjectedBundle::shared().layoutTestController()->waitToDump())
         return;
 
-    dump();
+    InjectedBundle::shared().page()->dump();
 }
 
 void InjectedBundlePage::didFailLoadWithErrorForFrame(WKBundleFrameRef frame, WKErrorRef)
@@ -494,12 +502,11 @@ void InjectedBundlePage::didFailLoadWithErrorForFrame(WKBundleFrameRef frame, WK
     if (!InjectedBundle::shared().isTestRunning())
         return;
 
-    if (!WKBundleFrameIsMainFrame(frame))
+    if (frame != InjectedBundle::shared().topLoadingFrame())
         return;
+    InjectedBundle::shared().setTopLoadingFrame(0);
 
-    m_isLoading = false;
-
-    if (this != InjectedBundle::shared().page())
+    if (InjectedBundle::shared().layoutTestController()->waitToDump())
         return;
 
     InjectedBundle::shared().done();
index e9462dfae31f8c4ad225e823d871e6b97272a7fa..3b99109eff82ee4dfce877bd0b6fe041b230218e 100644 (file)
@@ -41,7 +41,6 @@ public:
     void dump();
 
     void stopLoading();
-    bool isLoading() { return m_isLoading; }
 
     void reset();
 
@@ -124,7 +123,6 @@ private:
     WKBundlePageRef m_page;
     WKRetainPtr<WKBundleScriptWorldRef> m_world;
     WKRetainPtr<WKBundleBackForwardListItemRef> m_previousTestBackForwardListItem;
-    bool m_isLoading;
 };
 
 } // namespace WTR
index aa3dbf45348a67562acf9eeb35a6db72ce5574c0..c8a6f84e9c82959809dbbec32a8edf2232b5da20 100644 (file)
@@ -132,8 +132,9 @@ void LayoutTestController::notifyDone()
     if (!InjectedBundle::shared().isTestRunning())
         return;
 
-    if (m_waitToDump && !InjectedBundle::shared().page()->isLoading())
+    if (m_waitToDump && !InjectedBundle::shared().topLoadingFrame())
         InjectedBundle::shared().page()->dump();
+
     m_waitToDump = false;
 }
 
index 699982e55ff4f08eb3e3d6a3aaf79cf5109d1c5d..25574241a05f8761f630db30ce402100fcb8dc02 100644 (file)
@@ -386,6 +386,8 @@ void TestController::didReceiveSynchronousMessageFromInjectedBundle(WKContextRef
 
 void TestController::didReceiveMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody)
 {
+    if (!m_currentInvocation)
+        return;
     m_currentInvocation->didReceiveMessageFromInjectedBundle(messageName, messageBody);
 }