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

Unified Diff: ui/compositor/compositor_unittest.cc

Issue 2270573002: cc: Get rid of LayerTreeHost::output_surface_lost_ state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@renderer-caps
Patch Set: lth-outputsurface-lost: android-build-and-earlyout-sooner Created 4 years, 4 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/compositor/compositor.cc ('k') | ui/views/examples/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/compositor_unittest.cc
diff --git a/ui/compositor/compositor_unittest.cc b/ui/compositor/compositor_unittest.cc
index dd7ac5699d6a55ed05b549451fa06eb62cf5c15c..1a7aad2fe741576b848385ab23868830e22f8911 100644
--- a/ui/compositor/compositor_unittest.cc
+++ b/ui/compositor/compositor_unittest.cc
@@ -129,71 +129,6 @@ TEST_F(CompositorTest, ReleaseWidgetWithOutputSurfaceNeverCreated) {
compositor()->SetVisible(true);
}
-TEST_F(CompositorTest, SurfaceClients) {
- const uint32_t kClientId1 =
- compositor()->surface_id_allocator()->client_id() + 1;
- const uint32_t kClientId2 =
- compositor()->surface_id_allocator()->client_id() + 2;
- const uint32_t kClientId3 =
- compositor()->surface_id_allocator()->client_id() + 3;
- cc::SurfaceManager* manager =
- compositor()->context_factory()->GetSurfaceManager();
- FakeCompositorFrameSink client1(kClientId1, manager);
- FakeCompositorFrameSink client2(kClientId2, manager);
- FakeCompositorFrameSink client3(kClientId3, manager);
- const uint32_t kNoClient = 0;
-
- compositor()->AddSurfaceClient(kClientId1);
- compositor()->AddSurfaceClient(kClientId2);
- compositor()->AddSurfaceClient(kClientId3);
-
- const std::unordered_map<uint32_t, uint32_t>& surface_clients =
- compositor()->SurfaceClientsForTesting();
- EXPECT_EQ(3u, surface_clients.size());
- EXPECT_NE(surface_clients.end(), surface_clients.find(kClientId1));
- EXPECT_NE(surface_clients.end(), surface_clients.find(kClientId2));
- EXPECT_NE(surface_clients.end(), surface_clients.find(kClientId3));
-
- // Verify that the clients haven't been assigned a parent compositor yet.
- EXPECT_EQ(kNoClient, surface_clients.find(kClientId1)->second);
- EXPECT_EQ(kNoClient, surface_clients.find(kClientId2)->second);
- EXPECT_EQ(kNoClient, surface_clients.find(kClientId3)->second);
-
- // This will trigger the creation of an OutputSurface and then
- // assignment of a surface hierarchy.
- std::unique_ptr<Layer> root_layer(new Layer(ui::LAYER_SOLID_COLOR));
- root_layer->SetBounds(gfx::Rect(10, 10));
- compositor()->SetRootLayer(root_layer.get());
- compositor()->SetScaleAndSize(1.0f, gfx::Size(10, 10));
- compositor()->SetVisible(true);
- compositor()->ScheduleDraw();
- DrawWaiterForTest::WaitForCompositingEnded(compositor());
-
- // Verify that the clients have been assigned a parent compositor.
- EXPECT_EQ(compositor()->surface_id_allocator()->client_id(),
- surface_clients.find(kClientId1)->second);
- EXPECT_EQ(compositor()->surface_id_allocator()->client_id(),
- surface_clients.find(kClientId2)->second);
- EXPECT_EQ(compositor()->surface_id_allocator()->client_id(),
- surface_clients.find(kClientId3)->second);
-
- // Remove a client while the parent compositor has an OutputSurface.
- compositor()->RemoveSurfaceClient(kClientId3);
- EXPECT_EQ(surface_clients.end(), surface_clients.find(kClientId3));
-
- // This will remove parent compositor from the surface hierarchy.
- compositor()->SetVisible(false);
- compositor()->ReleaseAcceleratedWidget();
- EXPECT_EQ(kNoClient, surface_clients.find(kClientId1)->second);
- EXPECT_EQ(kNoClient, surface_clients.find(kClientId2)->second);
-
- // Remove a client after the OutputSurface has been dropped.
- compositor()->RemoveSurfaceClient(kClientId2);
- EXPECT_EQ(surface_clients.end(), surface_clients.find(kClientId2));
-
- // The remaining client will be cleared during destruction.
-}
-
#if defined(OS_WIN)
// TODO(crbug.com/608436): Flaky on windows trybots
#define MAYBE_CreateAndReleaseOutputSurface \
« no previous file with comments | « ui/compositor/compositor.cc ('k') | ui/views/examples/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698