Title: [155140] trunk/Tools
Revision
155140
Author
[email protected]
Date
2013-09-05 12:38:48 -0700 (Thu, 05 Sep 2013)

Log Message

Expected result images are sometimes blank in WKTR
https://bugs.webkit.org/show_bug.cgi?id=120715

Reviewed by Tim Horton.

In WebKitTestRunner, snapshots obtained via windowSnapshotImage() were
sometimes blank if a previous test triggered compositing mode, and the
current test or reference did not require compositing. This happened
because the UI process didn't wait for the web process to complete
its compositing mode switch before snapshotting. Fix by calling
WKPageForceRepaint() before we take the snapshot; this is async,
so we have to spin the runloop for a while.

Remove the Qt/EFL code that does the same thing.

* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::forceRepaintDoneCallback):
(WTR::TestInvocation::dumpResults):
* WebKitTestRunner/TestInvocation.h:
* WebKitTestRunner/cairo/TestInvocationCairo.cpp:
(WTR::TestInvocation::dumpPixelsAndCompareWithExpected):
* WebKitTestRunner/qt/TestInvocationQt.cpp:
(WTR::TestInvocation::dumpPixelsAndCompareWithExpected):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (155139 => 155140)


--- trunk/Tools/ChangeLog	2013-09-05 19:32:35 UTC (rev 155139)
+++ trunk/Tools/ChangeLog	2013-09-05 19:38:48 UTC (rev 155140)
@@ -1,3 +1,29 @@
+2013-09-05  Simon Fraser  <[email protected]>
+
+        Expected result images are sometimes blank in WKTR
+        https://bugs.webkit.org/show_bug.cgi?id=120715
+
+        Reviewed by Tim Horton.
+        
+        In WebKitTestRunner, snapshots obtained via windowSnapshotImage() were
+        sometimes blank if a previous test triggered compositing mode, and the
+        current test or reference did not require compositing. This happened
+        because the UI process didn't wait for the web process to complete
+        its compositing mode switch before snapshotting. Fix by calling
+        WKPageForceRepaint() before we take the snapshot; this is async,
+        so we have to spin the runloop for a while.
+        
+        Remove the Qt/EFL code that does the same thing.
+
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::forceRepaintDoneCallback):
+        (WTR::TestInvocation::dumpResults):
+        * WebKitTestRunner/TestInvocation.h:
+        * WebKitTestRunner/cairo/TestInvocationCairo.cpp:
+        (WTR::TestInvocation::dumpPixelsAndCompareWithExpected):
+        * WebKitTestRunner/qt/TestInvocationQt.cpp:
+        (WTR::TestInvocation::dumpPixelsAndCompareWithExpected):
+
 2013-09-05  Csaba Osztrogonác  <[email protected]>
 
         Make build.webkit.org report the number of failing run-fast-jsc tests

Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (155139 => 155140)


--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2013-09-05 19:32:35 UTC (rev 155139)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2013-09-05 19:38:48 UTC (rev 155140)
@@ -310,6 +310,12 @@
     fflush(stderr);
 }
 
+void TestInvocation::forceRepaintDoneCallback(WKErrorRef, void* context)
+{
+    TestInvocation* testInvocation = static_cast<TestInvocation*>(context);
+    testInvocation->m_gotRepaint = true;
+}
+
 void TestInvocation::dumpResults()
 {
     if (m_textOutput.length() || !m_audioResult)
@@ -317,8 +323,17 @@
     else
         dumpAudio(m_audioResult.get());
 
-    if (m_dumpPixels && m_pixelResult)
+    if (m_dumpPixels && m_pixelResult) {
+        m_gotRepaint = false;
+        WKPageForceRepaint(TestController::shared().mainWebView()->page(), this, TestInvocation::forceRepaintDoneCallback);
+        TestController::shared().runUntil(m_gotRepaint, TestController::ShortTimeout);
+        if (!m_gotRepaint) {
+            m_errorMessage = "Timed out waiting for pre-pixel dump repaint\n";
+            m_webProcessIsUnresponsive = true;
+            return;
+        }
         dumpPixelsAndCompareWithExpected(m_pixelResult.get(), m_repaintRects.get());
+    }
 
     fputs("#EOF\n", stdout);
     fflush(stdout);

Modified: trunk/Tools/WebKitTestRunner/TestInvocation.h (155139 => 155140)


--- trunk/Tools/WebKitTestRunner/TestInvocation.h	2013-09-05 19:32:35 UTC (rev 155139)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.h	2013-09-05 19:38:48 UTC (rev 155140)
@@ -58,10 +58,8 @@
     void dumpAudio(WKDataRef);
     bool compareActualHashToExpectedAndDumpResults(const char[33]);
 
-#if PLATFORM(QT) || PLATFORM(EFL)
     static void forceRepaintDoneCallback(WKErrorRef, void* context);
-#endif
-    
+
     WKRetainPtr<WKURLRef> m_url;
     std::string m_pathOrURL;
     

Modified: trunk/Tools/WebKitTestRunner/cairo/TestInvocationCairo.cpp (155139 => 155140)


--- trunk/Tools/WebKitTestRunner/cairo/TestInvocationCairo.cpp	2013-09-05 19:32:35 UTC (rev 155139)
+++ trunk/Tools/WebKitTestRunner/cairo/TestInvocationCairo.cpp	2013-09-05 19:38:48 UTC (rev 155140)
@@ -106,34 +106,11 @@
     cairo_destroy(context);
 }
 
-#if PLATFORM(EFL)
-void TestInvocation::forceRepaintDoneCallback(WKErrorRef, void *context)
-{
-    static_cast<TestInvocation*>(context)->m_gotRepaint = true;
-    TestController::shared().notifyDone();
-}
-#endif
-
 void TestInvocation::dumpPixelsAndCompareWithExpected(WKImageRef wkImage, WKArrayRef repaintRects)
 {
 #if USE(ACCELERATED_COMPOSITING) && PLATFORM(EFL)
     UNUSED_PARAM(wkImage);
-
-    cairo_surface_t* surface;
-
-    WKPageRef page = TestController::shared().mainWebView()->page();
-    WKPageForceRepaint(page, this, &forceRepaintDoneCallback);
-
-    TestController::shared().runUntil(m_gotRepaint, TestController::ShortTimeout);
-
-    if (!m_gotRepaint) {
-        m_error = true;
-        m_errorMessage = "Timed out waiting for repaint\n";
-        m_webProcessIsUnresponsive = true;
-        return;
-    }
-
-    surface = WKImageCreateCairoSurface(TestController::shared().mainWebView()->windowSnapshotImage().get());
+    cairo_surface_t* surface = WKImageCreateCairoSurface(TestController::shared().mainWebView()->windowSnapshotImage().get());
 #else
     cairo_surface_t* surface = WKImageCreateCairoSurface(wkImage);
 #endif

Modified: trunk/Tools/WebKitTestRunner/qt/TestInvocationQt.cpp (155139 => 155140)


--- trunk/Tools/WebKitTestRunner/qt/TestInvocationQt.cpp	2013-09-05 19:32:35 UTC (rev 155139)
+++ trunk/Tools/WebKitTestRunner/qt/TestInvocationQt.cpp	2013-09-05 19:38:48 UTC (rev 155140)
@@ -64,29 +64,11 @@
     fflush(stdout);
 }
 
-void TestInvocation::forceRepaintDoneCallback(WKErrorRef, void *context)
-{
-    static_cast<TestInvocation*>(context)->m_gotRepaint = true;
-    TestController::shared().notifyDone();
-}
-
 void TestInvocation::dumpPixelsAndCompareWithExpected(WKImageRef imageRef, WKArrayRef repaintRects)
 {
     QImage image;
     if (PlatformWebView::windowShapshotEnabled()) {
-        WKPageRef page = TestController::shared().mainWebView()->page();
-        WKPageForceRepaint(page, this, &forceRepaintDoneCallback);
-
-        TestController::shared().runUntil(m_gotRepaint, TestController::ShortTimeout);
-
-        if (m_gotRepaint)
-            image = WKImageCreateQImage(TestController::shared().mainWebView()->windowSnapshotImage().get());
-        else {
-            m_error = true;
-            m_errorMessage = "Timed out waiting for repaint\n";
-            m_webProcessIsUnresponsive = true;
-            return;
-        }
+        image = WKImageCreateQImage(TestController::shared().mainWebView()->windowSnapshotImage().get());
     } else
         image = WKImageCreateQImage(imageRef);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to