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

Side by Side Diff: cc/tree_synchronizer_unittest.cc

Issue 11232051: Remove static thread pointers from CC (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Apply code review comments Created 8 years, 1 month 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/tiled_layer_unittest.cc ('k') | cc/video_layer_impl.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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "config.h" 5 #include "config.h"
6 6
7 #include "cc/tree_synchronizer.h" 7 #include "cc/tree_synchronizer.h"
8 8
9 #include "Region.h" 9 #include "Region.h"
10 #include "cc/layer.h" 10 #include "cc/layer.h"
11 #include "cc/layer_animation_controller.h" 11 #include "cc/layer_animation_controller.h"
12 #include "cc/layer_impl.h" 12 #include "cc/layer_impl.h"
13 #include "cc/proxy.h" 13 #include "cc/proxy.h"
14 #include "cc/single_thread_proxy.h" 14 #include "cc/single_thread_proxy.h"
15 #include "cc/test/animation_test_common.h" 15 #include "cc/test/animation_test_common.h"
16 #include "cc/test/fake_proxy.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 18
18 using namespace cc; 19 using namespace cc;
19 using namespace WebKitTests; 20 using namespace WebKitTests;
20 21
21 namespace { 22 namespace {
22 23
23 class MockLayerImpl : public LayerImpl { 24 class MockLayerImpl : public LayerImpl {
24 public: 25 public:
25 static scoped_ptr<MockLayerImpl> create(int layerId) 26 static scoped_ptr<MockLayerImpl> create(int layerId)
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 ASSERT_EQ(layerChildren.size(), layerImplChildren.size()); 125 ASSERT_EQ(layerChildren.size(), layerImplChildren.size());
125 126
126 for (size_t i = 0; i < layerChildren.size(); ++i) 127 for (size_t i = 0; i < layerChildren.size(); ++i)
127 expectTreesAreIdentical(layerChildren[i].get(), layerImplChildren[i], ho stImpl); 128 expectTreesAreIdentical(layerChildren[i].get(), layerImplChildren[i], ho stImpl);
128 } 129 }
129 130
130 // Attempts to synchronizes a null tree. This should not crash, and should 131 // Attempts to synchronizes a null tree. This should not crash, and should
131 // return a null tree. 132 // return a null tree.
132 TEST(TreeSynchronizerTest, syncNullTree) 133 TEST(TreeSynchronizerTest, syncNullTree)
133 { 134 {
134 DebugScopedSetImplThread impl;
135
136 scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees (0, scoped_ptr<LayerImpl>(), 0); 135 scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees (0, scoped_ptr<LayerImpl>(), 0);
137 136
138 EXPECT_TRUE(!layerImplTreeRoot.get()); 137 EXPECT_TRUE(!layerImplTreeRoot.get());
139 } 138 }
140 139
141 // Constructs a very simple tree and synchronizes it without trying to reuse any preexisting layers. 140 // Constructs a very simple tree and synchronizes it without trying to reuse any preexisting layers.
142 TEST(TreeSynchronizerTest, syncSimpleTreeFromEmpty) 141 TEST(TreeSynchronizerTest, syncSimpleTreeFromEmpty)
143 { 142 {
144 DebugScopedSetImplThread impl;
145
146 LayerTreeSettings settings; 143 LayerTreeSettings settings;
147 scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0); 144 FakeProxy proxy(scoped_ptr<Thread>(NULL));
145 DebugScopedSetImplThread impl(&proxy);
146 scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0, &proxy);
148 147
149 scoped_refptr<Layer> layerTreeRoot = Layer::create(); 148 scoped_refptr<Layer> layerTreeRoot = Layer::create();
150 layerTreeRoot->addChild(Layer::create()); 149 layerTreeRoot->addChild(Layer::create());
151 layerTreeRoot->addChild(Layer::create()); 150 layerTreeRoot->addChild(Layer::create());
152 151
153 scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees (layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); 152 scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees (layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get());
154 153
155 expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostIm pl.get()); 154 expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostIm pl.get());
156 } 155 }
157 156
158 // Constructs a very simple tree and synchronizes it attempting to reuse some la yers 157 // Constructs a very simple tree and synchronizes it attempting to reuse some la yers
159 TEST(TreeSynchronizerTest, syncSimpleTreeReusingLayers) 158 TEST(TreeSynchronizerTest, syncSimpleTreeReusingLayers)
160 { 159 {
161 DebugScopedSetImplThread impl;
162 std::vector<int> layerImplDestructionList; 160 std::vector<int> layerImplDestructionList;
163 161
164 LayerTreeSettings settings; 162 LayerTreeSettings settings;
165 scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0); 163 FakeProxy proxy(scoped_ptr<Thread>(NULL));
164 DebugScopedSetImplThread impl(&proxy);
165 scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0, &proxy);
166 166
167 scoped_refptr<Layer> layerTreeRoot = MockLayer::create(&layerImplDestruction List); 167 scoped_refptr<Layer> layerTreeRoot = MockLayer::create(&layerImplDestruction List);
168 layerTreeRoot->addChild(MockLayer::create(&layerImplDestructionList)); 168 layerTreeRoot->addChild(MockLayer::create(&layerImplDestructionList));
169 layerTreeRoot->addChild(MockLayer::create(&layerImplDestructionList)); 169 layerTreeRoot->addChild(MockLayer::create(&layerImplDestructionList));
170 170
171 scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees (layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); 171 scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees (layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get());
172 expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostIm pl.get()); 172 expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostIm pl.get());
173 173
174 // Add a new layer to the Layer side 174 // Add a new layer to the Layer side
175 layerTreeRoot->children()[0]->addChild(MockLayer::create(&layerImplDestructi onList)); 175 layerTreeRoot->children()[0]->addChild(MockLayer::create(&layerImplDestructi onList));
176 // Remove one. 176 // Remove one.
177 layerTreeRoot->children()[1]->removeFromParent(); 177 layerTreeRoot->children()[1]->removeFromParent();
178 int secondLayerImplId = layerImplTreeRoot->children()[1]->id(); 178 int secondLayerImplId = layerImplTreeRoot->children()[1]->id();
179 179
180 // Synchronize again. After the sync the trees should be equivalent and we s hould have created and destroyed one LayerImpl. 180 // Synchronize again. After the sync the trees should be equivalent and we s hould have created and destroyed one LayerImpl.
181 layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); 181 layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get());
182 expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostIm pl.get()); 182 expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostIm pl.get());
183 183
184 ASSERT_EQ(1u, layerImplDestructionList.size()); 184 ASSERT_EQ(1u, layerImplDestructionList.size());
185 EXPECT_EQ(secondLayerImplId, layerImplDestructionList[0]); 185 EXPECT_EQ(secondLayerImplId, layerImplDestructionList[0]);
186 } 186 }
187 187
188 // Constructs a very simple tree and checks that a stacking-order change is trac ked properly. 188 // Constructs a very simple tree and checks that a stacking-order change is trac ked properly.
189 TEST(TreeSynchronizerTest, syncSimpleTreeAndTrackStackingOrderChange) 189 TEST(TreeSynchronizerTest, syncSimpleTreeAndTrackStackingOrderChange)
190 { 190 {
191 DebugScopedSetImplThread impl;
192 std::vector<int> layerImplDestructionList; 191 std::vector<int> layerImplDestructionList;
193 192
194 LayerTreeSettings settings; 193 LayerTreeSettings settings;
195 scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0); 194 FakeProxy proxy(scoped_ptr<Thread>(NULL));
195 DebugScopedSetImplThread impl(&proxy);
196 scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0, &proxy);
196 197
197 // Set up the tree and sync once. child2 needs to be synced here, too, even though we 198 // Set up the tree and sync once. child2 needs to be synced here, too, even though we
198 // remove it to set up the intended scenario. 199 // remove it to set up the intended scenario.
199 scoped_refptr<Layer> layerTreeRoot = MockLayer::create(&layerImplDestruction List); 200 scoped_refptr<Layer> layerTreeRoot = MockLayer::create(&layerImplDestruction List);
200 scoped_refptr<Layer> child2 = MockLayer::create(&layerImplDestructionList); 201 scoped_refptr<Layer> child2 = MockLayer::create(&layerImplDestructionList);
201 layerTreeRoot->addChild(MockLayer::create(&layerImplDestructionList)); 202 layerTreeRoot->addChild(MockLayer::create(&layerImplDestructionList));
202 layerTreeRoot->addChild(child2); 203 layerTreeRoot->addChild(child2);
203 scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees (layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); 204 scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees (layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get());
204 expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostIm pl.get()); 205 expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostIm pl.get());
205 layerImplTreeRoot->resetAllChangeTrackingForSubtree(); 206 layerImplTreeRoot->resetAllChangeTrackingForSubtree();
206 207
207 // re-insert the layer and sync again. 208 // re-insert the layer and sync again.
208 child2->removeFromParent(); 209 child2->removeFromParent();
209 layerTreeRoot->addChild(child2); 210 layerTreeRoot->addChild(child2);
210 layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); 211 layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get());
211 expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostIm pl.get()); 212 expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostIm pl.get());
212 213
213 // Check that the impl thread properly tracked the change. 214 // Check that the impl thread properly tracked the change.
214 EXPECT_FALSE(layerImplTreeRoot->layerPropertyChanged()); 215 EXPECT_FALSE(layerImplTreeRoot->layerPropertyChanged());
215 EXPECT_FALSE(layerImplTreeRoot->children()[0]->layerPropertyChanged()); 216 EXPECT_FALSE(layerImplTreeRoot->children()[0]->layerPropertyChanged());
216 EXPECT_TRUE(layerImplTreeRoot->children()[1]->layerPropertyChanged()); 217 EXPECT_TRUE(layerImplTreeRoot->children()[1]->layerPropertyChanged());
217 } 218 }
218 219
219 TEST(TreeSynchronizerTest, syncSimpleTreeAndProperties) 220 TEST(TreeSynchronizerTest, syncSimpleTreeAndProperties)
220 { 221 {
221 DebugScopedSetImplThread impl;
222
223 LayerTreeSettings settings; 222 LayerTreeSettings settings;
224 scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0); 223 FakeProxy proxy(scoped_ptr<Thread>(NULL));
224 DebugScopedSetImplThread impl(&proxy);
225 scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0, &proxy);
225 226
226 scoped_refptr<Layer> layerTreeRoot = Layer::create(); 227 scoped_refptr<Layer> layerTreeRoot = Layer::create();
227 layerTreeRoot->addChild(Layer::create()); 228 layerTreeRoot->addChild(Layer::create());
228 layerTreeRoot->addChild(Layer::create()); 229 layerTreeRoot->addChild(Layer::create());
229 230
230 // Pick some random properties to set. The values are not important, we're j ust testing that at least some properties are making it through. 231 // Pick some random properties to set. The values are not important, we're j ust testing that at least some properties are making it through.
231 gfx::PointF rootPosition = gfx::PointF(2.3f, 7.4f); 232 gfx::PointF rootPosition = gfx::PointF(2.3f, 7.4f);
232 layerTreeRoot->setPosition(rootPosition); 233 layerTreeRoot->setPosition(rootPosition);
233 234
234 float firstChildOpacity = 0.25f; 235 float firstChildOpacity = 0.25f;
(...skipping 12 matching lines...) Expand all
247 248
248 EXPECT_EQ(firstChildOpacity, layerImplTreeRoot->children()[0]->opacity()); 249 EXPECT_EQ(firstChildOpacity, layerImplTreeRoot->children()[0]->opacity());
249 250
250 gfx::Size secondLayerImplChildBounds = layerImplTreeRoot->children()[1]->bou nds(); 251 gfx::Size secondLayerImplChildBounds = layerImplTreeRoot->children()[1]->bou nds();
251 EXPECT_EQ(secondChildBounds.width(), secondLayerImplChildBounds.width()); 252 EXPECT_EQ(secondChildBounds.width(), secondLayerImplChildBounds.width());
252 EXPECT_EQ(secondChildBounds.height(), secondLayerImplChildBounds.height()); 253 EXPECT_EQ(secondChildBounds.height(), secondLayerImplChildBounds.height());
253 } 254 }
254 255
255 TEST(TreeSynchronizerTest, reuseLayerImplsAfterStructuralChange) 256 TEST(TreeSynchronizerTest, reuseLayerImplsAfterStructuralChange)
256 { 257 {
257 DebugScopedSetImplThread impl;
258 std::vector<int> layerImplDestructionList; 258 std::vector<int> layerImplDestructionList;
259 259
260 LayerTreeSettings settings; 260 LayerTreeSettings settings;
261 scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0); 261 FakeProxy proxy(scoped_ptr<Thread>(NULL));
262 DebugScopedSetImplThread impl(&proxy);
263 scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0, &proxy);
262 264
263 // Set up a tree with this sort of structure: 265 // Set up a tree with this sort of structure:
264 // root --- A --- B ---+--- C 266 // root --- A --- B ---+--- C
265 // | 267 // |
266 // +--- D 268 // +--- D
267 scoped_refptr<Layer> layerTreeRoot = MockLayer::create(&layerImplDestruction List); 269 scoped_refptr<Layer> layerTreeRoot = MockLayer::create(&layerImplDestruction List);
268 layerTreeRoot->addChild(MockLayer::create(&layerImplDestructionList)); 270 layerTreeRoot->addChild(MockLayer::create(&layerImplDestructionList));
269 271
270 scoped_refptr<Layer> layerA = layerTreeRoot->children()[0].get(); 272 scoped_refptr<Layer> layerA = layerTreeRoot->children()[0].get();
271 layerA->addChild(MockLayer::create(&layerImplDestructionList)); 273 layerA->addChild(MockLayer::create(&layerImplDestructionList));
(...skipping 25 matching lines...) Expand all
297 // After another synchronize our trees should match and we should not have d estroyed any LayerImpls 299 // After another synchronize our trees should match and we should not have d estroyed any LayerImpls
298 layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); 300 layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get());
299 expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostIm pl.get()); 301 expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostIm pl.get());
300 302
301 EXPECT_EQ(0u, layerImplDestructionList.size()); 303 EXPECT_EQ(0u, layerImplDestructionList.size());
302 } 304 }
303 305
304 // Constructs a very simple tree, synchronizes it, then synchronizes to a totall y new tree. All layers from the old tree should be deleted. 306 // Constructs a very simple tree, synchronizes it, then synchronizes to a totall y new tree. All layers from the old tree should be deleted.
305 TEST(TreeSynchronizerTest, syncSimpleTreeThenDestroy) 307 TEST(TreeSynchronizerTest, syncSimpleTreeThenDestroy)
306 { 308 {
307 DebugScopedSetImplThread impl;
308 std::vector<int> layerImplDestructionList; 309 std::vector<int> layerImplDestructionList;
309 310
310 LayerTreeSettings settings; 311 LayerTreeSettings settings;
311 scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0); 312 FakeProxy proxy(scoped_ptr<Thread>(NULL));
313 DebugScopedSetImplThread impl(&proxy);
314 scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0, &proxy);
312 315
313 scoped_refptr<Layer> oldLayerTreeRoot = MockLayer::create(&layerImplDestruct ionList); 316 scoped_refptr<Layer> oldLayerTreeRoot = MockLayer::create(&layerImplDestruct ionList);
314 oldLayerTreeRoot->addChild(MockLayer::create(&layerImplDestructionList)); 317 oldLayerTreeRoot->addChild(MockLayer::create(&layerImplDestructionList));
315 oldLayerTreeRoot->addChild(MockLayer::create(&layerImplDestructionList)); 318 oldLayerTreeRoot->addChild(MockLayer::create(&layerImplDestructionList));
316 319
317 int oldTreeRootLayerId = oldLayerTreeRoot->id(); 320 int oldTreeRootLayerId = oldLayerTreeRoot->id();
318 int oldTreeFirstChildLayerId = oldLayerTreeRoot->children()[0]->id(); 321 int oldTreeFirstChildLayerId = oldLayerTreeRoot->children()[0]->id();
319 int oldTreeSecondChildLayerId = oldLayerTreeRoot->children()[1]->id(); 322 int oldTreeSecondChildLayerId = oldLayerTreeRoot->children()[1]->id();
320 323
321 scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees (oldLayerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); 324 scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees (oldLayerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get());
(...skipping 10 matching lines...) Expand all
332 ASSERT_EQ(3u, layerImplDestructionList.size()); 335 ASSERT_EQ(3u, layerImplDestructionList.size());
333 336
334 EXPECT_TRUE(std::find(layerImplDestructionList.begin(), layerImplDestruction List.end(), oldTreeRootLayerId) != layerImplDestructionList.end()); 337 EXPECT_TRUE(std::find(layerImplDestructionList.begin(), layerImplDestruction List.end(), oldTreeRootLayerId) != layerImplDestructionList.end());
335 EXPECT_TRUE(std::find(layerImplDestructionList.begin(), layerImplDestruction List.end(), oldTreeFirstChildLayerId) != layerImplDestructionList.end()); 338 EXPECT_TRUE(std::find(layerImplDestructionList.begin(), layerImplDestruction List.end(), oldTreeFirstChildLayerId) != layerImplDestructionList.end());
336 EXPECT_TRUE(std::find(layerImplDestructionList.begin(), layerImplDestruction List.end(), oldTreeSecondChildLayerId) != layerImplDestructionList.end()); 339 EXPECT_TRUE(std::find(layerImplDestructionList.begin(), layerImplDestruction List.end(), oldTreeSecondChildLayerId) != layerImplDestructionList.end());
337 } 340 }
338 341
339 // Constructs+syncs a tree with mask, replica, and replica mask layers. 342 // Constructs+syncs a tree with mask, replica, and replica mask layers.
340 TEST(TreeSynchronizerTest, syncMaskReplicaAndReplicaMaskLayers) 343 TEST(TreeSynchronizerTest, syncMaskReplicaAndReplicaMaskLayers)
341 { 344 {
342 DebugScopedSetImplThread impl;
343
344 LayerTreeSettings settings; 345 LayerTreeSettings settings;
345 scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0); 346 FakeProxy proxy(scoped_ptr<Thread>(NULL));
347 DebugScopedSetImplThread impl(&proxy);
348 scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0, &proxy);
346 349
347 scoped_refptr<Layer> layerTreeRoot = Layer::create(); 350 scoped_refptr<Layer> layerTreeRoot = Layer::create();
348 layerTreeRoot->addChild(Layer::create()); 351 layerTreeRoot->addChild(Layer::create());
349 layerTreeRoot->addChild(Layer::create()); 352 layerTreeRoot->addChild(Layer::create());
350 layerTreeRoot->addChild(Layer::create()); 353 layerTreeRoot->addChild(Layer::create());
351 354
352 // First child gets a mask layer. 355 // First child gets a mask layer.
353 scoped_refptr<Layer> maskLayer = Layer::create(); 356 scoped_refptr<Layer> maskLayer = Layer::create();
354 layerTreeRoot->children()[0]->setMaskLayer(maskLayer.get()); 357 layerTreeRoot->children()[0]->setMaskLayer(maskLayer.get());
355 358
(...skipping 22 matching lines...) Expand all
378 expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostIm pl.get()); 381 expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostIm pl.get());
379 382
380 // Remove the replica mask. 383 // Remove the replica mask.
381 replicaLayerWithMask->setMaskLayer(0); 384 replicaLayerWithMask->setMaskLayer(0);
382 layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); 385 layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get());
383 expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostIm pl.get()); 386 expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostIm pl.get());
384 } 387 }
385 388
386 TEST(TreeSynchronizerTest, synchronizeAnimations) 389 TEST(TreeSynchronizerTest, synchronizeAnimations)
387 { 390 {
388 DebugScopedSetImplThread impl;
389
390 LayerTreeSettings settings; 391 LayerTreeSettings settings;
391 scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0); 392 FakeProxy proxy(scoped_ptr<Thread>(NULL));
393 DebugScopedSetImplThread impl(&proxy);
394 scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0, &proxy);
392 395
393 scoped_refptr<Layer> layerTreeRoot = Layer::create(); 396 scoped_refptr<Layer> layerTreeRoot = Layer::create();
394 397
395 FakeLayerAnimationControllerClient dummy; 398 FakeLayerAnimationControllerClient dummy;
396 layerTreeRoot->setLayerAnimationController(FakeLayerAnimationController::cre ate(&dummy).PassAs<LayerAnimationController>()); 399 layerTreeRoot->setLayerAnimationController(FakeLayerAnimationController::cre ate(&dummy).PassAs<LayerAnimationController>());
397 400
398 EXPECT_FALSE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layer AnimationController())->synchronizedAnimations()); 401 EXPECT_FALSE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layer AnimationController())->synchronizedAnimations());
399 402
400 scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees (layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); 403 scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees (layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get());
401 layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); 404 layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get());
402 405
403 EXPECT_TRUE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerA nimationController())->synchronizedAnimations()); 406 EXPECT_TRUE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerA nimationController())->synchronizedAnimations());
404 } 407 }
405 408
406 } // anonymous namespace 409 } // anonymous namespace
OLDNEW
« no previous file with comments | « cc/tiled_layer_unittest.cc ('k') | cc/video_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698