OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/auto_reset.h" | 7 #include "base/auto_reset.h" |
6 #include "base/bind.h" | 8 #include "base/bind.h" |
7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
10 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
11 #include "build/build_config.h" | 13 #include "build/build_config.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_gesture_controller.h" | 15 #include "content/browser/renderer_host/input/synthetic_gesture_controller.h" |
14 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" | 16 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 SyntheticSmoothScrollGestureParams params; | 143 SyntheticSmoothScrollGestureParams params; |
142 params.gesture_source_type = SyntheticGestureParams::TOUCH_INPUT; | 144 params.gesture_source_type = SyntheticGestureParams::TOUCH_INPUT; |
143 params.anchor = gfx::PointF(point); | 145 params.anchor = gfx::PointF(point); |
144 params.distances.push_back(-distance); | 146 params.distances.push_back(-distance); |
145 | 147 |
146 runner_ = new MessageLoopRunner(); | 148 runner_ = new MessageLoopRunner(); |
147 | 149 |
148 scoped_ptr<SyntheticSmoothScrollGesture> gesture( | 150 scoped_ptr<SyntheticSmoothScrollGesture> gesture( |
149 new SyntheticSmoothScrollGesture(params)); | 151 new SyntheticSmoothScrollGesture(params)); |
150 GetWidgetHost()->QueueSyntheticGesture( | 152 GetWidgetHost()->QueueSyntheticGesture( |
151 gesture.Pass(), | 153 std::move(gesture), |
152 base::Bind(&TouchActionBrowserTest::OnSyntheticGestureCompleted, | 154 base::Bind(&TouchActionBrowserTest::OnSyntheticGestureCompleted, |
153 base::Unretained(this))); | 155 base::Unretained(this))); |
154 | 156 |
155 // Runs until we get the OnSyntheticGestureCompleted callback | 157 // Runs until we get the OnSyntheticGestureCompleted callback |
156 runner_->Run(); | 158 runner_->Run(); |
157 runner_ = NULL; | 159 runner_ = NULL; |
158 | 160 |
159 // Check the scroll offset | 161 // Check the scroll offset |
160 int scrollTop = GetScrollTop(); | 162 int scrollTop = GetScrollTop(); |
161 if (scrollTop == 0) | 163 if (scrollTop == 0) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 bool scrolled = DoTouchScroll(gfx::Point(50, 150), gfx::Vector2d(0, 45)); | 207 bool scrolled = DoTouchScroll(gfx::Point(50, 150), gfx::Vector2d(0, 45)); |
206 EXPECT_FALSE(scrolled); | 208 EXPECT_FALSE(scrolled); |
207 | 209 |
208 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchstart")); | 210 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchstart")); |
209 EXPECT_GE(ExecuteScriptAndExtractInt("eventCounts.touchmove"), 1); | 211 EXPECT_GE(ExecuteScriptAndExtractInt("eventCounts.touchmove"), 1); |
210 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchend")); | 212 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchend")); |
211 EXPECT_EQ(0, ExecuteScriptAndExtractInt("eventCounts.touchcancel")); | 213 EXPECT_EQ(0, ExecuteScriptAndExtractInt("eventCounts.touchcancel")); |
212 } | 214 } |
213 | 215 |
214 } // namespace content | 216 } // namespace content |
OLD | NEW |