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

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

Issue 2144733005: [WIP] cc: Plumb SurfaceId from clients Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ensure only SurfaceFactoy and tests can update hierarchy Created 4 years, 5 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
« no previous file with comments | « cc/surfaces/surface_manager.cc ('k') | cc/surfaces/surface_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "cc/scheduler/begin_frame_source.h" 7 #include "cc/scheduler/begin_frame_source.h"
8 #include "cc/surfaces/surface_factory_client.h" 8 #include "cc/surfaces/surface_factory_client.h"
9 #include "cc/surfaces/surface_manager.h" 9 #include "cc/surfaces/surface_manager.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 namespace cc { 12 namespace cc {
13 13
14 class FakeSurfaceFactoryClient : public SurfaceFactoryClient { 14 class FakeSurfaceFactoryClient : public SurfaceFactoryClient {
15 public: 15 public:
16 explicit FakeSurfaceFactoryClient(int id_namespace) 16 explicit FakeSurfaceFactoryClient(int client_id)
17 : source_(nullptr), manager_(nullptr), id_namespace_(id_namespace) {} 17 : source_(nullptr), manager_(nullptr), client_id_(client_id) {}
18 FakeSurfaceFactoryClient(int id_namespace, SurfaceManager* manager) 18 FakeSurfaceFactoryClient(int client_id, SurfaceManager* manager)
19 : source_(nullptr), manager_(nullptr), id_namespace_(id_namespace) { 19 : source_(nullptr), manager_(nullptr), client_id_(client_id) {
20 DCHECK(manager); 20 DCHECK(manager);
21 Register(manager); 21 Register(manager);
22 } 22 }
23 23
24 ~FakeSurfaceFactoryClient() override { 24 ~FakeSurfaceFactoryClient() override {
25 if (manager_) { 25 if (manager_) {
26 Unregister(); 26 Unregister();
27 } 27 }
28 EXPECT_EQ(source_, nullptr); 28 EXPECT_EQ(source_, nullptr);
29 } 29 }
30 30
31 BeginFrameSource* source() { return source_; } 31 BeginFrameSource* source() { return source_; }
32 uint32_t id_namespace() { return id_namespace_; } 32 uint32_t client_id() { return client_id_; }
33 33
34 void Register(SurfaceManager* manager) { 34 void Register(SurfaceManager* manager) {
35 EXPECT_EQ(manager_, nullptr); 35 EXPECT_EQ(manager_, nullptr);
36 manager_ = manager; 36 manager_ = manager;
37 manager_->RegisterSurfaceFactoryClient(id_namespace_, this); 37 manager_->RegisterClient(client_id_, this);
38 } 38 }
39 39
40 void Unregister() { 40 void Unregister() {
41 EXPECT_NE(manager_, nullptr); 41 EXPECT_NE(manager_, nullptr);
42 manager_->UnregisterSurfaceFactoryClient(id_namespace_); 42 manager_->UnregisterClient(client_id_);
43 manager_ = nullptr; 43 manager_ = nullptr;
44 } 44 }
45 45
46 // SurfaceFactoryClient implementation. 46 // SurfaceFactoryClient implementation.
47 void ReturnResources(const ReturnedResourceArray& resources) override {} 47 void ReturnResources(const ReturnedResourceArray& resources) override {}
48 void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override { 48 void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override {
49 DCHECK(!source_ || !begin_frame_source); 49 DCHECK(!source_ || !begin_frame_source);
50 source_ = begin_frame_source; 50 source_ = begin_frame_source;
51 }; 51 };
52 52
53 private: 53 private:
54 BeginFrameSource* source_; 54 BeginFrameSource* source_;
55 SurfaceManager* manager_; 55 SurfaceManager* manager_;
56 uint32_t id_namespace_; 56 uint32_t client_id_;
57 }; 57 };
58 58
59 class EmptyBeginFrameSource : public BeginFrameSource { 59 class EmptyBeginFrameSource : public BeginFrameSource {
60 public: 60 public:
61 void DidFinishFrame(BeginFrameObserver* obs, 61 void DidFinishFrame(BeginFrameObserver* obs,
62 size_t remaining_frames) override {} 62 size_t remaining_frames) override {}
63 void AddObserver(BeginFrameObserver* obs) override {} 63 void AddObserver(BeginFrameObserver* obs) override {}
64 void RemoveObserver(BeginFrameObserver* obs) override {} 64 void RemoveObserver(BeginFrameObserver* obs) override {}
65 }; 65 };
66 66
67 class SurfaceManagerTest : public testing::Test { 67 class SurfaceManagerTest : public testing::Test {
68 public: 68 public:
69 // These tests don't care about namespace registration, so just preregister
70 // a set of namespaces that tests can use freely without worrying if they're
71 // valid or not.
72 enum { MAX_NAMESPACE = 10 };
73
74 SurfaceManagerTest() { 69 SurfaceManagerTest() {
75 for (size_t i = 0; i < MAX_NAMESPACE; ++i)
76 manager_.RegisterSurfaceClientId(i);
77 } 70 }
78 71
79 ~SurfaceManagerTest() override { 72 ~SurfaceManagerTest() override {
80 for (size_t i = 0; i < MAX_NAMESPACE; ++i)
81 manager_.InvalidateSurfaceClientId(i);
82 } 73 }
83 74
84 protected: 75 protected:
85 SurfaceManager manager_; 76 SurfaceManager manager_;
86 }; 77 };
87 78
88 TEST_F(SurfaceManagerTest, SingleClients) { 79 TEST_F(SurfaceManagerTest, SingleClients) {
89 FakeSurfaceFactoryClient client(1); 80 FakeSurfaceFactoryClient client(1);
90 FakeSurfaceFactoryClient other_client(2); 81 FakeSurfaceFactoryClient other_client(2);
91 EmptyBeginFrameSource source; 82 EmptyBeginFrameSource source;
92 83
93 EXPECT_EQ(client.source(), nullptr); 84 EXPECT_EQ(client.source(), nullptr);
94 EXPECT_EQ(other_client.source(), nullptr); 85 EXPECT_EQ(other_client.source(), nullptr);
95 client.Register(&manager_); 86 client.Register(&manager_);
96 other_client.Register(&manager_); 87 other_client.Register(&manager_);
97 EXPECT_EQ(client.source(), nullptr); 88 EXPECT_EQ(client.source(), nullptr);
98 EXPECT_EQ(other_client.source(), nullptr); 89 EXPECT_EQ(other_client.source(), nullptr);
99 90
100 // Test setting unsetting BFS 91 // Test setting unsetting BFS
101 manager_.RegisterBeginFrameSource(&source, client.id_namespace()); 92 manager_.RegisterBeginFrameSource(&source, client.client_id());
102 EXPECT_EQ(client.source(), &source); 93 EXPECT_EQ(client.source(), &source);
103 EXPECT_EQ(other_client.source(), nullptr); 94 EXPECT_EQ(other_client.source(), nullptr);
104 manager_.UnregisterBeginFrameSource(&source); 95 manager_.UnregisterBeginFrameSource(&source);
105 EXPECT_EQ(client.source(), nullptr); 96 EXPECT_EQ(client.source(), nullptr);
106 EXPECT_EQ(other_client.source(), nullptr); 97 EXPECT_EQ(other_client.source(), nullptr);
107 98
108 // Set BFS for other namespace 99 // Set BFS for other namespace
109 manager_.RegisterBeginFrameSource(&source, other_client.id_namespace()); 100 manager_.RegisterBeginFrameSource(&source, other_client.client_id());
110 EXPECT_EQ(other_client.source(), &source); 101 EXPECT_EQ(other_client.source(), &source);
111 EXPECT_EQ(client.source(), nullptr); 102 EXPECT_EQ(client.source(), nullptr);
112 manager_.UnregisterBeginFrameSource(&source); 103 manager_.UnregisterBeginFrameSource(&source);
113 EXPECT_EQ(client.source(), nullptr); 104 EXPECT_EQ(client.source(), nullptr);
114 EXPECT_EQ(other_client.source(), nullptr); 105 EXPECT_EQ(other_client.source(), nullptr);
115 106
116 // Re-set BFS for original 107 // Re-set BFS for original
117 manager_.RegisterBeginFrameSource(&source, client.id_namespace()); 108 manager_.RegisterBeginFrameSource(&source, client.client_id());
118 EXPECT_EQ(client.source(), &source); 109 EXPECT_EQ(client.source(), &source);
119 manager_.UnregisterBeginFrameSource(&source); 110 manager_.UnregisterBeginFrameSource(&source);
120 EXPECT_EQ(client.source(), nullptr); 111 EXPECT_EQ(client.source(), nullptr);
121 } 112 }
122 113
123 TEST_F(SurfaceManagerTest, MultipleDisplays) { 114 TEST_F(SurfaceManagerTest, MultipleDisplays) {
124 EmptyBeginFrameSource root1_source; 115 EmptyBeginFrameSource root1_source;
125 EmptyBeginFrameSource root2_source; 116 EmptyBeginFrameSource root2_source;
126 117
127 // root1 -> A -> B 118 // root1 -> A -> B
128 // root2 -> C 119 // root2 -> C
129 FakeSurfaceFactoryClient root1(1, &manager_); 120 FakeSurfaceFactoryClient root1(1, &manager_);
130 FakeSurfaceFactoryClient root2(2, &manager_); 121 FakeSurfaceFactoryClient root2(2, &manager_);
131 FakeSurfaceFactoryClient client_a(3, &manager_); 122 FakeSurfaceFactoryClient client_a(3, &manager_);
132 FakeSurfaceFactoryClient client_b(4, &manager_); 123 FakeSurfaceFactoryClient client_b(4, &manager_);
133 FakeSurfaceFactoryClient client_c(5, &manager_); 124 FakeSurfaceFactoryClient client_c(5, &manager_);
134 125
135 manager_.RegisterBeginFrameSource(&root1_source, root1.id_namespace()); 126 manager_.RegisterBeginFrameSource(&root1_source, root1.client_id());
136 manager_.RegisterBeginFrameSource(&root2_source, root2.id_namespace()); 127 manager_.RegisterBeginFrameSource(&root2_source, root2.client_id());
137 EXPECT_EQ(root1.source(), &root1_source); 128 EXPECT_EQ(root1.source(), &root1_source);
138 EXPECT_EQ(root2.source(), &root2_source); 129 EXPECT_EQ(root2.source(), &root2_source);
139 130
140 // Set up initial hierarchy. 131 // Set up initial hierarchy.
141 manager_.RegisterSurfaceNamespaceHierarchy(root1.id_namespace(), 132 manager_.RegisterSurfaceNamespaceHierarchy(root1.client_id(),
142 client_a.id_namespace()); 133 client_a.client_id());
143 EXPECT_EQ(client_a.source(), root1.source()); 134 EXPECT_EQ(client_a.source(), root1.source());
144 manager_.RegisterSurfaceNamespaceHierarchy(client_a.id_namespace(), 135 manager_.RegisterSurfaceNamespaceHierarchy(client_a.client_id(),
145 client_b.id_namespace()); 136 client_b.client_id());
146 EXPECT_EQ(client_b.source(), root1.source()); 137 EXPECT_EQ(client_b.source(), root1.source());
147 manager_.RegisterSurfaceNamespaceHierarchy(root2.id_namespace(), 138 manager_.RegisterSurfaceNamespaceHierarchy(root2.client_id(),
148 client_c.id_namespace()); 139 client_c.client_id());
149 EXPECT_EQ(client_c.source(), root2.source()); 140 EXPECT_EQ(client_c.source(), root2.source());
150 141
151 // Attach A into root2's subtree, like a window moving across displays. 142 // Attach A into root2's subtree, like a window moving across displays.
152 // root1 -> A -> B 143 // root1 -> A -> B
153 // root2 -> C -> A -> B 144 // root2 -> C -> A -> B
154 manager_.RegisterSurfaceNamespaceHierarchy(client_c.id_namespace(), 145 manager_.RegisterSurfaceNamespaceHierarchy(client_c.client_id(),
155 client_a.id_namespace()); 146 client_a.client_id());
156 // With the heuristic of just keeping existing BFS in the face of multiple, 147 // With the heuristic of just keeping existing BFS in the face of multiple,
157 // no client sources should change. 148 // no client sources should change.
158 EXPECT_EQ(client_a.source(), root1.source()); 149 EXPECT_EQ(client_a.source(), root1.source());
159 EXPECT_EQ(client_b.source(), root1.source()); 150 EXPECT_EQ(client_b.source(), root1.source());
160 EXPECT_EQ(client_c.source(), root2.source()); 151 EXPECT_EQ(client_c.source(), root2.source());
161 152
162 // Detach A from root1. A and B should now be updated to root2. 153 // Detach A from root1. A and B should now be updated to root2.
163 manager_.UnregisterSurfaceNamespaceHierarchy(root1.id_namespace(), 154 manager_.UnregisterSurfaceNamespaceHierarchy(root1.client_id(),
164 client_a.id_namespace()); 155 client_a.client_id());
165 EXPECT_EQ(client_a.source(), root2.source()); 156 EXPECT_EQ(client_a.source(), root2.source());
166 EXPECT_EQ(client_b.source(), root2.source()); 157 EXPECT_EQ(client_b.source(), root2.source());
167 EXPECT_EQ(client_c.source(), root2.source()); 158 EXPECT_EQ(client_c.source(), root2.source());
168 159
169 // Detach root1 from BFS. root1 should now have no source. 160 // Detach root1 from BFS. root1 should now have no source.
170 manager_.UnregisterBeginFrameSource(&root1_source); 161 manager_.UnregisterBeginFrameSource(&root1_source);
171 EXPECT_EQ(root1.source(), nullptr); 162 EXPECT_EQ(root1.source(), nullptr);
172 EXPECT_NE(root2.source(), nullptr); 163 EXPECT_NE(root2.source(), nullptr);
173 164
174 // Detatch root2 from BFS. 165 // Detatch root2 from BFS.
175 manager_.UnregisterBeginFrameSource(&root2_source); 166 manager_.UnregisterBeginFrameSource(&root2_source);
176 EXPECT_EQ(client_a.source(), nullptr); 167 EXPECT_EQ(client_a.source(), nullptr);
177 EXPECT_EQ(client_b.source(), nullptr); 168 EXPECT_EQ(client_b.source(), nullptr);
178 EXPECT_EQ(client_c.source(), nullptr); 169 EXPECT_EQ(client_c.source(), nullptr);
179 EXPECT_EQ(root2.source(), nullptr); 170 EXPECT_EQ(root2.source(), nullptr);
180 171
181 // Cleanup hierarchy. 172 // Cleanup hierarchy.
182 manager_.UnregisterSurfaceNamespaceHierarchy(root2.id_namespace(), 173 manager_.UnregisterSurfaceNamespaceHierarchy(root2.client_id(),
183 client_c.id_namespace()); 174 client_c.client_id());
184 manager_.UnregisterSurfaceNamespaceHierarchy(client_c.id_namespace(), 175 manager_.UnregisterSurfaceNamespaceHierarchy(client_c.client_id(),
185 client_a.id_namespace()); 176 client_a.client_id());
186 manager_.UnregisterSurfaceNamespaceHierarchy(client_a.id_namespace(), 177 manager_.UnregisterSurfaceNamespaceHierarchy(client_a.client_id(),
187 client_b.id_namespace()); 178 client_b.client_id());
188 } 179 }
189 180
190 // In practice, registering and unregistering both parent/child relationships 181 // In practice, registering and unregistering both parent/child relationships
191 // and SurfaceFactoryClients can happen in any ordering with respect to 182 // and SurfaceFactoryClients can happen in any ordering with respect to
192 // each other. These following tests verify that all the data structures 183 // each other. These following tests verify that all the data structures
193 // are properly set up and cleaned up under the four permutations of orderings 184 // are properly set up and cleaned up under the four permutations of orderings
194 // of this nesting. 185 // of this nesting.
195 186
196 class SurfaceManagerOrderingTest : public SurfaceManagerTest { 187 class SurfaceManagerOrderingTest : public SurfaceManagerTest {
197 public: 188 public:
(...skipping 10 matching lines...) Expand all
208 ~SurfaceManagerOrderingTest() override { 199 ~SurfaceManagerOrderingTest() override {
209 EXPECT_EQ(hierarchy_registered_, false); 200 EXPECT_EQ(hierarchy_registered_, false);
210 EXPECT_EQ(clients_registered_, false); 201 EXPECT_EQ(clients_registered_, false);
211 EXPECT_EQ(bfs_registered_, false); 202 EXPECT_EQ(bfs_registered_, false);
212 AssertCorrectBFSState(); 203 AssertCorrectBFSState();
213 } 204 }
214 205
215 void RegisterHierarchy() { 206 void RegisterHierarchy() {
216 DCHECK(!hierarchy_registered_); 207 DCHECK(!hierarchy_registered_);
217 hierarchy_registered_ = true; 208 hierarchy_registered_ = true;
218 manager_.RegisterSurfaceNamespaceHierarchy(client_a_.id_namespace(), 209 manager_.RegisterSurfaceNamespaceHierarchy(client_a_.client_id(),
219 client_b_.id_namespace()); 210 client_b_.client_id());
220 manager_.RegisterSurfaceNamespaceHierarchy(client_b_.id_namespace(), 211 manager_.RegisterSurfaceNamespaceHierarchy(client_b_.client_id(),
221 client_c_.id_namespace()); 212 client_c_.client_id());
222 AssertCorrectBFSState(); 213 AssertCorrectBFSState();
223 } 214 }
224 void UnregisterHierarchy() { 215 void UnregisterHierarchy() {
225 DCHECK(hierarchy_registered_); 216 DCHECK(hierarchy_registered_);
226 hierarchy_registered_ = false; 217 hierarchy_registered_ = false;
227 manager_.UnregisterSurfaceNamespaceHierarchy(client_a_.id_namespace(), 218 manager_.UnregisterSurfaceNamespaceHierarchy(client_a_.client_id(),
228 client_b_.id_namespace()); 219 client_b_.client_id());
229 manager_.UnregisterSurfaceNamespaceHierarchy(client_b_.id_namespace(), 220 manager_.UnregisterSurfaceNamespaceHierarchy(client_b_.client_id(),
230 client_c_.id_namespace()); 221 client_c_.client_id());
231 AssertCorrectBFSState(); 222 AssertCorrectBFSState();
232 } 223 }
233 224
234 void RegisterClients() { 225 void RegisterClients() {
235 DCHECK(!clients_registered_); 226 DCHECK(!clients_registered_);
236 clients_registered_ = true; 227 clients_registered_ = true;
237 client_a_.Register(&manager_); 228 client_a_.Register(&manager_);
238 client_b_.Register(&manager_); 229 client_b_.Register(&manager_);
239 client_c_.Register(&manager_); 230 client_c_.Register(&manager_);
240 AssertCorrectBFSState(); 231 AssertCorrectBFSState();
241 } 232 }
242 233
243 void UnregisterClients() { 234 void UnregisterClients() {
244 DCHECK(clients_registered_); 235 DCHECK(clients_registered_);
245 clients_registered_ = false; 236 clients_registered_ = false;
246 client_a_.Unregister(); 237 client_a_.Unregister();
247 client_b_.Unregister(); 238 client_b_.Unregister();
248 client_c_.Unregister(); 239 client_c_.Unregister();
249 AssertCorrectBFSState(); 240 AssertCorrectBFSState();
250 } 241 }
251 242
252 void RegisterBFS() { 243 void RegisterBFS() {
253 DCHECK(!bfs_registered_); 244 DCHECK(!bfs_registered_);
254 bfs_registered_ = true; 245 bfs_registered_ = true;
255 manager_.RegisterBeginFrameSource(&source_, client_a_.id_namespace()); 246 manager_.RegisterBeginFrameSource(&source_, client_a_.client_id());
256 AssertCorrectBFSState(); 247 AssertCorrectBFSState();
257 } 248 }
258 void UnregisterBFS() { 249 void UnregisterBFS() {
259 DCHECK(bfs_registered_); 250 DCHECK(bfs_registered_);
260 bfs_registered_ = false; 251 bfs_registered_ = false;
261 manager_.UnregisterBeginFrameSource(&source_); 252 manager_.UnregisterBeginFrameSource(&source_);
262 AssertCorrectBFSState(); 253 AssertCorrectBFSState();
263 } 254 }
264 255
265 void AssertEmptyBFS() { 256 void AssertEmptyBFS() {
(...skipping 29 matching lines...) Expand all
295 // A -> B -> C hierarchy, with A always having the BFS. 286 // A -> B -> C hierarchy, with A always having the BFS.
296 FakeSurfaceFactoryClient client_a_; 287 FakeSurfaceFactoryClient client_a_;
297 FakeSurfaceFactoryClient client_b_; 288 FakeSurfaceFactoryClient client_b_;
298 FakeSurfaceFactoryClient client_c_; 289 FakeSurfaceFactoryClient client_c_;
299 290
300 bool hierarchy_registered_; 291 bool hierarchy_registered_;
301 bool clients_registered_; 292 bool clients_registered_;
302 bool bfs_registered_; 293 bool bfs_registered_;
303 }; 294 };
304 295
305 enum RegisterOrder { REGISTER_HIERARCHY_FIRST, REGISTER_CLIENTS_FIRST }; 296 enum BFSOrder { BFS_FIRST, BFS_SECOND };
306 enum UnregisterOrder { UNREGISTER_HIERARCHY_FIRST, UNREGISTER_CLIENTS_FIRST };
307 enum BFSOrder { BFS_FIRST, BFS_SECOND, BFS_THIRD };
308 297
309 static const RegisterOrder kRegisterOrderList[] = {REGISTER_HIERARCHY_FIRST, 298 static const BFSOrder kBFSOrderList[] = {BFS_FIRST, BFS_SECOND};
310 REGISTER_CLIENTS_FIRST};
311 static const UnregisterOrder kUnregisterOrderList[] = {
312 UNREGISTER_HIERARCHY_FIRST, UNREGISTER_CLIENTS_FIRST};
313 static const BFSOrder kBFSOrderList[] = {BFS_FIRST, BFS_SECOND, BFS_THIRD};
314 299
315 class SurfaceManagerOrderingParamTest 300 class SurfaceManagerOrderingParamTest
316 : public SurfaceManagerOrderingTest, 301 : public SurfaceManagerOrderingTest,
317 public ::testing::WithParamInterface< 302 public ::testing::WithParamInterface<BFSOrder> {};
318 std::tr1::tuple<RegisterOrder, UnregisterOrder, BFSOrder>> {};
319 303
320 TEST_P(SurfaceManagerOrderingParamTest, Ordering) { 304 TEST_P(SurfaceManagerOrderingParamTest, Ordering) {
321 // Test the four permutations of client/hierarchy setting/unsetting and test 305 // Test the four permutations of client/hierarchy setting/unsetting and test
322 // each place the BFS can be added and removed. The BFS and the 306 // each place the BFS can be added and removed. The BFS and the
323 // client/hierarchy are less related, so BFS is tested independently instead 307 // client/hierarchy are less related, so BFS is tested independently instead
324 // of every permutation of BFS setting and unsetting. 308 // of every permutation of BFS setting and unsetting.
325 // The register/unregister functions themselves test most of the state. 309 // The register/unregister functions themselves test most of the stat;
326 RegisterOrder register_order = std::tr1::get<0>(GetParam()); 310 BFSOrder bfs_order = GetParam();
327 UnregisterOrder unregister_order = std::tr1::get<1>(GetParam()); 311
328 BFSOrder bfs_order = std::tr1::get<2>(GetParam()); 312 RegisterClients();
329 313
330 // Attach everything up in the specified order. 314 // Attach everything up in the specified order.
331 if (bfs_order == BFS_FIRST) 315 if (bfs_order == BFS_FIRST)
332 RegisterBFS(); 316 RegisterBFS();
333 317
334 if (register_order == REGISTER_HIERARCHY_FIRST) 318 RegisterHierarchy();
335 RegisterHierarchy();
336 else
337 RegisterClients();
338 319
339 if (bfs_order == BFS_SECOND) 320 if (bfs_order == BFS_SECOND)
340 RegisterBFS(); 321 RegisterBFS();
341 322
342 if (register_order == REGISTER_HIERARCHY_FIRST)
343 RegisterClients();
344 else
345 RegisterHierarchy();
346
347 if (bfs_order == BFS_THIRD)
348 RegisterBFS();
349
350 // Everything hooked up, so should be valid. 323 // Everything hooked up, so should be valid.
351 AssertAllValidBFS(); 324 AssertAllValidBFS();
352 325
353 // Detach everything in the specified order. 326 // Detach everything in the specified order.
354 if (bfs_order == BFS_THIRD)
355 UnregisterBFS();
356
357 if (unregister_order == UNREGISTER_HIERARCHY_FIRST)
358 UnregisterHierarchy();
359 else
360 UnregisterClients();
361
362 if (bfs_order == BFS_SECOND) 327 if (bfs_order == BFS_SECOND)
363 UnregisterBFS(); 328 UnregisterBFS();
364 329
365 if (unregister_order == UNREGISTER_HIERARCHY_FIRST)
366 UnregisterClients();
367 else
368 UnregisterHierarchy(); 330 UnregisterHierarchy();
369 331
370 if (bfs_order == BFS_FIRST) 332 if (bfs_order == BFS_FIRST)
371 UnregisterBFS(); 333 UnregisterBFS();
334
335 UnregisterClients();
336
372 } 337 }
373 338
374 INSTANTIATE_TEST_CASE_P( 339 INSTANTIATE_TEST_CASE_P(SurfaceManagerOrderingParamTestInstantiation,
375 SurfaceManagerOrderingParamTestInstantiation, 340 SurfaceManagerOrderingParamTest,
376 SurfaceManagerOrderingParamTest, 341 ::testing::ValuesIn(kBFSOrderList));
377 ::testing::Combine(::testing::ValuesIn(kRegisterOrderList),
378 ::testing::ValuesIn(kUnregisterOrderList),
379 ::testing::ValuesIn(kBFSOrderList)));
380 342
381 } // namespace cc 343 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/surface_manager.cc ('k') | cc/surfaces/surface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698