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/input/top_controls_manager.h" | 5 #include "cc/input/top_controls_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
| 9 #include <memory> |
9 | 10 |
10 #include "base/logging.h" | 11 #include "base/logging.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "cc/input/top_controls_manager_client.h" | 13 #include "cc/input/top_controls_manager_client.h" |
14 #include "cc/layers/layer_impl.h" | 14 #include "cc/layers/layer_impl.h" |
15 #include "cc/test/fake_impl_task_runner_provider.h" | 15 #include "cc/test/fake_impl_task_runner_provider.h" |
16 #include "cc/test/fake_layer_tree_host_impl.h" | 16 #include "cc/test/fake_layer_tree_host_impl.h" |
17 #include "cc/test/test_shared_bitmap_manager.h" | 17 #include "cc/test/test_shared_bitmap_manager.h" |
18 #include "cc/test/test_task_graph_runner.h" | 18 #include "cc/test/test_task_graph_runner.h" |
19 #include "cc/trees/layer_tree_impl.h" | 19 #include "cc/trees/layer_tree_impl.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
21 #include "ui/gfx/geometry/vector2d_f.h" | 21 #include "ui/gfx/geometry/vector2d_f.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 return manager_.get(); | 80 return manager_.get(); |
81 } | 81 } |
82 | 82 |
83 void SetTopControlsHeight(float height) { top_controls_height_ = height; } | 83 void SetTopControlsHeight(float height) { top_controls_height_ = height; } |
84 | 84 |
85 private: | 85 private: |
86 FakeImplTaskRunnerProvider task_runner_provider_; | 86 FakeImplTaskRunnerProvider task_runner_provider_; |
87 TestSharedBitmapManager shared_bitmap_manager_; | 87 TestSharedBitmapManager shared_bitmap_manager_; |
88 TestTaskGraphRunner task_graph_runner_; | 88 TestTaskGraphRunner task_graph_runner_; |
89 FakeLayerTreeHostImpl host_impl_; | 89 FakeLayerTreeHostImpl host_impl_; |
90 scoped_ptr<LayerTreeImpl> active_tree_; | 90 std::unique_ptr<LayerTreeImpl> active_tree_; |
91 scoped_ptr<LayerImpl> root_scroll_layer_; | 91 std::unique_ptr<LayerImpl> root_scroll_layer_; |
92 scoped_ptr<TopControlsManager> manager_; | 92 std::unique_ptr<TopControlsManager> manager_; |
93 bool redraw_needed_; | 93 bool redraw_needed_; |
94 bool update_draw_properties_needed_; | 94 bool update_draw_properties_needed_; |
95 | 95 |
96 float top_controls_shown_ratio_; | 96 float top_controls_shown_ratio_; |
97 float top_controls_height_; | 97 float top_controls_height_; |
98 float top_controls_show_threshold_; | 98 float top_controls_show_threshold_; |
99 float top_controls_hide_threshold_; | 99 float top_controls_hide_threshold_; |
100 }; | 100 }; |
101 | 101 |
102 TEST(TopControlsManagerTest, EnsureScrollThresholdApplied) { | 102 TEST(TopControlsManagerTest, EnsureScrollThresholdApplied) { |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 EXPECT_FLOAT_EQ(20.f, pending.y()); | 464 EXPECT_FLOAT_EQ(20.f, pending.y()); |
465 EXPECT_FLOAT_EQ(0.f, manager->ControlsTopOffset()); | 465 EXPECT_FLOAT_EQ(0.f, manager->ControlsTopOffset()); |
466 EXPECT_FLOAT_EQ(0.f, manager->ContentTopOffset()); | 466 EXPECT_FLOAT_EQ(0.f, manager->ContentTopOffset()); |
467 EXPECT_FLOAT_EQ(1.f, client.CurrentTopControlsShownRatio()); | 467 EXPECT_FLOAT_EQ(1.f, client.CurrentTopControlsShownRatio()); |
468 manager->ScrollEnd(); | 468 manager->ScrollEnd(); |
469 } | 469 } |
470 | 470 |
471 | 471 |
472 } // namespace | 472 } // namespace |
473 } // namespace cc | 473 } // namespace cc |
OLD | NEW |