Commit b1be0f0c authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

Reset browser window size before a web test

Previously RWHV::SetSize(gfx::Size(800, 600)) at the beginning of a web
test didn't work on Mac if the previous test synchronously set renderer
window size (which didn't affect browser window size), because the call
was a no-op due to the early return in the function when it found that
the new size was the same as the old size. This left some inconsistent
state caused by the previous synchronous resize persist until we
changed the window size to another value.

Now to ensure RWHV::SetSize() to reset the previous state, we call it
twice, first with a different value, then with the desired value.

This reduces number of unexpected flaky tests on mac-rel from about 300
to about 180.

Bug: 1011191
Change-Id: I00fe653f5c44639d2a841bb5d4db779be0da6147
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1845479
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: default avatarMike West <mkwst@chromium.org>
Cr-Commit-Position: refs/heads/master@{#704235}
parent 03daa9f5
...@@ -448,18 +448,18 @@ bool BlinkTestController::PrepareForWebTest(const TestInfo& test_info) { ...@@ -448,18 +448,18 @@ bool BlinkTestController::PrepareForWebTest(const TestInfo& test_info) {
// Shell::SizeTo is not implemented on all platforms. // Shell::SizeTo is not implemented on all platforms.
main_window_->SizeTo(initial_size_); main_window_->SizeTo(initial_size_);
#endif #endif
main_window_->web_contents()
->GetRenderViewHost()
->GetWidget()
->GetView()
->SetSize(initial_size_);
// Try to reset the window size. This can fail, see crbug.com/772811
main_window_->web_contents()
->GetRenderViewHost()
->GetWidget()
->SynchronizeVisualProperties();
RenderViewHost* render_view_host = RenderViewHost* render_view_host =
main_window_->web_contents()->GetRenderViewHost(); main_window_->web_contents()->GetRenderViewHost();
RenderWidgetHost* render_widget_host = render_view_host->GetWidget();
// Set a different size first to reset the possibly inconsistent state
// caused by the previous test using unfortunate synchronous resize mode.
// This forces SetSize() not to early return which would otherwise happen
// when we set the size to initial_size_ which is the same as its current
// size. See http://crbug.com/1011191 for more details.
render_widget_host->GetView()->SetSize(
gfx::Size(initial_size_.width() / 2, initial_size_.height()));
render_widget_host->GetView()->SetSize(initial_size_);
render_widget_host->SynchronizeVisualProperties();
if (is_devtools_protocol_test) { if (is_devtools_protocol_test) {
devtools_protocol_test_bindings_.reset( devtools_protocol_test_bindings_.reset(
...@@ -476,13 +476,10 @@ bool BlinkTestController::PrepareForWebTest(const TestInfo& test_info) { ...@@ -476,13 +476,10 @@ bool BlinkTestController::PrepareForWebTest(const TestInfo& test_info) {
// Focus the RenderWidgetHost. This will send an IPC message to the // Focus the RenderWidgetHost. This will send an IPC message to the
// renderer to propagate the state change. // renderer to propagate the state change.
main_window_->web_contents()->GetRenderViewHost()->GetWidget()->Focus(); render_widget_host->Focus();
// Flush various interfaces to ensure a test run begins from a known state. // Flush various interfaces to ensure a test run begins from a known state.
main_window_->web_contents() render_widget_host->FlushForTesting();
->GetRenderViewHost()
->GetWidget()
->FlushForTesting();
GetWebTestControlRemote(render_view_host->GetMainFrame()).FlushForTesting(); GetWebTestControlRemote(render_view_host->GetMainFrame()).FlushForTesting();
if (is_devtools_js_test) { if (is_devtools_js_test) {
......
...@@ -6025,11 +6025,3 @@ crbug.com/1010593 virtual/disable-deferred-rendering/fast/canvas/canvas-scale-dr ...@@ -6025,11 +6025,3 @@ crbug.com/1010593 virtual/disable-deferred-rendering/fast/canvas/canvas-scale-dr
crbug.com/1010655 virtual/disable-deferred-rendering/fast/canvas/canvas-lost-gpu-context.html [ Failure ] crbug.com/1010655 virtual/disable-deferred-rendering/fast/canvas/canvas-lost-gpu-context.html [ Failure ]
crbug.com/1010657 [ Mac ] virtual/disable-deferred-rendering/fast/canvas/image-object-in-canvas.html [ Failure ] crbug.com/1010657 [ Mac ] virtual/disable-deferred-rendering/fast/canvas/image-object-in-canvas.html [ Failure ]
crbug.com/1011723 virtual/disable-deferred-rendering/fast/canvas/OffscreenCanvas-copyImage.html [ Failure ] crbug.com/1011723 virtual/disable-deferred-rendering/fast/canvas/OffscreenCanvas-copyImage.html [ Failure ]
# Sheriff 2019-10-04
crbug.com/1011191 [ Mac ] paint/invalidation/svg/use-clipped-hit.svg [ Pass Failure ]
crbug.com/1011188 [ Mac ] paint/invalidation/svg/svg-background-partial-redraw.html [ Pass Failure ]
# Sheriff 2019-10-09
crbug.com/1012638 [ Mac ] paint/invalidation/push-block-with-first-line.html [ Pass Failure ]
{
"layers": [
{
"name": "Scrolling Contents Layer",
"bounds": [500, 400],
"contentsOpaque": true,
"backgroundColor": "#FFFFFF",
"paintInvalidations": [
{
"object": "NGPhysicalLineBoxFragment",
"rect": [8, 68, 484, 20],
"reason": "geometry"
},
{
"object": "NGPhysicalLineBoxFragment",
"rect": [8, 8, 484, 20],
"reason": "geometry"
},
{
"object": "NGPhysicalTextFragment 'JOCULAR'",
"rect": [8, 68, 140, 20],
"reason": "geometry"
},
{
"object": "NGPhysicalTextFragment 'JOCULAR'",
"rect": [8, 8, 140, 20],
"reason": "geometry"
}
]
}
]
}
{
"layers": [
{
"name": "Scrolling Contents Layer",
"bounds": [500, 400],
"contentsOpaque": true,
"backgroundColor": "#FFFFFF",
"paintInvalidations": [
{
"object": "NGPhysicalLineBoxFragment",
"rect": [8, 68, 484, 20],
"reason": "geometry"
},
{
"object": "NGPhysicalLineBoxFragment",
"rect": [8, 8, 484, 20],
"reason": "geometry"
},
{
"object": "NGPhysicalTextFragment 'JOCULAR'",
"rect": [8, 68, 140, 20],
"reason": "geometry"
},
{
"object": "NGPhysicalTextFragment 'JOCULAR'",
"rect": [8, 8, 140, 20],
"reason": "geometry"
}
]
}
]
}
{
"layers": [
{
"name": "Scrolling Contents Layer",
"bounds": [800, 600],
"contentsOpaque": true,
"backgroundColor": "#FFFFFF",
"paintInvalidations": [
{
"object": "NGPhysicalLineBoxFragment",
"rect": [8, 68, 784, 20],
"reason": "geometry"
},
{
"object": "NGPhysicalLineBoxFragment",
"rect": [8, 8, 784, 20],
"reason": "geometry"
},
{
"object": "NGPhysicalTextFragment 'JOCULAR'",
"rect": [8, 68, 140, 20],
"reason": "geometry"
},
{
"object": "NGPhysicalTextFragment 'JOCULAR'",
"rect": [8, 8, 140, 20],
"reason": "geometry"
}
]
}
]
}
{
"layers": [
{
"name": "Scrolling Contents Layer",
"bounds": [800, 600],
"contentsOpaque": true,
"backgroundColor": "#FFFFFF",
"paintInvalidations": [
{
"object": "NGPhysicalLineBoxFragment",
"rect": [8, 68, 784, 20],
"reason": "geometry"
},
{
"object": "NGPhysicalLineBoxFragment",
"rect": [8, 8, 784, 20],
"reason": "geometry"
},
{
"object": "NGPhysicalTextFragment 'JOCULAR'",
"rect": [8, 68, 140, 20],
"reason": "geometry"
},
{
"object": "NGPhysicalTextFragment 'JOCULAR'",
"rect": [8, 8, 140, 20],
"reason": "geometry"
}
]
}
]
}
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