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

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

Issue 2638833002: Moving temporary reference logic to SurfaceManager (Closed)
Patch Set: c Created 3 years, 11 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <unordered_map> 7 #include <unordered_map>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "cc/surfaces/surface.h" 11 #include "cc/surfaces/surface.h"
12 #include "cc/surfaces/surface_factory.h" 12 #include "cc/surfaces/surface_factory.h"
13 #include "cc/surfaces/surface_factory_client.h" 13 #include "cc/surfaces/surface_factory_client.h"
14 #include "cc/surfaces/surface_id.h" 14 #include "cc/surfaces/surface_id.h"
15 #include "cc/surfaces/surface_manager.h" 15 #include "cc/surfaces/surface_manager.h"
16 #include "cc/surfaces/surface_sequence_generator.h" 16 #include "cc/surfaces/surface_sequence_generator.h"
17 #include "testing/gmock/include/gmock/gmock.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19
20 using testing::ElementsAre;
21 using testing::UnorderedElementsAre;
22
18 namespace cc { 23 namespace cc {
24
19 namespace { 25 namespace {
20 26
21 constexpr FrameSinkId kFrameSink1(1, 0); 27 constexpr FrameSinkId kFrameSink1(1, 0);
22 constexpr FrameSinkId kFrameSink2(2, 0); 28 constexpr FrameSinkId kFrameSink2(2, 0);
23 constexpr FrameSinkId kFrameSink3(3, 0); 29 constexpr FrameSinkId kFrameSink3(3, 0);
24 const LocalFrameId kLocalFrame1(1, base::UnguessableToken::Create()); 30 const LocalFrameId kLocalFrame1(1, base::UnguessableToken::Create());
25 const LocalFrameId kLocalFrame2(2, base::UnguessableToken::Create()); 31 const LocalFrameId kLocalFrame2(2, base::UnguessableToken::Create());
26 32
27 class StubSurfaceFactoryClient : public SurfaceFactoryClient { 33 class StubSurfaceFactoryClient : public SurfaceFactoryClient {
28 public: 34 public:
29 void ReturnResources(const ReturnedResourceArray& resources) override {} 35 void ReturnResources(const ReturnedResourceArray& resources) override {}
30 void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override {} 36 void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override {}
31 }; 37 };
32 38
39 } // namespace
40
33 // Tests for reference tracking in SurfaceManager. 41 // Tests for reference tracking in SurfaceManager.
34 class SurfaceManagerRefTest : public testing::Test { 42 class SurfaceManagerRefTest : public testing::Test {
35 public: 43 public:
36 SurfaceManager& manager() { return *manager_; } 44 SurfaceManager& manager() { return *manager_; }
37 45
38 // Creates a new Surface with the provided SurfaceId. Will first create the 46 // Creates a new Surface with the provided SurfaceId. Will first create the
39 // SurfaceFactory for |frame_sink_id| if necessary. 47 // SurfaceFactory for |frame_sink_id| if necessary.
40 SurfaceId CreateSurface(const FrameSinkId& frame_sink_id, 48 SurfaceId CreateSurface(const FrameSinkId& frame_sink_id,
41 const LocalFrameId& local_frame_id) { 49 const LocalFrameId& local_frame_id) {
42 GetFactory(frame_sink_id) 50 GetFactory(frame_sink_id)
43 .SubmitCompositorFrame(local_frame_id, CompositorFrame(), 51 .SubmitCompositorFrame(local_frame_id, CompositorFrame(),
44 SurfaceFactory::DrawCallback()); 52 SurfaceFactory::DrawCallback());
45 return SurfaceId(frame_sink_id, local_frame_id); 53 return SurfaceId(frame_sink_id, local_frame_id);
46 } 54 }
47 55
56 SurfaceId CreateSurface(uint32_t client_id,
57 uint32_t sink_id,
58 uint32_t local_id) {
59 return CreateSurface(
60 FrameSinkId(client_id, sink_id),
61 LocalFrameId(local_id, base::UnguessableToken::Deserialize(0, 1u)));
62 }
63
48 // Destroy Surface with |surface_id|. 64 // Destroy Surface with |surface_id|.
49 void DestroySurface(const SurfaceId& surface_id) { 65 void DestroySurface(const SurfaceId& surface_id) {
50 GetFactory(surface_id.frame_sink_id()).EvictSurface(); 66 GetFactory(surface_id.frame_sink_id()).EvictSurface();
51 } 67 }
52 68
53 protected: 69 protected:
54 SurfaceFactory& GetFactory(const FrameSinkId& frame_sink_id) { 70 SurfaceFactory& GetFactory(const FrameSinkId& frame_sink_id) {
55 auto& factory_ptr = factories_[frame_sink_id]; 71 auto& factory_ptr = factories_[frame_sink_id];
56 if (!factory_ptr) 72 if (!factory_ptr)
57 factory_ptr = base::MakeUnique<SurfaceFactory>(frame_sink_id, 73 factory_ptr = base::MakeUnique<SurfaceFactory>(frame_sink_id,
58 manager_.get(), &client_); 74 manager_.get(), &client_);
59 return *factory_ptr; 75 return *factory_ptr;
60 } 76 }
61 77
62 // testing::Test: 78 // testing::Test:
63 void SetUp() override { 79 void SetUp() override {
64 // Start each test with a fresh SurfaceManager instance. 80 // Start each test with a fresh SurfaceManager instance.
65 manager_ = base::MakeUnique<SurfaceManager>(); 81 manager_ = base::MakeUnique<SurfaceManager>(
82 SurfaceManager::LifetimeType::REFERENCES);
66 } 83 }
67 void TearDown() override { 84 void TearDown() override {
68 for (auto& factory : factories_) 85 for (auto& factory : factories_)
69 factory.second->EvictSurface(); 86 factory.second->EvictSurface();
70 factories_.clear(); 87 factories_.clear();
71 manager_.reset(); 88 manager_.reset();
72 } 89 }
73 90
91 // Returns all the references from the given surface id.
92 SurfaceManager::SurfaceIdSet GetReferencesFor(const SurfaceId& surface_id) {
93 return manager().parent_to_child_refs_[surface_id];
94 }
95
96 SurfaceManager::SurfaceIdSet GetRootReferences() {
97 return GetReferencesFor(manager().GetRootSurfaceId());
98 }
99
100 // Returns all the temporary references for the given frame sink id.
101 std::vector<LocalFrameId> GetTempReferencesFor(
danakj 2017/01/17 21:56:42 nit: I would maybe name these methods Get*Referenc
Saman Sami 2017/01/18 18:03:36 For temp references, the name is correct, but GetR
102 const FrameSinkId& frame_sink_id) {
103 return manager().temp_references_[frame_sink_id];
104 }
105
106 // Temporary references are stored as a map in SurfaceManager. This method
107 // converts the map to a vector.
108 std::vector<SurfaceId> GetAllTempReferences() {
109 std::vector<SurfaceId> temp_references;
110 for (auto& map_entry : manager().temp_references_)
danakj 2017/01/17 21:56:42 this for loop has a body larger than a single line
Saman Sami 2017/01/18 18:03:36 Done.
111 for (auto local_frame_id : map_entry.second)
112 temp_references.push_back(SurfaceId(map_entry.first, local_frame_id));
113 return temp_references;
114 }
115
74 std::unordered_map<FrameSinkId, 116 std::unordered_map<FrameSinkId,
75 std::unique_ptr<SurfaceFactory>, 117 std::unique_ptr<SurfaceFactory>,
76 FrameSinkIdHash> 118 FrameSinkIdHash>
77 factories_; 119 factories_;
78 std::unique_ptr<SurfaceManager> manager_; 120 std::unique_ptr<SurfaceManager> manager_;
79 StubSurfaceFactoryClient client_; 121 StubSurfaceFactoryClient client_;
80 }; 122 };
81 123
82 } // namespace
83
84 TEST_F(SurfaceManagerRefTest, AddReference) { 124 TEST_F(SurfaceManagerRefTest, AddReference) {
85 SurfaceId id1 = CreateSurface(kFrameSink1, kLocalFrame1); 125 SurfaceId id1 = CreateSurface(kFrameSink1, kLocalFrame1);
86 manager().AddSurfaceReference(manager().GetRootSurfaceId(), id1); 126 manager().AddSurfaceReference(manager().GetRootSurfaceId(), id1);
87 127
88 EXPECT_EQ(manager().GetSurfaceReferenceCount(id1), 1u); 128 EXPECT_EQ(manager().GetSurfaceReferenceCount(id1), 1u);
89 EXPECT_EQ(manager().GetReferencedSurfaceCount(id1), 0u); 129 EXPECT_EQ(manager().GetReferencedSurfaceCount(id1), 0u);
90 } 130 }
91 131
92 TEST_F(SurfaceManagerRefTest, AddRemoveReference) { 132 TEST_F(SurfaceManagerRefTest, AddRemoveReference) {
93 SurfaceId id1 = CreateSurface(kFrameSink1, kLocalFrame1); 133 SurfaceId id1 = CreateSurface(kFrameSink1, kLocalFrame1);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 254
215 manager().RemoveSurfaceReference(manager().GetRootSurfaceId(), id1); 255 manager().RemoveSurfaceReference(manager().GetRootSurfaceId(), id1);
216 256
217 // Removing the reference from the root to id1 should allow all three surfaces 257 // Removing the reference from the root to id1 should allow all three surfaces
218 // to be deleted during GC. 258 // to be deleted during GC.
219 EXPECT_EQ(manager().GetSurfaceForId(id1), nullptr); 259 EXPECT_EQ(manager().GetSurfaceForId(id1), nullptr);
220 EXPECT_EQ(manager().GetSurfaceForId(id2), nullptr); 260 EXPECT_EQ(manager().GetSurfaceForId(id2), nullptr);
221 EXPECT_EQ(manager().GetSurfaceForId(id3), nullptr); 261 EXPECT_EQ(manager().GetSurfaceForId(id3), nullptr);
222 } 262 }
223 263
224 TEST_F(SurfaceManagerRefTest, CheckGCWithSequences) {
225 SurfaceId id1 = CreateSurface(kFrameSink1, kLocalFrame1);
226 SurfaceId id2 = CreateSurface(kFrameSink2, kLocalFrame1);
227
228 manager().AddSurfaceReference(manager().GetRootSurfaceId(), id1);
229 manager().AddSurfaceReference(id1, id2);
230
231 SurfaceId id3 = CreateSurface(kFrameSink3, kLocalFrame1);
232 Surface* surface3 = manager().GetSurfaceForId(id3);
233
234 // Add destruction dependency from |id2| to |id3|.
235 manager().RegisterFrameSinkId(kFrameSink2);
236 SurfaceSequence sequence(kFrameSink2, 1u);
237 surface3->AddDestructionDependency(sequence);
238 EXPECT_EQ(surface3->GetDestructionDependencyCount(), 1u);
239
240 // Surface for |id3| isn't delete yet because it has a valid destruction
241 // dependency from |kFrameSink2|.
242 DestroySurface(id3);
243 EXPECT_NE(manager().GetSurfaceForId(id3), nullptr);
244
245 // Surface for |id2| isn't deleted because it has a reference.
246 DestroySurface(id2);
247 EXPECT_NE(manager().GetSurfaceForId(id2), nullptr);
248
249 // Satisfy destruction dependency on |id3| and delete during GC.
250 manager().SatisfySequence(sequence);
251 EXPECT_EQ(manager().GetSurfaceForId(id3), nullptr);
252
253 // Remove ref on |id2| and delete during GC.
254 manager().RemoveSurfaceReference(id1, id2);
255 EXPECT_EQ(manager().GetSurfaceForId(id2), nullptr);
256 }
257
258 TEST_F(SurfaceManagerRefTest, TryAddReferenceToBadSurface) { 264 TEST_F(SurfaceManagerRefTest, TryAddReferenceToBadSurface) {
259 // Not creating an accompanying Surface and SurfaceFactory. 265 // Not creating an accompanying Surface and SurfaceFactory.
260 SurfaceId id(FrameSinkId(100u, 200u), 266 SurfaceId id(FrameSinkId(100u, 200u),
261 LocalFrameId(1u, base::UnguessableToken::Create())); 267 LocalFrameId(1u, base::UnguessableToken::Create()));
262 268
263 // Adding reference from root to the Surface should do nothing because 269 // Adding reference from root to the Surface should do nothing because
264 // SurfaceManager doesn't know Surface for |id| exists. 270 // SurfaceManager doesn't know Surface for |id| exists.
265 manager().AddSurfaceReference(manager().GetRootSurfaceId(), id); 271 manager().AddSurfaceReference(manager().GetRootSurfaceId(), id);
266 EXPECT_EQ(manager().GetSurfaceReferenceCount(id), 0u); 272 EXPECT_EQ(manager().GetSurfaceReferenceCount(id), 0u);
267 } 273 }
268 274
269 TEST_F(SurfaceManagerRefTest, TryDoubleAddReference) { 275 TEST_F(SurfaceManagerRefTest, TryDoubleAddReference) {
270 SurfaceId id1 = CreateSurface(kFrameSink1, kLocalFrame1); 276 SurfaceId id1 = CreateSurface(kFrameSink1, kLocalFrame1);
271 SurfaceId id2 = CreateSurface(kFrameSink2, kLocalFrame1); 277 SurfaceId id2 = CreateSurface(kFrameSink2, kLocalFrame1);
272 278
273 manager().AddSurfaceReference(manager().GetRootSurfaceId(), id1); 279 manager().AddSurfaceReference(manager().GetRootSurfaceId(), id1);
274 manager().AddSurfaceReference(id1, id2); 280 manager().AddSurfaceReference(id1, id2);
275 EXPECT_EQ(manager().GetSurfaceReferenceCount(id2), 1u); 281 EXPECT_EQ(manager().GetSurfaceReferenceCount(id2), 1u);
276 EXPECT_EQ(manager().GetReferencedSurfaceCount(id1), 1u); 282 EXPECT_EQ(manager().GetReferencedSurfaceCount(id1), 1u);
277 283
278 // The second request should be ignored without crashing. 284 // The second request should be ignored without crashing.
279 manager().AddSurfaceReference(id1, id2); 285 manager().AddSurfaceReference(id1, id2);
280 EXPECT_EQ(manager().GetSurfaceReferenceCount(id2), 1u); 286 EXPECT_EQ(manager().GetSurfaceReferenceCount(id2), 1u);
281 EXPECT_EQ(manager().GetReferencedSurfaceCount(id1), 1u); 287 EXPECT_EQ(manager().GetReferencedSurfaceCount(id1), 1u);
282 } 288 }
283 289
284 TEST_F(SurfaceManagerRefTest, TryAddSelfReference) { 290 TEST_F(SurfaceManagerRefTest, TryAddSelfReference) {
285 SurfaceId id1 = CreateSurface(kFrameSink1, kLocalFrame1); 291 SurfaceId id1 = CreateSurface(kFrameSink1, kLocalFrame1);
286 292
293 // A temporary reference must exist to id1.
294 EXPECT_EQ(manager().GetSurfaceReferenceCount(id1), 1u);
295
296 // Add a self reference.
kylechar 2017/01/18 15:36:44 // Try to add a self reference, this should fail.
danakj 2017/01/18 16:31:32 Ah ok ya this would help :)
Saman Sami 2017/01/18 18:03:36 Done.
297 manager().AddSurfaceReference(id1, id1);
298
287 // Adding a self reference should be ignored without crashing. 299 // Adding a self reference should be ignored without crashing.
288 manager().AddSurfaceReference(id1, id1);
289 EXPECT_EQ(manager().GetSurfaceReferenceCount(id1), 0u);
290 EXPECT_EQ(manager().GetReferencedSurfaceCount(id1), 0u); 300 EXPECT_EQ(manager().GetReferencedSurfaceCount(id1), 0u);
301
302 // The temporary reference to id1 must still exist.
303 EXPECT_EQ(manager().GetSurfaceReferenceCount(id1), 1u);
danakj 2017/01/17 21:56:42 I'm struggling with why a temp reference would exi
kylechar 2017/01/18 15:36:44 Adding a reference to itself fails is why.
291 } 304 }
292 305
293 TEST_F(SurfaceManagerRefTest, TryRemoveBadReference) { 306 TEST_F(SurfaceManagerRefTest, TryRemoveBadReference) {
294 SurfaceId id1 = CreateSurface(kFrameSink1, kLocalFrame1); 307 SurfaceId id1 = CreateSurface(kFrameSink1, kLocalFrame1);
295 SurfaceId id2 = CreateSurface(kFrameSink2, kLocalFrame1); 308 SurfaceId id2 = CreateSurface(kFrameSink2, kLocalFrame1);
296 309
297 // Removing non-existent reference should be ignored. 310 // Removing non-existent reference should be ignored.
298 manager().AddSurfaceReference(id1, id2); 311 manager().AddSurfaceReference(id1, id2);
299 manager().RemoveSurfaceReference(id2, id1); 312 manager().RemoveSurfaceReference(id2, id1);
300 EXPECT_EQ(manager().GetReferencedSurfaceCount(id1), 1u); 313 EXPECT_EQ(manager().GetReferencedSurfaceCount(id1), 1u);
301 EXPECT_EQ(manager().GetSurfaceReferenceCount(id2), 1u); 314 EXPECT_EQ(manager().GetSurfaceReferenceCount(id2), 1u);
302 } 315 }
303 316
317 // Temporary Reference Tests
danakj 2017/01/17 21:56:42 this comment is going to be wrong in no time, i wo
Saman Sami 2017/01/18 18:03:36 Done.
318
319 TEST_F(SurfaceManagerRefTest, AddSurfaceThenReference) {
320 // Create a new surface.
321 const SurfaceId surface_id = CreateSurface(2, 1, 1);
322
323 // A temporary reference must be added to surface_id.
324 EXPECT_THAT(GetAllTempReferences(), ElementsAre(surface_id));
danakj 2017/01/17 21:56:42 Oh this is some fancy gtesting, cool
325 EXPECT_THAT(GetRootReferences(), ElementsAre(surface_id));
326
327 // Create parent_id and add a real reference from it to surface_id.
328 const SurfaceId parent_id = CreateSurface(1, 1, 1);
329 manager().AddSurfaceReference(parent_id, surface_id);
330
331 // The temporary reference to surface_id should be gone.
332 // The only temporary reference should be to parent_id.
333 // There must be a real reference from parent_id to child_id.
334 EXPECT_THAT(GetAllTempReferences(), ElementsAre(parent_id));
335 EXPECT_THAT(GetRootReferences(), ElementsAre(parent_id));
336 EXPECT_THAT(GetReferencesFor(parent_id), ElementsAre(surface_id));
337 }
338
339 TEST_F(SurfaceManagerRefTest, AddSurfaceThenRootReference) {
340 // Create a new surface.
341 const SurfaceId surface_id = CreateSurface(1, 1, 1);
342
343 // Temporary reference should be added to surface_id.
344 EXPECT_THAT(GetAllTempReferences(), ElementsAre(surface_id));
345 EXPECT_THAT(GetRootReferences(), ElementsAre(surface_id));
346
347 // Add a real reference from root to surface_id.
348 manager().AddSurfaceReference(manager().GetRootSurfaceId(), surface_id);
349
350 // The temporary reference should be gone.
351 // There should now be a real reference from root to surface_id.
352 EXPECT_TRUE(GetAllTempReferences().empty());
353 EXPECT_THAT(GetRootReferences(), ElementsAre(surface_id));
354 }
355
356 TEST_F(SurfaceManagerRefTest, AddTwoSurfacesThenOneReference) {
357 // Create two surfaces with different FrameSinkIds.
358 const SurfaceId surface_id1 = CreateSurface(2, 1, 1);
359 const SurfaceId surface_id2 = CreateSurface(3, 1, 1);
360
361 // Temporary reference should be added for both surfaces.
362 EXPECT_THAT(GetAllTempReferences(),
363 UnorderedElementsAre(surface_id1, surface_id2));
364 EXPECT_THAT(GetRootReferences(),
365 UnorderedElementsAre(surface_id1, surface_id2));
366
367 // Create parent_id and add a real reference from it to surface_id1.
368 const SurfaceId parent_id = CreateSurface(1, 1, 1);
369 manager().AddSurfaceReference(parent_id, surface_id1);
370
371 // Real reference must be added to surface_id1 and the temporary reference
372 // to it must be gone.
373 // There should still be a temporary reference left to surface_id2.
374 // A temporary reference to parent_id must be created.
375 EXPECT_THAT(GetAllTempReferences(),
376 UnorderedElementsAre(parent_id, surface_id2));
377 EXPECT_THAT(GetRootReferences(),
378 UnorderedElementsAre(parent_id, surface_id2));
379 EXPECT_THAT(GetReferencesFor(parent_id), ElementsAre(surface_id1));
380 }
381
382 TEST_F(SurfaceManagerRefTest, AddSurfacesSkipReference) {
383 // Add two surfaces that have the same FrameSinkId. This would happen when a
384 // client submits two CFs before parent submits a new CF.
danakj 2017/01/17 21:56:42 s/CFs/CompositorFrames/. CFs will never be found i
Saman Sami 2017/01/18 18:03:36 Done.
385 const SurfaceId surface_id1 = CreateSurface(2, 1, 1);
386 const SurfaceId surface_id2 = CreateSurface(2, 1, 2);
danakj 2017/01/17 21:56:42 maybe don't make them sorted by the local id (ie g
Saman Sami 2017/01/18 18:03:36 Done.
387
388 // Temporary references should be added for both surfaces and they should be
389 // stored in the order of creation.
390 EXPECT_THAT(
391 GetTempReferencesFor(surface_id1.frame_sink_id()),
392 ElementsAre(surface_id1.local_frame_id(), surface_id2.local_frame_id()));
393 EXPECT_THAT(GetRootReferences(),
394 UnorderedElementsAre(surface_id1, surface_id2));
395
396 // Create parent_id and add a reference from it to surface_id2 which was
danakj 2017/01/17 21:56:42 use bars for variable names, like |parent_id| and
Saman Sami 2017/01/18 18:03:36 Done.
397 // created later.
398 const SurfaceId parent_id = CreateSurface(1, 1, 1);
399 manager().AddSurfaceReference(parent_id, surface_id2);
400
401 // The real reference should be added for surface_id2 and the temporary
402 // references to both surface_id1 and surface_id2 should be gone.
403 // There should be a temporary reference to parent_id.
404 EXPECT_THAT(GetAllTempReferences(), ElementsAre(parent_id));
405 EXPECT_THAT(GetRootReferences(), ElementsAre(parent_id));
406 EXPECT_THAT(GetReferencesFor(parent_id), ElementsAre(surface_id2));
407 }
408
409 TEST_F(SurfaceManagerRefTest, RemoveFirstTempRefOnly) {
410 // Add two surfaces that have the same FrameSinkId. This would happen when a
411 // client submits two CFs before parent submits a new CF.
danakj 2017/01/17 21:56:42 CFs->CompositorFrames
Saman Sami 2017/01/18 18:03:36 Done.
412 const SurfaceId surface_id1 = CreateSurface(2, 1, 1);
413 const SurfaceId surface_id2 = CreateSurface(2, 1, 2);
414
415 // Temporary references should be added for both surfaces and they should be
416 // stored in the order of creation.
417 EXPECT_THAT(
418 GetTempReferencesFor(surface_id1.frame_sink_id()),
419 ElementsAre(surface_id1.local_frame_id(), surface_id2.local_frame_id()));
420 EXPECT_THAT(GetRootReferences(),
421 UnorderedElementsAre(surface_id1, surface_id2));
422
423 // Create parent_id and add a reference from it to surface_id1 which was
424 // created earlier.
425 const SurfaceId parent_id = CreateSurface(1, 1, 1);
426 manager().AddSurfaceReference(parent_id, surface_id1);
427
428 // The real reference should be added for surface_id1 and its temporary
429 // reference should be removed. The temporary reference for surface_id2
430 // should remain. A temporary reference must be added for parent_id.
431 EXPECT_THAT(GetAllTempReferences(),
432 UnorderedElementsAre(parent_id, surface_id2));
433 EXPECT_THAT(GetRootReferences(),
434 UnorderedElementsAre(parent_id, surface_id2));
435 EXPECT_THAT(GetReferencesFor(parent_id), ElementsAre(surface_id1));
436 }
437
304 } // namespace cc 438 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698