Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Unified Diff: ui/aura/mus/window_tree_client_unittest.cc

Issue 2873473002: Aura-Mus: Fix high-DPI gutter (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura/mus/window_port_mus.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/mus/window_tree_client_unittest.cc
diff --git a/ui/aura/mus/window_tree_client_unittest.cc b/ui/aura/mus/window_tree_client_unittest.cc
index 887b9927c7729eb1cf20f09f77b473ab5a3aa265..ccd9db5d38e4fbdbc66b7e6211ad5d0eb52d1ae1 100644
--- a/ui/aura/mus/window_tree_client_unittest.cc
+++ b/ui/aura/mus/window_tree_client_unittest.cc
@@ -114,6 +114,8 @@ class WindowTreeClientWmTestSurfaceSync : public WindowTreeClientWmTest {
void SetUp() override {
base::CommandLine::ForCurrentProcess()->AppendSwitch(
cc::switches::kEnableSurfaceSynchronization);
+ base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
+ switches::kForceDeviceScaleFactor, "2");
sadrul 2017/05/09 15:04:59 This makes all tests run in high-dpi. Can you crea
Fady Samuel 2017/05/30 21:30:08 Done.
WindowTreeClientWmTest::SetUp();
}
@@ -219,7 +221,7 @@ TEST_F(WindowTreeClientWmTestSurfaceSync,
WindowMus* window_mus = WindowMus::Get(&window);
ASSERT_NE(nullptr, window_mus);
EXPECT_FALSE(window_mus->GetLocalSurfaceId().is_valid());
- const gfx::Rect new_bounds(gfx::Rect(0, 0, 100, 100));
+ gfx::Rect new_bounds(gfx::Rect(0, 0, 100, 100));
ASSERT_NE(new_bounds, window.bounds());
window.SetBounds(new_bounds);
EXPECT_EQ(new_bounds, window.bounds());
@@ -240,12 +242,14 @@ TEST_F(WindowTreeClientWmTestSurfaceSync,
ASSERT_NE(nullptr, client_surface_embedder);
// Until the fallback surface fills the window, we will have gutter.
- ui::Layer* right_gutter = client_surface_embedder->RightGutterForTesting();
- ASSERT_NE(nullptr, right_gutter);
- EXPECT_EQ(gfx::Rect(100, 100), right_gutter->bounds());
- // We don't have a bottom gutter if the fallback surface size is (0, 0) as the
- // right gutter will fill the whole area.
- ASSERT_EQ(nullptr, client_surface_embedder->BottomGutterForTesting());
+ {
+ ui::Layer* right_gutter = client_surface_embedder->RightGutterForTesting();
+ ASSERT_NE(nullptr, right_gutter);
+ EXPECT_EQ(gfx::Rect(100, 100), right_gutter->bounds());
+ // We don't have a bottom gutter if the fallback surface size is (0, 0) as
+ // the right gutter will fill the whole area.
+ ASSERT_EQ(nullptr, client_surface_embedder->BottomGutterForTesting());
+ }
// When a SurfaceInfo arrives from the window server, we use it as the
// fallback SurfaceInfo. Here we issue the PrimarySurfaceInfo back to the
@@ -256,6 +260,25 @@ TEST_F(WindowTreeClientWmTestSurfaceSync,
// The gutter is gone.
ASSERT_EQ(nullptr, client_surface_embedder->BottomGutterForTesting());
ASSERT_EQ(nullptr, client_surface_embedder->RightGutterForTesting());
+
+ // Resize again: we should have gutter.
+ new_bounds.SetRect(0, 0, 150, 150);
+ ASSERT_NE(new_bounds, window.bounds());
+ window.SetBounds(new_bounds);
+ ASSERT_NE(nullptr, client_surface_embedder->BottomGutterForTesting());
+ ASSERT_NE(nullptr, client_surface_embedder->RightGutterForTesting());
+
+ // Until the fallback surface fills the window, we will have gutter.
+ {
+ ui::Layer* right_gutter = client_surface_embedder->RightGutterForTesting();
+ ASSERT_NE(nullptr, right_gutter);
+ EXPECT_EQ(gfx::Rect(100, 0, 50, 150), right_gutter->bounds());
+
+ ui::Layer* bottom_gutter =
+ client_surface_embedder->BottomGutterForTesting();
+ ASSERT_NE(nullptr, bottom_gutter);
+ EXPECT_EQ(gfx::Rect(0, 100, 100, 50), bottom_gutter->bounds());
+ }
}
// Verifies that the cc::LocalSurfaceId generated by an embedder changes when
« no previous file with comments | « ui/aura/mus/window_port_mus.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698