Commit c0b2c83e authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

cbui: partly disable WebDialogBrowserTest.SizeWindow on macOS 11

We don't yet understand why the window position is wrong on macOS 11,
so disable that part of the test for now.

Bug: 1101398
Change-Id: Ic6c29b60fb5c80ee8efb2be8dc1caef8d206e3bc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2354418Reviewed-by: default avatarLeonard Grey <lgrey@chromium.org>
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#798091}
parent 3f5785f2
...@@ -30,6 +30,10 @@ ...@@ -30,6 +30,10 @@
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
#include "ui/web_dialogs/test/test_web_dialog_delegate.h" #include "ui/web_dialogs/test/test_web_dialog_delegate.h"
#if defined(OS_MAC)
#include "base/mac/mac_util.h"
#endif
namespace { namespace {
// Initial size of WebDialog for SizeWindow test case. Note the height must be // Initial size of WebDialog for SizeWindow test case. Note the height must be
...@@ -141,6 +145,15 @@ void WebDialogBrowserTest::SimulateEscapeKey() { ...@@ -141,6 +145,15 @@ void WebDialogBrowserTest::SimulateEscapeKey() {
#define MAYBE_SizeWindow SizeWindow #define MAYBE_SizeWindow SizeWindow
#endif #endif
IN_PROC_BROWSER_TEST_F(WebDialogBrowserTest, MAYBE_SizeWindow) { IN_PROC_BROWSER_TEST_F(WebDialogBrowserTest, MAYBE_SizeWindow) {
bool should_check_position = true;
#if defined(OS_MAC)
// On macOS 11, for reasons not yet known, the window ends up at a different
// position than we expect. The size is still correct.
// TODO(https://crbug.com/1101398): Remove this hack.
if (base::mac::IsAtLeastOS11())
should_check_position = false;
#endif
// TestWebDialogView should quit current message loop on size change. // TestWebDialogView should quit current message loop on size change.
view_->set_should_quit_on_size_change(true); view_->set_should_quit_on_size_change(true);
...@@ -151,13 +164,20 @@ IN_PROC_BROWSER_TEST_F(WebDialogBrowserTest, MAYBE_SizeWindow) { ...@@ -151,13 +164,20 @@ IN_PROC_BROWSER_TEST_F(WebDialogBrowserTest, MAYBE_SizeWindow) {
set_bounds.set_width(400); set_bounds.set_width(400);
set_bounds.set_height(300); set_bounds.set_height(300);
auto check_bounds = [&](const gfx::Rect& set, const gfx::Rect& actual) {
if (should_check_position)
EXPECT_EQ(set, actual);
else
EXPECT_EQ(set.size(), actual.size());
};
// WebDialogView ignores the WebContents* |source| argument to // WebDialogView ignores the WebContents* |source| argument to
// SetContentsBounds. We could pass view_->web_contents(), but it's not // SetContentsBounds. We could pass view_->web_contents(), but it's not
// relevant for the test. // relevant for the test.
view_->SetContentsBounds(nullptr, set_bounds); view_->SetContentsBounds(nullptr, set_bounds);
base::RunLoop().Run(); // TestWebDialogView will quit. base::RunLoop().Run(); // TestWebDialogView will quit.
actual_bounds = view_->GetWidget()->GetClientAreaBoundsInScreen(); actual_bounds = view_->GetWidget()->GetClientAreaBoundsInScreen();
EXPECT_EQ(set_bounds, actual_bounds); check_bounds(set_bounds, actual_bounds);
rwhv_bounds = rwhv_bounds =
view_->web_contents()->GetRenderWidgetHostView()->GetViewBounds(); view_->web_contents()->GetRenderWidgetHostView()->GetViewBounds();
...@@ -173,7 +193,7 @@ IN_PROC_BROWSER_TEST_F(WebDialogBrowserTest, MAYBE_SizeWindow) { ...@@ -173,7 +193,7 @@ IN_PROC_BROWSER_TEST_F(WebDialogBrowserTest, MAYBE_SizeWindow) {
view_->SetContentsBounds(nullptr, set_bounds); view_->SetContentsBounds(nullptr, set_bounds);
base::RunLoop().Run(); // TestWebDialogView will quit. base::RunLoop().Run(); // TestWebDialogView will quit.
actual_bounds = view_->GetWidget()->GetClientAreaBoundsInScreen(); actual_bounds = view_->GetWidget()->GetClientAreaBoundsInScreen();
EXPECT_EQ(set_bounds, actual_bounds); check_bounds(set_bounds, actual_bounds);
rwhv_bounds = rwhv_bounds =
view_->web_contents()->GetRenderWidgetHostView()->GetViewBounds(); view_->web_contents()->GetRenderWidgetHostView()->GetViewBounds();
...@@ -192,7 +212,7 @@ IN_PROC_BROWSER_TEST_F(WebDialogBrowserTest, MAYBE_SizeWindow) { ...@@ -192,7 +212,7 @@ IN_PROC_BROWSER_TEST_F(WebDialogBrowserTest, MAYBE_SizeWindow) {
view_->SetContentsBounds(nullptr, set_bounds); view_->SetContentsBounds(nullptr, set_bounds);
base::RunLoop().Run(); // TestWebDialogView will quit. base::RunLoop().Run(); // TestWebDialogView will quit.
actual_bounds = view_->GetWidget()->GetClientAreaBoundsInScreen(); actual_bounds = view_->GetWidget()->GetClientAreaBoundsInScreen();
EXPECT_EQ(set_bounds, actual_bounds); check_bounds(set_bounds, actual_bounds);
rwhv_bounds = rwhv_bounds =
view_->web_contents()->GetRenderWidgetHostView()->GetViewBounds(); view_->web_contents()->GetRenderWidgetHostView()->GetViewBounds();
...@@ -207,7 +227,7 @@ IN_PROC_BROWSER_TEST_F(WebDialogBrowserTest, MAYBE_SizeWindow) { ...@@ -207,7 +227,7 @@ IN_PROC_BROWSER_TEST_F(WebDialogBrowserTest, MAYBE_SizeWindow) {
view_->SetContentsBounds(nullptr, set_bounds); view_->SetContentsBounds(nullptr, set_bounds);
base::RunLoop().Run(); // TestWebDialogView will quit. base::RunLoop().Run(); // TestWebDialogView will quit.
actual_bounds = view_->GetWidget()->GetClientAreaBoundsInScreen(); actual_bounds = view_->GetWidget()->GetClientAreaBoundsInScreen();
EXPECT_EQ(set_bounds, actual_bounds); check_bounds(set_bounds, actual_bounds);
// Now verify that attempts to re-size to 0x0 enforces the minimum size. // Now verify that attempts to re-size to 0x0 enforces the minimum size.
set_bounds.set_width(0); set_bounds.set_width(0);
......
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