Chromium Code Reviews| 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..1efe158a129ab6d2cff196bd1f0eaffd38f79bc8 100644 |
| --- a/ui/aura/mus/window_tree_client_unittest.cc |
| +++ b/ui/aura/mus/window_tree_client_unittest.cc |
| @@ -104,16 +104,21 @@ 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 { |
| +enum class UseHighDPI { YES, NO }; |
| + |
| +class WindowTreeClientWmTestSurfaceSync |
| + : public WindowTreeClientWmTest, |
| + public ::testing::WithParamInterface<UseHighDPI> { |
|
sadrul
2017/05/30 21:33:26
Just use WithParamInterface<bool>?
Fady Samuel
2017/05/30 21:40:22
Done.
|
| public: |
| WindowTreeClientWmTestSurfaceSync() {} |
| ~WindowTreeClientWmTestSurfaceSync() override {} |
| // WindowTreeClientWmTest: |
| void SetUp() override { |
| - base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| - cc::switches::kEnableSurfaceSynchronization); |
| + if (GetParam() == UseHighDPI::YES) { |
| + base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| + switches::kForceDeviceScaleFactor, "2"); |
| + } |
| WindowTreeClientWmTest::SetUp(); |
| } |
| @@ -204,9 +209,13 @@ TEST_F(WindowTreeClientWmTest, SetBoundsFailedLocalSurfaceId) { |
| EXPECT_FALSE(window_mus->GetLocalSurfaceId().is_valid()); |
| } |
| +INSTANTIATE_TEST_CASE_P(/* no prefix */, |
| + WindowTreeClientWmTestSurfaceSync, |
| + ::testing::Values(UseHighDPI::YES, UseHighDPI::NO)); |
|
sadrul
2017/05/30 21:33:26
::testing::Bool()
Fady Samuel
2017/05/30 21:40:22
Done.
|
| + |
| // 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 +228,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 +249,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 +267,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 |