Changeset 155140 in webkit


Ignore:
Timestamp:
Sep 5, 2013 12:38:48 PM (11 years ago)
Author:
Simon Fraser
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):

Location:
trunk/Tools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r155124 r155140  
     12013-09-05  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Expected result images are sometimes blank in WKTR
     4        https://bugs.webkit.org/show_bug.cgi?id=120715
     5
     6        Reviewed by Tim Horton.
     7       
     8        In WebKitTestRunner, snapshots obtained via windowSnapshotImage() were
     9        sometimes blank if a previous test triggered compositing mode, and the
     10        current test or reference did not require compositing. This happened
     11        because the UI process didn't wait for the web process to complete
     12        its compositing mode switch before snapshotting. Fix by calling
     13        WKPageForceRepaint() before we take the snapshot; this is async,
     14        so we have to spin the runloop for a while.
     15       
     16        Remove the Qt/EFL code that does the same thing.
     17
     18        * WebKitTestRunner/TestInvocation.cpp:
     19        (WTR::TestInvocation::forceRepaintDoneCallback):
     20        (WTR::TestInvocation::dumpResults):
     21        * WebKitTestRunner/TestInvocation.h:
     22        * WebKitTestRunner/cairo/TestInvocationCairo.cpp:
     23        (WTR::TestInvocation::dumpPixelsAndCompareWithExpected):
     24        * WebKitTestRunner/qt/TestInvocationQt.cpp:
     25        (WTR::TestInvocation::dumpPixelsAndCompareWithExpected):
     26
    1272013-09-05  Csaba Osztrogonác  <ossy@webkit.org>
    228
  • trunk/Tools/WebKitTestRunner/TestInvocation.cpp

    r153054 r155140  
    311311}
    312312
     313void TestInvocation::forceRepaintDoneCallback(WKErrorRef, void* context)
     314{
     315    TestInvocation* testInvocation = static_cast<TestInvocation*>(context);
     316    testInvocation->m_gotRepaint = true;
     317}
     318
    313319void TestInvocation::dumpResults()
    314320{
     
    318324        dumpAudio(m_audioResult.get());
    319325
    320     if (m_dumpPixels && m_pixelResult)
     326    if (m_dumpPixels && m_pixelResult) {
     327        m_gotRepaint = false;
     328        WKPageForceRepaint(TestController::shared().mainWebView()->page(), this, TestInvocation::forceRepaintDoneCallback);
     329        TestController::shared().runUntil(m_gotRepaint, TestController::ShortTimeout);
     330        if (!m_gotRepaint) {
     331            m_errorMessage = "Timed out waiting for pre-pixel dump repaint\n";
     332            m_webProcessIsUnresponsive = true;
     333            return;
     334        }
    321335        dumpPixelsAndCompareWithExpected(m_pixelResult.get(), m_repaintRects.get());
     336    }
    322337
    323338    fputs("#EOF\n", stdout);
  • trunk/Tools/WebKitTestRunner/TestInvocation.h

    r152295 r155140  
    5959    bool compareActualHashToExpectedAndDumpResults(const char[33]);
    6060
    61 #if PLATFORM(QT) || PLATFORM(EFL)
    6261    static void forceRepaintDoneCallback(WKErrorRef, void* context);
    63 #endif
    64    
     62
    6563    WKRetainPtr<WKURLRef> m_url;
    6664    std::string m_pathOrURL;
  • trunk/Tools/WebKitTestRunner/cairo/TestInvocationCairo.cpp

    r136004 r155140  
    107107}
    108108
    109 #if PLATFORM(EFL)
    110 void TestInvocation::forceRepaintDoneCallback(WKErrorRef, void *context)
    111 {
    112     static_cast<TestInvocation*>(context)->m_gotRepaint = true;
    113     TestController::shared().notifyDone();
    114 }
    115 #endif
    116 
    117109void TestInvocation::dumpPixelsAndCompareWithExpected(WKImageRef wkImage, WKArrayRef repaintRects)
    118110{
    119111#if USE(ACCELERATED_COMPOSITING) && PLATFORM(EFL)
    120112    UNUSED_PARAM(wkImage);
    121 
    122     cairo_surface_t* surface;
    123 
    124     WKPageRef page = TestController::shared().mainWebView()->page();
    125     WKPageForceRepaint(page, this, &forceRepaintDoneCallback);
    126 
    127     TestController::shared().runUntil(m_gotRepaint, TestController::ShortTimeout);
    128 
    129     if (!m_gotRepaint) {
    130         m_error = true;
    131         m_errorMessage = "Timed out waiting for repaint\n";
    132         m_webProcessIsUnresponsive = true;
    133         return;
    134     }
    135 
    136     surface = WKImageCreateCairoSurface(TestController::shared().mainWebView()->windowSnapshotImage().get());
     113    cairo_surface_t* surface = WKImageCreateCairoSurface(TestController::shared().mainWebView()->windowSnapshotImage().get());
    137114#else
    138115    cairo_surface_t* surface = WKImageCreateCairoSurface(wkImage);
  • trunk/Tools/WebKitTestRunner/qt/TestInvocationQt.cpp

    r150007 r155140  
    6565}
    6666
    67 void TestInvocation::forceRepaintDoneCallback(WKErrorRef, void *context)
    68 {
    69     static_cast<TestInvocation*>(context)->m_gotRepaint = true;
    70     TestController::shared().notifyDone();
    71 }
    72 
    7367void TestInvocation::dumpPixelsAndCompareWithExpected(WKImageRef imageRef, WKArrayRef repaintRects)
    7468{
    7569    QImage image;
    7670    if (PlatformWebView::windowShapshotEnabled()) {
    77         WKPageRef page = TestController::shared().mainWebView()->page();
    78         WKPageForceRepaint(page, this, &forceRepaintDoneCallback);
    79 
    80         TestController::shared().runUntil(m_gotRepaint, TestController::ShortTimeout);
    81 
    82         if (m_gotRepaint)
    83             image = WKImageCreateQImage(TestController::shared().mainWebView()->windowSnapshotImage().get());
    84         else {
    85             m_error = true;
    86             m_errorMessage = "Timed out waiting for repaint\n";
    87             m_webProcessIsUnresponsive = true;
    88             return;
    89         }
     71        image = WKImageCreateQImage(TestController::shared().mainWebView()->windowSnapshotImage().get());
    9072    } else
    9173        image = WKImageCreateQImage(imageRef);
Note: See TracChangeset for help on using the changeset viewer.