Skip to content

Commit 01a6ea9

Browse files
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): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155140 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 620bb2e commit 01a6ea9

File tree

5 files changed

+45
-47
lines changed

5 files changed

+45
-47
lines changed

Tools/ChangeLog

+26
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
2013-09-05 Simon Fraser <[email protected]>
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+
127
2013-09-05 Csaba Osztrogonác <[email protected]>
228

329
Make build.webkit.org report the number of failing run-fast-jsc tests

Tools/WebKitTestRunner/TestInvocation.cpp

+16-1
Original file line numberDiff line numberDiff line change
@@ -310,15 +310,30 @@ void TestInvocation::dump(const char* textToStdout, const char* textToStderr, bo
310310
fflush(stderr);
311311
}
312312

313+
void TestInvocation::forceRepaintDoneCallback(WKErrorRef, void* context)
314+
{
315+
TestInvocation* testInvocation = static_cast<TestInvocation*>(context);
316+
testInvocation->m_gotRepaint = true;
317+
}
318+
313319
void TestInvocation::dumpResults()
314320
{
315321
if (m_textOutput.length() || !m_audioResult)
316322
dump(m_textOutput.toString().utf8().data());
317323
else
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);
324339
fflush(stdout);

Tools/WebKitTestRunner/TestInvocation.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,8 @@ class TestInvocation {
5858
void dumpAudio(WKDataRef);
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;
6765

Tools/WebKitTestRunner/cairo/TestInvocationCairo.cpp

+1-24
Original file line numberDiff line numberDiff line change
@@ -106,34 +106,11 @@ static void paintRepaintRectOverlay(cairo_surface_t* surface, WKArrayRef repaint
106106
cairo_destroy(context);
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-
117109
void 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);
139116
#endif

Tools/WebKitTestRunner/qt/TestInvocationQt.cpp

+1-19
Original file line numberDiff line numberDiff line change
@@ -64,29 +64,11 @@ static void dumpImage(const QImage& image)
6464
fflush(stdout);
6565
}
6666

67-
void TestInvocation::forceRepaintDoneCallback(WKErrorRef, void *context)
68-
{
69-
static_cast<TestInvocation*>(context)->m_gotRepaint = true;
70-
TestController::shared().notifyDone();
71-
}
72-
7367
void 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);
9274

0 commit comments

Comments
 (0)