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> | 5 #include <utility> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // otherwise the injection of the synthetic gestures may get | 95 // otherwise the injection of the synthetic gestures may get |
96 // dropped because of MainThread/Impl thread sync of touch event | 96 // dropped because of MainThread/Impl thread sync of touch event |
97 // regions. | 97 // regions. |
98 frame_watcher->WaitFrames(1); | 98 frame_watcher->WaitFrames(1); |
99 } | 99 } |
100 | 100 |
101 // ContentBrowserTest: | 101 // ContentBrowserTest: |
102 int ExecuteScriptAndExtractInt(const std::string& script) { | 102 int ExecuteScriptAndExtractInt(const std::string& script) { |
103 int value = 0; | 103 int value = 0; |
104 EXPECT_TRUE(content::ExecuteScriptAndExtractInt( | 104 EXPECT_TRUE(content::ExecuteScriptAndExtractInt( |
105 shell()->web_contents(), | 105 shell(), "domAutomationController.send(" + script + ")", &value)); |
106 "domAutomationController.send(" + script + ")", | |
107 &value)); | |
108 return value; | 106 return value; |
109 } | 107 } |
110 | 108 |
111 int GetScrollTop() { | 109 int GetScrollTop() { |
112 return ExecuteScriptAndExtractInt( | 110 return ExecuteScriptAndExtractInt( |
113 "document.getElementById(\"scroller\").scrollTop"); | 111 "document.getElementById(\"scroller\").scrollTop"); |
114 } | 112 } |
115 | 113 |
116 // Generate touch events for a synthetic scroll from |point| for |distance|. | 114 // Generate touch events for a synthetic scroll from |point| for |distance|. |
117 // Returns the distance scrolled. | 115 // Returns the distance scrolled. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 MAYBE_Scroll3DTransformedScroller) { | 160 MAYBE_Scroll3DTransformedScroller) { |
163 LoadURL(); | 161 LoadURL(); |
164 int scrollDistance = | 162 int scrollDistance = |
165 DoTouchScroll(gfx::Point(50, 150), gfx::Vector2d(0, 100)); | 163 DoTouchScroll(gfx::Point(50, 150), gfx::Vector2d(0, 100)); |
166 // The scroll distance is increased due to the rotation of the scroller. | 164 // The scroll distance is increased due to the rotation of the scroller. |
167 EXPECT_EQ(std::floor(100 / std::cos(cc::MathUtil::Deg2Rad(30.f))) - 1, | 165 EXPECT_EQ(std::floor(100 / std::cos(cc::MathUtil::Deg2Rad(30.f))) - 1, |
168 scrollDistance); | 166 scrollDistance); |
169 } | 167 } |
170 | 168 |
171 } // namespace content | 169 } // namespace content |
OLD | NEW |