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

Side by Side Diff: cc/trees/tree_synchronizer_unittest.cc

Issue 202763002: Switch to use SharedBitmapManager all the time in cc_unittests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « cc/trees/quad_culler_unittest.cc ('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/trees/tree_synchronizer.h" 5 #include "cc/trees/tree_synchronizer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/format_macros.h" 11 #include "base/format_macros.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "cc/animation/layer_animation_controller.h" 13 #include "cc/animation/layer_animation_controller.h"
14 #include "cc/layers/layer.h" 14 #include "cc/layers/layer.h"
15 #include "cc/layers/layer_impl.h" 15 #include "cc/layers/layer_impl.h"
16 #include "cc/test/animation_test_common.h" 16 #include "cc/test/animation_test_common.h"
17 #include "cc/test/fake_impl_proxy.h" 17 #include "cc/test/fake_impl_proxy.h"
18 #include "cc/test/fake_layer_tree_host.h" 18 #include "cc/test/fake_layer_tree_host.h"
19 #include "cc/test/test_shared_bitmap_manager.h"
19 #include "cc/trees/proxy.h" 20 #include "cc/trees/proxy.h"
20 #include "cc/trees/single_thread_proxy.h" 21 #include "cc/trees/single_thread_proxy.h"
21 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
22 23
23 namespace cc { 24 namespace cc {
24 namespace { 25 namespace {
25 26
26 class MockLayerImpl : public LayerImpl { 27 class MockLayerImpl : public LayerImpl {
27 public: 28 public:
28 static scoped_ptr<MockLayerImpl> Create(LayerTreeImpl* tree_impl, 29 static scoped_ptr<MockLayerImpl> Create(LayerTreeImpl* tree_impl,
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 ExpectTreesAreIdentical(layer_tree_root.get(), 551 ExpectTreesAreIdentical(layer_tree_root.get(),
551 layer_impl_tree_root.get(), 552 layer_impl_tree_root.get(),
552 host_->active_tree()); 553 host_->active_tree());
553 } 554 }
554 555
555 TEST_F(TreeSynchronizerTest, SynchronizeAnimations) { 556 TEST_F(TreeSynchronizerTest, SynchronizeAnimations) {
556 LayerTreeSettings settings; 557 LayerTreeSettings settings;
557 FakeProxy proxy; 558 FakeProxy proxy;
558 DebugScopedSetImplThread impl(&proxy); 559 DebugScopedSetImplThread impl(&proxy);
559 FakeRenderingStatsInstrumentation stats_instrumentation; 560 FakeRenderingStatsInstrumentation stats_instrumentation;
560 scoped_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create( 561 scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
561 settings, NULL, &proxy, &stats_instrumentation, NULL, 0); 562 new TestSharedBitmapManager());
563 scoped_ptr<LayerTreeHostImpl> host_impl =
564 LayerTreeHostImpl::Create(settings,
565 NULL,
566 &proxy,
567 &stats_instrumentation,
568 shared_bitmap_manager.get(),
569 0);
562 570
563 scoped_refptr<Layer> layer_tree_root = Layer::Create(); 571 scoped_refptr<Layer> layer_tree_root = Layer::Create();
564 host_->SetRootLayer(layer_tree_root); 572 host_->SetRootLayer(layer_tree_root);
565 573
566 layer_tree_root->SetLayerAnimationControllerForTest( 574 layer_tree_root->SetLayerAnimationControllerForTest(
567 FakeLayerAnimationController::Create()); 575 FakeLayerAnimationController::Create());
568 576
569 EXPECT_FALSE(static_cast<FakeLayerAnimationController*>( 577 EXPECT_FALSE(static_cast<FakeLayerAnimationController*>(
570 layer_tree_root->layer_animation_controller())->SynchronizedAnimations()); 578 layer_tree_root->layer_animation_controller())->SynchronizedAnimations());
571 579
(...skipping 10 matching lines...) Expand all
582 590
583 EXPECT_TRUE(static_cast<FakeLayerAnimationController*>( 591 EXPECT_TRUE(static_cast<FakeLayerAnimationController*>(
584 layer_tree_root->layer_animation_controller())->SynchronizedAnimations()); 592 layer_tree_root->layer_animation_controller())->SynchronizedAnimations());
585 } 593 }
586 594
587 TEST_F(TreeSynchronizerTest, SynchronizeScrollParent) { 595 TEST_F(TreeSynchronizerTest, SynchronizeScrollParent) {
588 LayerTreeSettings settings; 596 LayerTreeSettings settings;
589 FakeProxy proxy; 597 FakeProxy proxy;
590 DebugScopedSetImplThread impl(&proxy); 598 DebugScopedSetImplThread impl(&proxy);
591 FakeRenderingStatsInstrumentation stats_instrumentation; 599 FakeRenderingStatsInstrumentation stats_instrumentation;
592 scoped_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create( 600 scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
593 settings, NULL, &proxy, &stats_instrumentation, NULL, 0); 601 new TestSharedBitmapManager());
602 scoped_ptr<LayerTreeHostImpl> host_impl =
603 LayerTreeHostImpl::Create(settings,
604 NULL,
605 &proxy,
606 &stats_instrumentation,
607 shared_bitmap_manager.get(),
608 0);
594 609
595 scoped_refptr<Layer> layer_tree_root = Layer::Create(); 610 scoped_refptr<Layer> layer_tree_root = Layer::Create();
596 scoped_refptr<Layer> scroll_parent = Layer::Create(); 611 scoped_refptr<Layer> scroll_parent = Layer::Create();
597 layer_tree_root->AddChild(scroll_parent); 612 layer_tree_root->AddChild(scroll_parent);
598 layer_tree_root->AddChild(Layer::Create()); 613 layer_tree_root->AddChild(Layer::Create());
599 layer_tree_root->AddChild(Layer::Create()); 614 layer_tree_root->AddChild(Layer::Create());
600 615
601 host_->SetRootLayer(layer_tree_root); 616 host_->SetRootLayer(layer_tree_root);
602 617
603 // First child is the second and third child's scroll parent. 618 // First child is the second and third child's scroll parent.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 layer_impl_tree_root.get(), 663 layer_impl_tree_root.get(),
649 host_impl->active_tree()); 664 host_impl->active_tree());
650 } 665 }
651 } 666 }
652 667
653 TEST_F(TreeSynchronizerTest, SynchronizeClipParent) { 668 TEST_F(TreeSynchronizerTest, SynchronizeClipParent) {
654 LayerTreeSettings settings; 669 LayerTreeSettings settings;
655 FakeProxy proxy; 670 FakeProxy proxy;
656 DebugScopedSetImplThread impl(&proxy); 671 DebugScopedSetImplThread impl(&proxy);
657 FakeRenderingStatsInstrumentation stats_instrumentation; 672 FakeRenderingStatsInstrumentation stats_instrumentation;
658 scoped_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create( 673 scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
659 settings, NULL, &proxy, &stats_instrumentation, NULL, 0); 674 new TestSharedBitmapManager());
675 scoped_ptr<LayerTreeHostImpl> host_impl =
676 LayerTreeHostImpl::Create(settings,
677 NULL,
678 &proxy,
679 &stats_instrumentation,
680 shared_bitmap_manager.get(),
681 0);
660 682
661 scoped_refptr<Layer> layer_tree_root = Layer::Create(); 683 scoped_refptr<Layer> layer_tree_root = Layer::Create();
662 scoped_refptr<Layer> clip_parent = Layer::Create(); 684 scoped_refptr<Layer> clip_parent = Layer::Create();
663 scoped_refptr<Layer> intervening = Layer::Create(); 685 scoped_refptr<Layer> intervening = Layer::Create();
664 scoped_refptr<Layer> clip_child1 = Layer::Create(); 686 scoped_refptr<Layer> clip_child1 = Layer::Create();
665 scoped_refptr<Layer> clip_child2 = Layer::Create(); 687 scoped_refptr<Layer> clip_child2 = Layer::Create();
666 layer_tree_root->AddChild(clip_parent); 688 layer_tree_root->AddChild(clip_parent);
667 clip_parent->AddChild(intervening); 689 clip_parent->AddChild(intervening);
668 intervening->AddChild(clip_child1); 690 intervening->AddChild(clip_child1);
669 intervening->AddChild(clip_child2); 691 intervening->AddChild(clip_child2);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 host_impl->active_tree()); 748 host_impl->active_tree());
727 749
728 // The clip children should have been unhooked. 750 // The clip children should have been unhooked.
729 EXPECT_EQ(2u, intervening->children().size()); 751 EXPECT_EQ(2u, intervening->children().size());
730 EXPECT_FALSE(clip_child2->clip_parent()); 752 EXPECT_FALSE(clip_child2->clip_parent());
731 EXPECT_FALSE(additional_clip_child->clip_parent()); 753 EXPECT_FALSE(additional_clip_child->clip_parent());
732 } 754 }
733 755
734 } // namespace 756 } // namespace
735 } // namespace cc 757 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/quad_culler_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698