OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <utility> |
| 6 |
5 #include "base/bind.h" | 7 #include "base/bind.h" |
6 #include "base/command_line.h" | 8 #include "base/command_line.h" |
7 #include "base/macros.h" | 9 #include "base/macros.h" |
8 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
9 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
10 #include "build/build_config.h" | 12 #include "build/build_config.h" |
11 #include "cc/base/math_util.h" | 13 #include "cc/base/math_util.h" |
12 #include "content/browser/renderer_host/input/synthetic_gesture.h" | 14 #include "content/browser/renderer_host/input/synthetic_gesture.h" |
13 #include "content/browser/renderer_host/input/synthetic_smooth_scroll_gesture.h" | 15 #include "content/browser/renderer_host/input/synthetic_smooth_scroll_gesture.h" |
14 #include "content/browser/renderer_host/render_widget_host_impl.h" | 16 #include "content/browser/renderer_host/render_widget_host_impl.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 SyntheticSmoothScrollGestureParams params; | 125 SyntheticSmoothScrollGestureParams params; |
124 params.gesture_source_type = SyntheticGestureParams::TOUCH_INPUT; | 126 params.gesture_source_type = SyntheticGestureParams::TOUCH_INPUT; |
125 params.anchor = gfx::PointF(point); | 127 params.anchor = gfx::PointF(point); |
126 params.distances.push_back(-distance); | 128 params.distances.push_back(-distance); |
127 | 129 |
128 runner_ = new MessageLoopRunner(); | 130 runner_ = new MessageLoopRunner(); |
129 | 131 |
130 scoped_ptr<SyntheticSmoothScrollGesture> gesture( | 132 scoped_ptr<SyntheticSmoothScrollGesture> gesture( |
131 new SyntheticSmoothScrollGesture(params)); | 133 new SyntheticSmoothScrollGesture(params)); |
132 GetWidgetHost()->QueueSyntheticGesture( | 134 GetWidgetHost()->QueueSyntheticGesture( |
133 gesture.Pass(), | 135 std::move(gesture), |
134 base::Bind(&CompositedScrollingBrowserTest::OnSyntheticGestureCompleted, | 136 base::Bind(&CompositedScrollingBrowserTest::OnSyntheticGestureCompleted, |
135 base::Unretained(this))); | 137 base::Unretained(this))); |
136 | 138 |
137 // Runs until we get the OnSyntheticGestureCompleted callback | 139 // Runs until we get the OnSyntheticGestureCompleted callback |
138 runner_->Run(); | 140 runner_->Run(); |
139 runner_ = NULL; | 141 runner_ = NULL; |
140 | 142 |
141 return GetScrollTop(); | 143 return GetScrollTop(); |
142 } | 144 } |
143 | 145 |
(...skipping 16 matching lines...) Expand all Loading... |
160 MAYBE_Scroll3DTransformedScroller) { | 162 MAYBE_Scroll3DTransformedScroller) { |
161 LoadURL(); | 163 LoadURL(); |
162 int scrollDistance = | 164 int scrollDistance = |
163 DoTouchScroll(gfx::Point(50, 150), gfx::Vector2d(0, 100)); | 165 DoTouchScroll(gfx::Point(50, 150), gfx::Vector2d(0, 100)); |
164 // The scroll distance is increased due to the rotation of the scroller. | 166 // The scroll distance is increased due to the rotation of the scroller. |
165 EXPECT_EQ(std::floor(100 / std::cos(cc::MathUtil::Deg2Rad(30.f))) - 1, | 167 EXPECT_EQ(std::floor(100 / std::cos(cc::MathUtil::Deg2Rad(30.f))) - 1, |
166 scrollDistance); | 168 scrollDistance); |
167 } | 169 } |
168 | 170 |
169 } // namespace content | 171 } // namespace content |
OLD | NEW |