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

Side by Side Diff: cc/surfaces/compositor_frame_sink_support_unittest.cc

Issue 2807653003: Move Work From CompositorFrameSinkSupport() To Init() (Closed)
Patch Set: Add CompositorFrameSinkSupport::Create Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/surfaces/compositor_frame_sink_support.h" 5 #include "cc/surfaces/compositor_frame_sink_support.h"
6 6
7 #include "base/debug/stack_trace.h" 7 #include "base/debug/stack_trace.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "cc/output/compositor_frame.h" 9 #include "cc/output/compositor_frame.h"
10 #include "cc/surfaces/compositor_frame_sink_support_client.h" 10 #include "cc/surfaces/compositor_frame_sink_support_client.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 return *surface_manager_.dependency_tracker(); 173 return *surface_manager_.dependency_tracker();
174 } 174 }
175 175
176 FakeExternalBeginFrameSource* begin_frame_source() { 176 FakeExternalBeginFrameSource* begin_frame_source() {
177 return begin_frame_source_.get(); 177 return begin_frame_source_.get();
178 } 178 }
179 179
180 // testing::Test: 180 // testing::Test:
181 void SetUp() override { 181 void SetUp() override {
182 testing::Test::SetUp(); 182 testing::Test::SetUp();
183 constexpr bool is_root = true;
184 constexpr bool is_child_root = false;
185 constexpr bool handles_frame_sink_id_invalidation = true;
186 constexpr bool needs_sync_points = true;
183 begin_frame_source_ = 187 begin_frame_source_ =
184 base::MakeUnique<FakeExternalBeginFrameSource>(0.f, false); 188 base::MakeUnique<FakeExternalBeginFrameSource>(0.f, false);
185 surface_manager_.SetDependencyTracker( 189 surface_manager_.SetDependencyTracker(
186 base::MakeUnique<SurfaceDependencyTracker>(&surface_manager_, 190 base::MakeUnique<SurfaceDependencyTracker>(&surface_manager_,
187 begin_frame_source_.get())); 191 begin_frame_source_.get()));
188 supports_.push_back(base::MakeUnique<CompositorFrameSinkSupport>( 192 supports_.push_back(CompositorFrameSinkSupport::Create(
189 &support_client_, &surface_manager_, kDisplayFrameSink, 193 &support_client_, &surface_manager_, kDisplayFrameSink, is_root,
190 true /* is_root */, true /* handles_frame_sink_id_invalidation */, 194 handles_frame_sink_id_invalidation, needs_sync_points));
191 true /* needs_sync_points */)); 195 supports_.push_back(CompositorFrameSinkSupport::Create(
192 supports_.push_back(base::MakeUnique<CompositorFrameSinkSupport>( 196 &support_client_, &surface_manager_, kParentFrameSink, is_child_root,
193 &support_client_, &surface_manager_, kParentFrameSink, 197 handles_frame_sink_id_invalidation, needs_sync_points));
194 false /* is_root */, true /* handles_frame_sink_id_invalidation */, 198 supports_.push_back(CompositorFrameSinkSupport::Create(
195 true /* needs_sync_points */)); 199 &support_client_, &surface_manager_, kChildFrameSink1, is_child_root,
196 supports_.push_back(base::MakeUnique<CompositorFrameSinkSupport>( 200 handles_frame_sink_id_invalidation, needs_sync_points));
197 &support_client_, &surface_manager_, kChildFrameSink1, 201 supports_.push_back(CompositorFrameSinkSupport::Create(
198 false /* is_root */, true /* handles_frame_sink_id_invalidation */, 202 &support_client_, &surface_manager_, kChildFrameSink2, is_child_root,
199 true /* needs_sync_points */)); 203 handles_frame_sink_id_invalidation, needs_sync_points));
200 supports_.push_back(base::MakeUnique<CompositorFrameSinkSupport>(
201 &support_client_, &surface_manager_, kChildFrameSink2,
202 false /* is_root */, true /* handles_frame_sink_id_invalidation */,
203 true /* needs_sync_points */));
204 204
205 // Normally, the BeginFrameSource would be registered by the Display. We 205 // Normally, the BeginFrameSource would be registered by the Display. We
206 // register it here so that BeginFrames are received by the display support, 206 // register it here so that BeginFrames are received by the display support,
207 // for use in the PassesOnBeginFrameAcks test. Other supports do not receive 207 // for use in the PassesOnBeginFrameAcks test. Other supports do not receive
208 // BeginFrames, since the frame sink hierarchy is not set up in this test. 208 // BeginFrames, since the frame sink hierarchy is not set up in this test.
209 surface_manager_.RegisterBeginFrameSource(begin_frame_source_.get(), 209 surface_manager_.RegisterBeginFrameSource(begin_frame_source_.get(),
210 kDisplayFrameSink); 210 kDisplayFrameSink);
211 } 211 }
212 212
213 void TearDown() override { 213 void TearDown() override {
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 EXPECT_FALSE(dependency_tracker().has_deadline()); 1237 EXPECT_FALSE(dependency_tracker().has_deadline());
1238 EXPECT_FALSE(display_surface()->HasPendingFrame()); 1238 EXPECT_FALSE(display_surface()->HasPendingFrame());
1239 EXPECT_TRUE(display_surface()->HasActiveFrame()); 1239 EXPECT_TRUE(display_surface()->HasActiveFrame());
1240 EXPECT_THAT(display_surface()->blocking_surfaces(), IsEmpty()); 1240 EXPECT_THAT(display_surface()->blocking_surfaces(), IsEmpty());
1241 EXPECT_THAT(GetChildReferences(display_id), 1241 EXPECT_THAT(GetChildReferences(display_id),
1242 UnorderedElementsAre(parent_id1, parent_id2)); 1242 UnorderedElementsAre(parent_id1, parent_id2));
1243 } 1243 }
1244 1244
1245 } // namespace test 1245 } // namespace test
1246 } // namespace cc 1246 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/compositor_frame_sink_support.cc ('k') | cc/surfaces/direct_compositor_frame_sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698