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

Unified Diff: cc/surfaces/compositor_frame_sink_support_unittest.cc

Issue 2794993002: Revert of SurfaceManager::CreateSurface must set the surface's factory (Closed)
Patch Set: Rebase Created 3 years, 9 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 | « no previous file | cc/surfaces/surface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/compositor_frame_sink_support_unittest.cc
diff --git a/cc/surfaces/compositor_frame_sink_support_unittest.cc b/cc/surfaces/compositor_frame_sink_support_unittest.cc
index 1f680b1e68ea144f900d4fcea0b88cac1d48490b..0b90827be3054e7968d9b949d8379c92887791e1 100644
--- a/cc/surfaces/compositor_frame_sink_support_unittest.cc
+++ b/cc/surfaces/compositor_frame_sink_support_unittest.cc
@@ -166,15 +166,6 @@ class CompositorFrameSinkSupportTest : public testing::Test {
return begin_frame_source_.get();
}
- std::unique_ptr<CompositorFrameSinkSupport> CreateCompositorFrameSinkSupport(
- FrameSinkId frame_sink_id,
- bool is_root = false) {
- return base::MakeUnique<CompositorFrameSinkSupport>(
- &support_client_, &surface_manager_, frame_sink_id, is_root,
- true /* handles_frame_sink_id_invalidation */,
- true /* needs_sync_points */);
- }
-
// testing::Test:
void SetUp() override {
testing::Test::SetUp();
@@ -184,11 +175,23 @@ class CompositorFrameSinkSupportTest : public testing::Test {
new SurfaceDependencyTracker(&surface_manager_,
begin_frame_source_.get()));
surface_manager_.SetDependencyTracker(std::move(dependency_tracker));
- supports_.push_back(CreateCompositorFrameSinkSupport(kDisplayFrameSink,
- true /* is_root */));
- supports_.push_back(CreateCompositorFrameSinkSupport(kParentFrameSink));
- supports_.push_back(CreateCompositorFrameSinkSupport(kChildFrameSink1));
- supports_.push_back(CreateCompositorFrameSinkSupport(kChildFrameSink2));
+ supports_.push_back(base::MakeUnique<CompositorFrameSinkSupport>(
+ &support_client_, &surface_manager_, kDisplayFrameSink,
+ true /* is_root */, true /* handles_frame_sink_id_invalidation */,
+ true /* needs_sync_points */));
+ supports_.push_back(base::MakeUnique<CompositorFrameSinkSupport>(
+ &support_client_, &surface_manager_, kParentFrameSink,
+ false /* is_root */, true /* handles_frame_sink_id_invalidation */,
+ true /* needs_sync_points */));
+ supports_.push_back(base::MakeUnique<CompositorFrameSinkSupport>(
+ &support_client_, &surface_manager_, kChildFrameSink1,
+ false /* is_root */, true /* handles_frame_sink_id_invalidation */,
+ true /* needs_sync_points */));
+ supports_.push_back(base::MakeUnique<CompositorFrameSinkSupport>(
+ &support_client_, &surface_manager_, kChildFrameSink2,
+ false /* is_root */, true /* handles_frame_sink_id_invalidation */,
+ true /* needs_sync_points */));
+
// Normally, the BeginFrameSource would be registered by the Display. We
// register it here so that BeginFrames are received by the display support,
// for use in the PassesOnBeginFrameAcks test. Other supports do not receive
@@ -1064,45 +1067,6 @@ TEST_F(CompositorFrameSinkSupportTest, LocalSurfaceIdIsReusable) {
EXPECT_NE(nullptr, surface_manager().GetSurfaceForId(child_id));
}
-// Checks whether a LocalSurfaceId can be reused after the
-// CompositorFrameSinkSupport is destroyed and recreated with the same
-// FrameSinkId.
-TEST_F(CompositorFrameSinkSupportTest, ReuseSurfaceAfterSupportDestroyed) {
- const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1);
- const SurfaceId child_id = MakeSurfaceId(kArbitraryFrameSink, 1);
- std::unique_ptr<CompositorFrameSinkSupport> child_support =
- CreateCompositorFrameSinkSupport(kArbitraryFrameSink);
-
- // Add a reference from parent to child to preserve the child surface.
- parent_support().SubmitCompositorFrame(parent_id.local_surface_id(),
- MakeCompositorFrame({child_id}));
-
- // Submit the first frame. A surface must be created.
- child_support->SubmitCompositorFrame(
- child_id.local_surface_id(), MakeCompositorFrame(empty_surface_ids()));
- Surface* surface = surface_manager().GetSurfaceForId(child_id);
- ASSERT_TRUE(surface);
- base::WeakPtr<SurfaceFactory> factory = surface->factory();
- EXPECT_TRUE(factory);
- EXPECT_FALSE(surface->destroyed());
-
- // Recreate child_support. The surface must be marked as destroyed and its
- // factory must be gone.
- child_support.reset();
- child_support = CreateCompositorFrameSinkSupport(kArbitraryFrameSink);
- EXPECT_EQ(surface, surface_manager().GetSurfaceForId(child_id));
- EXPECT_FALSE(factory);
- EXPECT_TRUE(surface->destroyed());
-
- // Submit another frame for the same local surface id. The same surface must
- // be used and destroyed() must return false. The surface must have a factory.
- child_support->SubmitCompositorFrame(
- child_id.local_surface_id(), MakeCompositorFrame(empty_surface_ids()));
- EXPECT_EQ(surface, surface_manager().GetSurfaceForId(child_id));
- EXPECT_TRUE(surface->factory());
- EXPECT_FALSE(surface->destroyed());
-}
-
// This test verifies that a crash does not occur if garbage collection is
// triggered during surface dependency resolution. This test triggers garbage
// collection during surface resolution, by causing an activation to remove
« no previous file with comments | « no previous file | cc/surfaces/surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698