| 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 "base/auto_reset.h" | 5 #include "base/auto_reset.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "content/browser/renderer_host/input/synthetic_gesture.h" | 10 #include "content/browser/renderer_host/input/synthetic_gesture.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 SyntheticSmoothScrollGestureParams params; | 131 SyntheticSmoothScrollGestureParams params; |
| 132 params.gesture_source_type = SyntheticGestureParams::TOUCH_INPUT; | 132 params.gesture_source_type = SyntheticGestureParams::TOUCH_INPUT; |
| 133 params.anchor = point; | 133 params.anchor = point; |
| 134 params.distances.push_back(-distance); | 134 params.distances.push_back(-distance); |
| 135 | 135 |
| 136 runner_ = new MessageLoopRunner(); | 136 runner_ = new MessageLoopRunner(); |
| 137 | 137 |
| 138 scoped_ptr<SyntheticSmoothScrollGesture> gesture( | 138 scoped_ptr<SyntheticSmoothScrollGesture> gesture( |
| 139 new SyntheticSmoothScrollGesture(params)); | 139 new SyntheticSmoothScrollGesture(params)); |
| 140 GetWidgetHost()->QueueSyntheticGesture( | 140 GetWidgetHost()->QueueSyntheticGesture( |
| 141 gesture.PassAs<SyntheticGesture>(), | 141 gesture.Pass(), |
| 142 base::Bind(&TouchActionBrowserTest::OnSyntheticGestureCompleted, | 142 base::Bind(&TouchActionBrowserTest::OnSyntheticGestureCompleted, |
| 143 base::Unretained(this))); | 143 base::Unretained(this))); |
| 144 | 144 |
| 145 // Runs until we get the OnSyntheticGestureCompleted callback | 145 // Runs until we get the OnSyntheticGestureCompleted callback |
| 146 runner_->Run(); | 146 runner_->Run(); |
| 147 runner_ = NULL; | 147 runner_ = NULL; |
| 148 | 148 |
| 149 // Check the scroll offset | 149 // Check the scroll offset |
| 150 int scrollTop = GetScrollTop(); | 150 int scrollTop = GetScrollTop(); |
| 151 if (scrollTop == 0) | 151 if (scrollTop == 0) |
| 152 return false; | 152 return false; |
| 153 | 153 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 bool scrolled = DoTouchScroll(gfx::Point(50, 150), gfx::Vector2d(0, 45)); | 199 bool scrolled = DoTouchScroll(gfx::Point(50, 150), gfx::Vector2d(0, 45)); |
| 200 EXPECT_FALSE(scrolled); | 200 EXPECT_FALSE(scrolled); |
| 201 | 201 |
| 202 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchstart")); | 202 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchstart")); |
| 203 EXPECT_GT(ExecuteScriptAndExtractInt("eventCounts.touchmove"), 1); | 203 EXPECT_GT(ExecuteScriptAndExtractInt("eventCounts.touchmove"), 1); |
| 204 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchend")); | 204 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchend")); |
| 205 EXPECT_EQ(0, ExecuteScriptAndExtractInt("eventCounts.touchcancel")); | 205 EXPECT_EQ(0, ExecuteScriptAndExtractInt("eventCounts.touchcancel")); |
| 206 } | 206 } |
| 207 | 207 |
| 208 } // namespace content | 208 } // namespace content |
| OLD | NEW |