| 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 5d8ed27de137ba92a423aed57848b3a36a7a1869..cfb6be87b0d257baf782b4bc6eae55ba291a51e7 100644
|
| --- a/ui/aura/mus/window_tree_client_unittest.cc
|
| +++ b/ui/aura/mus/window_tree_client_unittest.cc
|
| @@ -223,6 +223,41 @@ TEST_F(WindowTreeClientWmTest, SetBoundsFailedLocalSurfaceId) {
|
| EXPECT_FALSE(window_mus->GetLocalSurfaceId().is_valid());
|
| }
|
|
|
| +// Verifies that a ClientSurfaceEmbedder is created for a window once it has
|
| +// a bounds, a valid FrameSinkId and is visible.
|
| +TEST_F(WindowTreeClientWmTest, ClientSurfaceEmbedderOnValidEmbedding) {
|
| + Window window(nullptr);
|
| + // TOP_LEVEL_IN_WM and EMBED_IN_OWNER windows allocate cc::LocalSurfaceIds
|
| + // when their sizes change.
|
| + window.SetProperty(aura::client::kEmbedType,
|
| + aura::client::WindowEmbedType::EMBED_IN_OWNER);
|
| + window.Init(ui::LAYER_NOT_DRAWN);
|
| +
|
| + const 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());
|
| + WindowMus* window_mus = WindowMus::Get(&window);
|
| + ASSERT_NE(nullptr, window_mus);
|
| + EXPECT_TRUE(window_mus->GetLocalSurfaceId().is_valid());
|
| +
|
| + // An ClientSurfaceEmbedder isn't created UNTIL the window is visible and has
|
| + // a valid FrameSinkId.
|
| + WindowPortMus* window_port_mus = WindowPortMus::Get(&window);
|
| + ASSERT_NE(nullptr, window_port_mus);
|
| + EXPECT_EQ(nullptr, window_port_mus->client_surface_embedder());
|
| +
|
| + // The window is now visible, but doesn't yet have a FrameSinkId.
|
| + window.Show();
|
| + EXPECT_EQ(nullptr, window_port_mus->client_surface_embedder());
|
| +
|
| + // Now that the window has a valid FrameSinkId, it can embed the client in a
|
| + // CompositorFrame.
|
| + window_tree_client()->OnFrameSinkIdAllocated(server_id(&window),
|
| + cc::FrameSinkId(1, 1));
|
| + EXPECT_NE(nullptr, window_port_mus->client_surface_embedder());
|
| +}
|
| +
|
| // Verifies that the cc::LocalSurfaceId generated by an embedder changes when
|
| // the size changes, but not when the position changes.
|
| TEST_F(WindowTreeClientWmTest, SetBoundsLocalSurfaceIdChanges) {
|
|
|