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

views: fix NativeViewHostMacTest.ContentViewPositionAndSize on Big Sur

This test needs to be updated for Big Sur's new visual style.

Bug: 1101415
Change-Id: Iea580bdef7828e79e73a453443958152a1aa33ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2314999
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791278}
parent b8c54296
......@@ -8,6 +8,7 @@
#include <memory>
#include "base/mac/mac_util.h"
#import "base/mac/scoped_nsobject.h"
#include "base/macros.h"
#import "testing/gtest_mac.h"
......@@ -161,13 +162,17 @@ TEST_F(NativeViewHostMacTest, ContentViewPositionAndSize) {
CreateHost();
toplevel()->SetBounds(gfx::Rect(0, 0, 100, 100));
// TODO(amp): Update expect rect after Mac native size is implemented.
// For now the native size is ignored on mac.
// The new visual style on macOS 11 (and presumably later) has slightly taller
// titlebars, which means the window rect has to leave a bit of extra space
// for the titlebar.
int titlebar_extra = base::mac::IsAtLeastOS11() ? 6 : 0;
native_host()->ShowWidget(5, 10, 100, 100, 200, 200);
EXPECT_NSEQ(NSMakeRect(5, -32, 100, 100), [native_view_ frame]);
EXPECT_NSEQ(NSMakeRect(5, -32 - titlebar_extra, 100, 100),
[native_view_ frame]);
native_host()->ShowWidget(10, 25, 50, 50, 50, 50);
EXPECT_NSEQ(NSMakeRect(10, 3, 50, 50), [native_view_ frame]);
EXPECT_NSEQ(NSMakeRect(10, 3 - titlebar_extra, 50, 50), [native_view_ frame]);
DestroyHost();
}
......
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