OLD | NEW |
---|---|
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/top_controls_manager.h" | 5 #include "cc/top_controls_manager.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/time.h" | 8 #include "base/time.h" |
9 #include "cc/layer_impl.h" | 9 #include "cc/layer_impl.h" |
10 #include "cc/layer_tree_impl.h" | 10 #include "cc/layer_tree_impl.h" |
11 #include "cc/test/fake_impl_proxy.h" | 11 #include "cc/test/fake_impl_proxy.h" |
12 #include "cc/test/fake_layer_tree_host_impl.h" | 12 #include "cc/test/fake_layer_tree_host_impl.h" |
13 #include "cc/top_controls_manager_client.h" | 13 #include "cc/top_controls_manager_client.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 #include "ui/gfx/vector2d_f.h" | 15 #include "ui/gfx/vector2d_f.h" |
16 | 16 |
17 namespace cc { | 17 namespace cc { |
18 namespace { | 18 namespace { |
19 | 19 |
20 static const float kTopControlsHeight = 100; | 20 static const float kTopControlsHeight = 100; |
21 static const float kTopControlsShowThreshold = 0.5f; | |
22 static const float kTopControlsHideThreshold = 0.5f; | |
21 | 23 |
22 class MockTopControlsManagerClient : public TopControlsManagerClient { | 24 class MockTopControlsManagerClient : public TopControlsManagerClient { |
23 public: | 25 public: |
24 MockTopControlsManagerClient() | 26 MockTopControlsManagerClient() |
25 : host_impl_(&proxy_), | 27 : host_impl_(&proxy_), |
26 redraw_needed_(false), | 28 redraw_needed_(false), |
27 update_draw_properties_needed_(false) { | 29 update_draw_properties_needed_(false) { |
28 active_tree_ = LayerTreeImpl::create(&host_impl_); | 30 active_tree_ = LayerTreeImpl::create(&host_impl_); |
29 root_scroll_layer_ = LayerImpl::create(active_tree_.get(), 1); | 31 root_scroll_layer_ = LayerImpl::create(active_tree_.get(), 1); |
30 } | 32 } |
(...skipping 15 matching lines...) Expand all Loading... | |
46 virtual float rootScrollLayerTotalScrollY() const OVERRIDE { | 48 virtual float rootScrollLayerTotalScrollY() const OVERRIDE { |
47 return root_scroll_layer_->scrollOffset().y() + | 49 return root_scroll_layer_->scrollOffset().y() + |
48 root_scroll_layer_->scrollDelta().y(); | 50 root_scroll_layer_->scrollDelta().y(); |
49 } | 51 } |
50 | 52 |
51 LayerImpl* rootScrollLayer() { | 53 LayerImpl* rootScrollLayer() { |
52 return root_scroll_layer_.get(); | 54 return root_scroll_layer_.get(); |
53 } | 55 } |
54 | 56 |
55 TopControlsManager* manager() { | 57 TopControlsManager* manager() { |
56 if (!manager_) | 58 if (!manager_) |
Ted C
2013/02/07 00:40:26
need to use braces if the statement is more than o
David Trainor- moved to gerrit
2013/02/11 19:38:28
Done.
| |
57 manager_ = TopControlsManager::Create(this, kTopControlsHeight); | 59 manager_ = TopControlsManager::Create(this, |
60 kTopControlsHeight, | |
61 kTopControlsShowThreshold, | |
62 kTopControlsHideThreshold); | |
58 return manager_.get(); | 63 return manager_.get(); |
59 } | 64 } |
60 | 65 |
61 private: | 66 private: |
62 FakeImplProxy proxy_; | 67 FakeImplProxy proxy_; |
63 FakeLayerTreeHostImpl host_impl_; | 68 FakeLayerTreeHostImpl host_impl_; |
64 scoped_ptr<LayerTreeImpl> active_tree_; | 69 scoped_ptr<LayerTreeImpl> active_tree_; |
65 scoped_ptr<LayerImpl> root_scroll_layer_; | 70 scoped_ptr<LayerImpl> root_scroll_layer_; |
66 scoped_ptr<TopControlsManager> manager_; | 71 scoped_ptr<TopControlsManager> manager_; |
67 bool redraw_needed_; | 72 bool redraw_needed_; |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
250 previous_offset = manager->controls_top_offset(); | 255 previous_offset = manager->controls_top_offset(); |
251 } | 256 } |
252 EXPECT_FALSE(manager->animation()); | 257 EXPECT_FALSE(manager->animation()); |
253 EXPECT_EQ(0.f, manager->controls_top_offset()); | 258 EXPECT_EQ(0.f, manager->controls_top_offset()); |
254 EXPECT_EQ(0.f, manager->content_top_offset()); | 259 EXPECT_EQ(0.f, manager->content_top_offset()); |
255 EXPECT_TRUE(manager->is_overlay_mode()); | 260 EXPECT_TRUE(manager->is_overlay_mode()); |
256 } | 261 } |
257 | 262 |
258 } // namespace | 263 } // namespace |
259 } // namespace cc | 264 } // namespace cc |
OLD | NEW |