Commit 85cdc133 authored by Alexis Hetu's avatar Alexis Hetu Committed by Commit Bot

NativeWidgetMacTest.SchedulePaintInRect_* fix

The gl renderer for all chromium tests was recently changed from OSMesa
to SwiftShader. OSMesa offers a synchronous API to OpenGL, while
SwiftShader is asynchronous (draw calls are received and yield before
the drawing operation is complete, letting chromium resume its execution).

Because of this it seems like the affected MacOS tests here can become
idle while rendering is happening in the background, causing the tests to
fail. To solve this, we need to actually wait for drawing to be completed,
rather than waiting for an idle period, in order to resume the test. Doing
this allows these tests to pass.

R=ccameron@chromium.org

Bug: chromium:870465
Change-Id: I6f1555b93a83d80b06e72b3a469c01dde44e1312
Reviewed-on: https://chromium-review.googlesource.com/1162350
Commit-Queue: Alexis Hétu <sugoi@chromium.org>
Reviewed-by: default avatarccameron <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580619}
parent afd4351b
......@@ -1882,10 +1882,13 @@ TEST_F(NativeWidgetMacTest, SchedulePaintInRect_Titled) {
NSWindow* window = widget->GetNativeWindow();
base::scoped_nsobject<MockBridgedView> mock_bridged_view(
[[MockBridgedView alloc] init]);
// Reset drawRect count.
[mock_bridged_view setDrawRectCount:0];
[window setContentView:mock_bridged_view];
// Ensure the initial draw of the window is done.
base::RunLoop().RunUntilIdle();
while ([mock_bridged_view drawRectCount] == 0)
base::RunLoop().RunUntilIdle();
// Add a dummy view to the widget. This will cause SchedulePaint to be called
// on the dummy view.
......@@ -1897,7 +1900,8 @@ TEST_F(NativeWidgetMacTest, SchedulePaintInRect_Titled) {
widget->GetContentsView()->AddChildView(dummy_view);
// SchedulePaint is asyncronous. Wait for drawRect: to be called.
base::RunLoop().RunUntilIdle();
while ([mock_bridged_view drawRectCount] == 0)
base::RunLoop().RunUntilIdle();
EXPECT_EQ(1u, [mock_bridged_view drawRectCount]);
int client_area_height = widget->GetClientAreaBoundsInScreen().height();
......@@ -1924,10 +1928,13 @@ TEST_F(NativeWidgetMacTest, SchedulePaintInRect_Borderless) {
NSWindow* window = widget->GetNativeWindow();
base::scoped_nsobject<MockBridgedView> mock_bridged_view(
[[MockBridgedView alloc] init]);
// Reset drawRect count.
[mock_bridged_view setDrawRectCount:0];
[window setContentView:mock_bridged_view];
// Ensure the initial draw of the window is done.
base::RunLoop().RunUntilIdle();
while ([mock_bridged_view drawRectCount] == 0)
base::RunLoop().RunUntilIdle();
// Add a dummy view to the widget. This will cause SchedulePaint to be called
// on the dummy view.
......@@ -1939,7 +1946,8 @@ TEST_F(NativeWidgetMacTest, SchedulePaintInRect_Borderless) {
widget->GetRootView()->AddChildView(dummy_view);
// SchedulePaint is asyncronous. Wait for drawRect: to be called.
base::RunLoop().RunUntilIdle();
while ([mock_bridged_view drawRectCount] == 0)
base::RunLoop().RunUntilIdle();
EXPECT_EQ(1u, [mock_bridged_view drawRectCount]);
// These are expected dummy_view bounds in AppKit coordinate system. The y
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment