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

Side by Side Diff: cc/tree_synchronizer_unittest.cc

Issue 11443004: Maintain global lists of animation controllers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years 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 | Annotate | Revision Log
« cc/animation_registrar.h ('K') | « cc/thread_proxy.h ('k') | no next file » | 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 "cc/tree_synchronizer.h" 5 #include "cc/tree_synchronizer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "cc/layer.h" 9 #include "cc/layer.h"
10 #include "cc/layer_animation_controller.h" 10 #include "cc/layer_animation_controller.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 , m_layerImplDestructionList(layerImplDestructionList) 70 , m_layerImplDestructionList(layerImplDestructionList)
71 { 71 {
72 } 72 }
73 virtual ~MockLayer() { } 73 virtual ~MockLayer() { }
74 74
75 std::vector<int>* m_layerImplDestructionList; 75 std::vector<int>* m_layerImplDestructionList;
76 }; 76 };
77 77
78 class FakeLayerAnimationController : public LayerAnimationController { 78 class FakeLayerAnimationController : public LayerAnimationController {
79 public: 79 public:
80 static scoped_ptr<FakeLayerAnimationController> create(LayerAnimationControl lerClient* client) 80 static scoped_refptr<LayerAnimationController> create()
81 { 81 {
82 return make_scoped_ptr(new FakeLayerAnimationController(client)); 82 return static_cast<LayerAnimationController*>(new FakeLayerAnimationCont roller);
83 } 83 }
84 84
85 bool synchronizedAnimations() const { return m_synchronizedAnimations; } 85 bool synchronizedAnimations() const { return m_synchronizedAnimations; }
86 86
87 private: 87 private:
88 explicit FakeLayerAnimationController(LayerAnimationControllerClient* client ) 88 FakeLayerAnimationController()
89 : LayerAnimationController(client) 89 : LayerAnimationController(AnimationRegistrar::MainThread)
90 , m_synchronizedAnimations(false) 90 , m_synchronizedAnimations(false)
91 { 91 { }
92 } 92
93 virtual ~FakeLayerAnimationController() { }
93 94
94 virtual void pushAnimationUpdatesTo(LayerAnimationController* controllerImpl ) 95 virtual void pushAnimationUpdatesTo(LayerAnimationController* controllerImpl )
95 { 96 {
96 LayerAnimationController::pushAnimationUpdatesTo(controllerImpl); 97 LayerAnimationController::pushAnimationUpdatesTo(controllerImpl);
97 m_synchronizedAnimations = true; 98 m_synchronizedAnimations = true;
98 } 99 }
99 100
100 bool m_synchronizedAnimations; 101 bool m_synchronizedAnimations;
101 }; 102 };
102 103
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 388
388 TEST(TreeSynchronizerTest, synchronizeAnimations) 389 TEST(TreeSynchronizerTest, synchronizeAnimations)
389 { 390 {
390 LayerTreeSettings settings; 391 LayerTreeSettings settings;
391 FakeProxy proxy(scoped_ptr<Thread>(NULL)); 392 FakeProxy proxy(scoped_ptr<Thread>(NULL));
392 DebugScopedSetImplThread impl(&proxy); 393 DebugScopedSetImplThread impl(&proxy);
393 scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0, &proxy); 394 scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0, &proxy);
394 395
395 scoped_refptr<Layer> layerTreeRoot = Layer::create(); 396 scoped_refptr<Layer> layerTreeRoot = Layer::create();
396 397
397 FakeLayerAnimationControllerClient dummy; 398 layerTreeRoot->setLayerAnimationController(FakeLayerAnimationController::cre ate());
398 layerTreeRoot->setLayerAnimationController(FakeLayerAnimationController::cre ate(&dummy).PassAs<LayerAnimationController>());
399 399
400 EXPECT_FALSE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layer AnimationController())->synchronizedAnimations()); 400 EXPECT_FALSE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layer AnimationController())->synchronizedAnimations());
401 401
402 scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees (layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); 402 scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees (layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get());
403 layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); 403 layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get());
404 404
405 EXPECT_TRUE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerA nimationController())->synchronizedAnimations()); 405 EXPECT_TRUE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerA nimationController())->synchronizedAnimations());
406 } 406 }
407 407
408 } // namespace 408 } // namespace
409 } // namespace cc 409 } // namespace cc
OLDNEW
« cc/animation_registrar.h ('K') | « cc/thread_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698