| 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 a2b76d0ce99aeea5d162dfb0131e29f736337ae8..3e8b5d871cca250f1e386b6d006b944e981eff4a 100644
|
| --- a/ui/aura/mus/window_tree_client_unittest.cc
|
| +++ b/ui/aura/mus/window_tree_client_unittest.cc
|
| @@ -104,16 +104,19 @@ std::vector<uint8_t> ConvertToPropertyTransportValue(int64_t value) {
|
| using WindowTreeClientWmTest = test::AuraMusWmTestBase;
|
| using WindowTreeClientClientTest = test::AuraMusClientTestBase;
|
|
|
| -// WindowTreeClientWmTest with --enable-surface-synchronization.
|
| -class WindowTreeClientWmTestSurfaceSync : public WindowTreeClientWmTest {
|
| +class WindowTreeClientWmTestSurfaceSync
|
| + : public WindowTreeClientWmTest,
|
| + public ::testing::WithParamInterface<bool> {
|
| public:
|
| WindowTreeClientWmTestSurfaceSync() {}
|
| ~WindowTreeClientWmTestSurfaceSync() override {}
|
|
|
| // WindowTreeClientWmTest:
|
| void SetUp() override {
|
| - base::CommandLine::ForCurrentProcess()->AppendSwitch(
|
| - cc::switches::kEnableSurfaceSynchronization);
|
| + if (GetParam()) {
|
| + base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
|
| + switches::kForceDeviceScaleFactor, "2");
|
| + }
|
| WindowTreeClientWmTest::SetUp();
|
| }
|
|
|
| @@ -204,9 +207,13 @@ TEST_F(WindowTreeClientWmTest, SetBoundsFailedLocalSurfaceId) {
|
| EXPECT_FALSE(window_mus->GetLocalSurfaceId().is_valid());
|
| }
|
|
|
| +INSTANTIATE_TEST_CASE_P(/* no prefix */,
|
| + WindowTreeClientWmTestSurfaceSync,
|
| + ::testing::Bool());
|
| +
|
| // Verifies that a ClientSurfaceEmbedder is created for a window once it has
|
| // a bounds, and a valid FrameSinkId.
|
| -TEST_F(WindowTreeClientWmTestSurfaceSync,
|
| +TEST_P(WindowTreeClientWmTestSurfaceSync,
|
| ClientSurfaceEmbedderOnValidEmbedding) {
|
| Window window(nullptr);
|
| // TOP_LEVEL_IN_WM and EMBED_IN_OWNER windows allocate cc::LocalSurfaceIds
|
| @@ -219,7 +226,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 +247,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,11 +265,30 @@ 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
|
| // the size changes, but not when the position changes.
|
| -TEST_F(WindowTreeClientWmTest, SetBoundsLocalSurfaceIdChanges) {
|
| +TEST_P(WindowTreeClientWmTestSurfaceSync, SetBoundsLocalSurfaceIdChanges) {
|
| ASSERT_EQ(base::nullopt, window_tree()->last_local_surface_id());
|
| Window window(nullptr);
|
| // TOP_LEVEL_IN_WM and EMBED_IN_OWNER windows allocate cc::LocalSurfaceIds
|
|
|