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

Side by Side Diff: cc/input/top_controls_manager_unittest.cc

Issue 1028333002: Chromium -> Mojo roll. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 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
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/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 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.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_proxy.h" 15 #include "cc/test/fake_impl_proxy.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/trees/layer_tree_impl.h" 19 #include "cc/trees/layer_tree_impl.h"
19 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
20 #include "ui/gfx/frame_time.h" 21 #include "ui/gfx/frame_time.h"
21 #include "ui/gfx/geometry/vector2d_f.h" 22 #include "ui/gfx/geometry/vector2d_f.h"
22 23
23 namespace cc { 24 namespace cc {
24 namespace { 25 namespace {
25 26
26 class MockTopControlsManagerClient : public TopControlsManagerClient { 27 class MockTopControlsManagerClient : public TopControlsManagerClient {
27 public: 28 public:
28 MockTopControlsManagerClient(float top_controls_height, 29 MockTopControlsManagerClient(float top_controls_height,
29 float top_controls_show_threshold, 30 float top_controls_show_threshold,
30 float top_controls_hide_threshold) 31 float top_controls_hide_threshold)
31 : host_impl_(&proxy_, &shared_bitmap_manager_), 32 : host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_),
32 redraw_needed_(false), 33 redraw_needed_(false),
33 update_draw_properties_needed_(false), 34 update_draw_properties_needed_(false),
34 top_controls_shown_ratio_(1.f), 35 top_controls_shown_ratio_(1.f),
35 top_controls_height_(top_controls_height), 36 top_controls_height_(top_controls_height),
36 top_controls_show_threshold_(top_controls_show_threshold), 37 top_controls_show_threshold_(top_controls_show_threshold),
37 top_controls_hide_threshold_(top_controls_hide_threshold) { 38 top_controls_hide_threshold_(top_controls_hide_threshold) {
38 active_tree_ = LayerTreeImpl::create( 39 active_tree_ = LayerTreeImpl::create(
39 &host_impl_, new SyncedProperty<ScaleGroup>, new SyncedTopControls, 40 &host_impl_, new SyncedProperty<ScaleGroup>, new SyncedTopControls,
40 new SyncedElasticOverscroll); 41 new SyncedElasticOverscroll);
41 root_scroll_layer_ = LayerImpl::Create(active_tree_.get(), 1); 42 root_scroll_layer_ = LayerImpl::Create(active_tree_.get(), 1);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 top_controls_hide_threshold_); 77 top_controls_hide_threshold_);
77 } 78 }
78 return manager_.get(); 79 return manager_.get();
79 } 80 }
80 81
81 void SetTopControlsHeight(float height) { top_controls_height_ = height; } 82 void SetTopControlsHeight(float height) { top_controls_height_ = height; }
82 83
83 private: 84 private:
84 FakeImplProxy proxy_; 85 FakeImplProxy proxy_;
85 TestSharedBitmapManager shared_bitmap_manager_; 86 TestSharedBitmapManager shared_bitmap_manager_;
87 TestTaskGraphRunner task_graph_runner_;
86 FakeLayerTreeHostImpl host_impl_; 88 FakeLayerTreeHostImpl host_impl_;
87 scoped_ptr<LayerTreeImpl> active_tree_; 89 scoped_ptr<LayerTreeImpl> active_tree_;
88 scoped_ptr<LayerImpl> root_scroll_layer_; 90 scoped_ptr<LayerImpl> root_scroll_layer_;
89 scoped_ptr<TopControlsManager> manager_; 91 scoped_ptr<TopControlsManager> manager_;
90 bool redraw_needed_; 92 bool redraw_needed_;
91 bool update_draw_properties_needed_; 93 bool update_draw_properties_needed_;
92 94
93 float top_controls_shown_ratio_; 95 float top_controls_shown_ratio_;
94 float top_controls_height_; 96 float top_controls_height_;
95 float top_controls_show_threshold_; 97 float top_controls_show_threshold_;
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 EXPECT_FLOAT_EQ(20.f, pending.y()); 463 EXPECT_FLOAT_EQ(20.f, pending.y());
462 EXPECT_FLOAT_EQ(0.f, manager->ControlsTopOffset()); 464 EXPECT_FLOAT_EQ(0.f, manager->ControlsTopOffset());
463 EXPECT_FLOAT_EQ(0.f, manager->ContentTopOffset()); 465 EXPECT_FLOAT_EQ(0.f, manager->ContentTopOffset());
464 EXPECT_FLOAT_EQ(1.f, client.CurrentTopControlsShownRatio()); 466 EXPECT_FLOAT_EQ(1.f, client.CurrentTopControlsShownRatio());
465 manager->ScrollEnd(); 467 manager->ScrollEnd();
466 } 468 }
467 469
468 470
469 } // namespace 471 } // namespace
470 } // namespace cc 472 } // namespace cc
OLDNEW
« no previous file with comments | « cc/debug/rasterize_and_record_benchmark.cc ('k') | cc/layers/delegated_renderer_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698