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

Side by Side Diff: cc/animation/scrollbar_animation_controller_thinning_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/animation/scrollbar_animation_controller_linear_fade_unittest.cc ('k') | cc/cc_tests.gyp » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/animation/scrollbar_animation_controller_thinning.h" 5 #include "cc/animation/scrollbar_animation_controller_thinning.h"
6 6
7 #include "cc/layers/solid_color_scrollbar_layer_impl.h" 7 #include "cc/layers/solid_color_scrollbar_layer_impl.h"
8 #include "cc/test/fake_impl_proxy.h" 8 #include "cc/test/fake_impl_proxy.h"
9 #include "cc/test/fake_layer_tree_host_impl.h" 9 #include "cc/test/fake_layer_tree_host_impl.h"
10 #include "cc/test/test_shared_bitmap_manager.h"
10 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
11 12
12 namespace cc { 13 namespace cc {
13 namespace { 14 namespace {
14 15
15 class ScrollbarAnimationControllerThinningTest : public testing::Test { 16 class ScrollbarAnimationControllerThinningTest : public testing::Test {
16 public: 17 public:
17 ScrollbarAnimationControllerThinningTest() : host_impl_(&proxy_) {} 18 ScrollbarAnimationControllerThinningTest()
19 : host_impl_(&proxy_, &shared_bitmap_manager_) {}
18 20
19 protected: 21 protected:
20 virtual void SetUp() { 22 virtual void SetUp() {
21 scoped_ptr<LayerImpl> scroll_layer = 23 scoped_ptr<LayerImpl> scroll_layer =
22 LayerImpl::Create(host_impl_.active_tree(), 1); 24 LayerImpl::Create(host_impl_.active_tree(), 1);
23 clip_layer_ = LayerImpl::Create(host_impl_.active_tree(), 3); 25 clip_layer_ = LayerImpl::Create(host_impl_.active_tree(), 3);
24 scroll_layer->SetScrollClipLayer(clip_layer_->id()); 26 scroll_layer->SetScrollClipLayer(clip_layer_->id());
25 LayerImpl* scroll_layer_ptr = scroll_layer.get(); 27 LayerImpl* scroll_layer_ptr = scroll_layer.get();
26 clip_layer_->AddChild(scroll_layer.Pass()); 28 clip_layer_->AddChild(scroll_layer.Pass());
27 29
(...skipping 14 matching lines...) Expand all
42 clip_layer_->SetBounds(gfx::Size(100, 100)); 44 clip_layer_->SetBounds(gfx::Size(100, 100));
43 scroll_layer_ptr->SetBounds(gfx::Size(50, 50)); 45 scroll_layer_ptr->SetBounds(gfx::Size(50, 50));
44 46
45 scrollbar_controller_ = ScrollbarAnimationControllerThinning::CreateForTest( 47 scrollbar_controller_ = ScrollbarAnimationControllerThinning::CreateForTest(
46 scroll_layer_ptr, 48 scroll_layer_ptr,
47 base::TimeDelta::FromSeconds(2), 49 base::TimeDelta::FromSeconds(2),
48 base::TimeDelta::FromSeconds(3)); 50 base::TimeDelta::FromSeconds(3));
49 } 51 }
50 52
51 FakeImplProxy proxy_; 53 FakeImplProxy proxy_;
54 TestSharedBitmapManager shared_bitmap_manager_;
52 FakeLayerTreeHostImpl host_impl_; 55 FakeLayerTreeHostImpl host_impl_;
53 scoped_ptr<ScrollbarAnimationControllerThinning> scrollbar_controller_; 56 scoped_ptr<ScrollbarAnimationControllerThinning> scrollbar_controller_;
54 scoped_ptr<LayerImpl> clip_layer_; 57 scoped_ptr<LayerImpl> clip_layer_;
55 scoped_ptr<SolidColorScrollbarLayerImpl> scrollbar_layer_; 58 scoped_ptr<SolidColorScrollbarLayerImpl> scrollbar_layer_;
56 }; 59 };
57 60
58 // Check initialization of scrollbar. 61 // Check initialization of scrollbar.
59 TEST_F(ScrollbarAnimationControllerThinningTest, Idle) { 62 TEST_F(ScrollbarAnimationControllerThinningTest, Idle) {
60 scrollbar_controller_->Animate(base::TimeTicks()); 63 scrollbar_controller_->Animate(base::TimeTicks());
61 EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity()); 64 EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity());
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 338
336 time += base::TimeDelta::FromSeconds(1); 339 time += base::TimeDelta::FromSeconds(1);
337 scrollbar_controller_->Animate(time); 340 scrollbar_controller_->Animate(time);
338 EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity()); 341 EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity());
339 // The thickness now gets big again. 342 // The thickness now gets big again.
340 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); 343 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
341 } 344 }
342 345
343 } // namespace 346 } // namespace
344 } // namespace cc 347 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/scrollbar_animation_controller_linear_fade_unittest.cc ('k') | cc/cc_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698