summaryrefslogtreecommitdiffstats
path: root/cc/tree_synchronizer_unittest.cc
diff options
context:
space:
mode:
authoraelias@chromium.org <aelias@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-08 07:03:44 +0000
committeraelias@chromium.org <aelias@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-08 07:03:44 +0000
commit61de581375ce3d76628772a78719cad63f0aabae (patch)
tree90e5818095cfa31182ceca09224c42d999644e4d /cc/tree_synchronizer_unittest.cc
parentde8686ed05a28324b0978b2bb81cf3407f13762b (diff)
downloadchromium_src-61de581375ce3d76628772a78719cad63f0aabae.zip
chromium_src-61de581375ce3d76628772a78719cad63f0aabae.tar.gz
chromium_src-61de581375ce3d76628772a78719cad63f0aabae.tar.bz2
Remove static thread pointers from CC, attempt 3
BUG=152904 Review URL: https://chromiumcodereview.appspot.com/11232051 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166627 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/tree_synchronizer_unittest.cc')
-rw-r--r--cc/tree_synchronizer_unittest.cc47
1 files changed, 25 insertions, 22 deletions
diff --git a/cc/tree_synchronizer_unittest.cc b/cc/tree_synchronizer_unittest.cc
index ab60d6f..8f3585c 100644
--- a/cc/tree_synchronizer_unittest.cc
+++ b/cc/tree_synchronizer_unittest.cc
@@ -14,6 +14,7 @@
#include "cc/proxy.h"
#include "cc/single_thread_proxy.h"
#include "cc/test/animation_test_common.h"
+#include "cc/test/fake_proxy.h"
#include "testing/gtest/include/gtest/gtest.h"
using namespace cc;
@@ -132,8 +133,6 @@ void expectTreesAreIdentical(Layer* layer, LayerImpl* layerImpl, LayerTreeHostIm
// return a null tree.
TEST(TreeSynchronizerTest, syncNullTree)
{
- DebugScopedSetImplThread impl;
-
scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(0, scoped_ptr<LayerImpl>(), 0);
EXPECT_TRUE(!layerImplTreeRoot.get());
@@ -142,10 +141,10 @@ TEST(TreeSynchronizerTest, syncNullTree)
// Constructs a very simple tree and synchronizes it without trying to reuse any preexisting layers.
TEST(TreeSynchronizerTest, syncSimpleTreeFromEmpty)
{
- DebugScopedSetImplThread impl;
-
LayerTreeSettings settings;
- scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0);
+ FakeProxy proxy(scoped_ptr<Thread>(NULL));
+ DebugScopedSetImplThread impl(&proxy);
+ scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0, &proxy);
scoped_refptr<Layer> layerTreeRoot = Layer::create();
layerTreeRoot->addChild(Layer::create());
@@ -159,11 +158,12 @@ TEST(TreeSynchronizerTest, syncSimpleTreeFromEmpty)
// Constructs a very simple tree and synchronizes it attempting to reuse some layers
TEST(TreeSynchronizerTest, syncSimpleTreeReusingLayers)
{
- DebugScopedSetImplThread impl;
std::vector<int> layerImplDestructionList;
LayerTreeSettings settings;
- scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0);
+ FakeProxy proxy(scoped_ptr<Thread>(NULL));
+ DebugScopedSetImplThread impl(&proxy);
+ scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0, &proxy);
scoped_refptr<Layer> layerTreeRoot = MockLayer::create(&layerImplDestructionList);
layerTreeRoot->addChild(MockLayer::create(&layerImplDestructionList));
@@ -189,11 +189,12 @@ TEST(TreeSynchronizerTest, syncSimpleTreeReusingLayers)
// Constructs a very simple tree and checks that a stacking-order change is tracked properly.
TEST(TreeSynchronizerTest, syncSimpleTreeAndTrackStackingOrderChange)
{
- DebugScopedSetImplThread impl;
std::vector<int> layerImplDestructionList;
LayerTreeSettings settings;
- scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0);
+ FakeProxy proxy(scoped_ptr<Thread>(NULL));
+ DebugScopedSetImplThread impl(&proxy);
+ scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0, &proxy);
// Set up the tree and sync once. child2 needs to be synced here, too, even though we
// remove it to set up the intended scenario.
@@ -219,10 +220,10 @@ TEST(TreeSynchronizerTest, syncSimpleTreeAndTrackStackingOrderChange)
TEST(TreeSynchronizerTest, syncSimpleTreeAndProperties)
{
- DebugScopedSetImplThread impl;
-
LayerTreeSettings settings;
- scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0);
+ FakeProxy proxy(scoped_ptr<Thread>(NULL));
+ DebugScopedSetImplThread impl(&proxy);
+ scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0, &proxy);
scoped_refptr<Layer> layerTreeRoot = Layer::create();
layerTreeRoot->addChild(Layer::create());
@@ -255,11 +256,12 @@ TEST(TreeSynchronizerTest, syncSimpleTreeAndProperties)
TEST(TreeSynchronizerTest, reuseLayerImplsAfterStructuralChange)
{
- DebugScopedSetImplThread impl;
std::vector<int> layerImplDestructionList;
LayerTreeSettings settings;
- scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0);
+ FakeProxy proxy(scoped_ptr<Thread>(NULL));
+ DebugScopedSetImplThread impl(&proxy);
+ scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0, &proxy);
// Set up a tree with this sort of structure:
// root --- A --- B ---+--- C
@@ -305,11 +307,12 @@ TEST(TreeSynchronizerTest, reuseLayerImplsAfterStructuralChange)
// Constructs a very simple tree, synchronizes it, then synchronizes to a totally new tree. All layers from the old tree should be deleted.
TEST(TreeSynchronizerTest, syncSimpleTreeThenDestroy)
{
- DebugScopedSetImplThread impl;
std::vector<int> layerImplDestructionList;
LayerTreeSettings settings;
- scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0);
+ FakeProxy proxy(scoped_ptr<Thread>(NULL));
+ DebugScopedSetImplThread impl(&proxy);
+ scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0, &proxy);
scoped_refptr<Layer> oldLayerTreeRoot = MockLayer::create(&layerImplDestructionList);
oldLayerTreeRoot->addChild(MockLayer::create(&layerImplDestructionList));
@@ -340,10 +343,10 @@ TEST(TreeSynchronizerTest, syncSimpleTreeThenDestroy)
// Constructs+syncs a tree with mask, replica, and replica mask layers.
TEST(TreeSynchronizerTest, syncMaskReplicaAndReplicaMaskLayers)
{
- DebugScopedSetImplThread impl;
-
LayerTreeSettings settings;
- scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0);
+ FakeProxy proxy(scoped_ptr<Thread>(NULL));
+ DebugScopedSetImplThread impl(&proxy);
+ scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0, &proxy);
scoped_refptr<Layer> layerTreeRoot = Layer::create();
layerTreeRoot->addChild(Layer::create());
@@ -386,10 +389,10 @@ TEST(TreeSynchronizerTest, syncMaskReplicaAndReplicaMaskLayers)
TEST(TreeSynchronizerTest, synchronizeAnimations)
{
- DebugScopedSetImplThread impl;
-
LayerTreeSettings settings;
- scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0);
+ FakeProxy proxy(scoped_ptr<Thread>(NULL));
+ DebugScopedSetImplThread impl(&proxy);
+ scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0, &proxy);
scoped_refptr<Layer> layerTreeRoot = Layer::create();