| 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 // it didn't scroll at all. | 131 // it didn't scroll at all. |
| 132 bool DoTouchScroll(const gfx::Point& point, const gfx::Vector2d& distance) { | 132 bool DoTouchScroll(const gfx::Point& point, const gfx::Vector2d& distance) { |
| 133 EXPECT_EQ(0, GetScrollTop()); | 133 EXPECT_EQ(0, GetScrollTop()); |
| 134 | 134 |
| 135 int scrollHeight = ExecuteScriptAndExtractInt( | 135 int scrollHeight = ExecuteScriptAndExtractInt( |
| 136 "document.documentElement.scrollHeight"); | 136 "document.documentElement.scrollHeight"); |
| 137 EXPECT_EQ(1200, scrollHeight); | 137 EXPECT_EQ(1200, scrollHeight); |
| 138 | 138 |
| 139 SyntheticSmoothScrollGestureParams params; | 139 SyntheticSmoothScrollGestureParams params; |
| 140 params.gesture_source_type = SyntheticGestureParams::TOUCH_INPUT; | 140 params.gesture_source_type = SyntheticGestureParams::TOUCH_INPUT; |
| 141 params.anchor = point; | 141 params.anchor = gfx::PointF(point); |
| 142 params.distances.push_back(-distance); | 142 params.distances.push_back(-distance); |
| 143 | 143 |
| 144 runner_ = new MessageLoopRunner(); | 144 runner_ = new MessageLoopRunner(); |
| 145 | 145 |
| 146 scoped_ptr<SyntheticSmoothScrollGesture> gesture( | 146 scoped_ptr<SyntheticSmoothScrollGesture> gesture( |
| 147 new SyntheticSmoothScrollGesture(params)); | 147 new SyntheticSmoothScrollGesture(params)); |
| 148 GetWidgetHost()->QueueSyntheticGesture( | 148 GetWidgetHost()->QueueSyntheticGesture( |
| 149 gesture.Pass(), | 149 gesture.Pass(), |
| 150 base::Bind(&TouchActionBrowserTest::OnSyntheticGestureCompleted, | 150 base::Bind(&TouchActionBrowserTest::OnSyntheticGestureCompleted, |
| 151 base::Unretained(this))); | 151 base::Unretained(this))); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 bool scrolled = DoTouchScroll(gfx::Point(50, 150), gfx::Vector2d(0, 45)); | 208 bool scrolled = DoTouchScroll(gfx::Point(50, 150), gfx::Vector2d(0, 45)); |
| 209 EXPECT_FALSE(scrolled); | 209 EXPECT_FALSE(scrolled); |
| 210 | 210 |
| 211 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchstart")); | 211 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchstart")); |
| 212 EXPECT_GE(ExecuteScriptAndExtractInt("eventCounts.touchmove"), 1); | 212 EXPECT_GE(ExecuteScriptAndExtractInt("eventCounts.touchmove"), 1); |
| 213 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchend")); | 213 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchend")); |
| 214 EXPECT_EQ(0, ExecuteScriptAndExtractInt("eventCounts.touchcancel")); | 214 EXPECT_EQ(0, ExecuteScriptAndExtractInt("eventCounts.touchcancel")); |
| 215 } | 215 } |
| 216 | 216 |
| 217 } // namespace content | 217 } // namespace content |
| OLD | NEW |