Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Side by Side Diff: content/browser/renderer_host/input/touch_action_browsertest.cc

Issue 2052633002: Extend the ToRenderFrameHost magic to FrameTreeNode* and Shell* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix induced script bug. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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> 5 #include <utility>
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 cmd->AppendSwitchASCII(switches::kTouchEvents, 113 cmd->AppendSwitchASCII(switches::kTouchEvents,
114 switches::kTouchEventsEnabled); 114 switches::kTouchEventsEnabled);
115 // TODO(rbyers): Remove this switch once touch-action ships. 115 // TODO(rbyers): Remove this switch once touch-action ships.
116 // http://crbug.com/241964 116 // http://crbug.com/241964
117 cmd->AppendSwitch(switches::kEnableExperimentalWebPlatformFeatures); 117 cmd->AppendSwitch(switches::kEnableExperimentalWebPlatformFeatures);
118 } 118 }
119 119
120 int ExecuteScriptAndExtractInt(const std::string& script) { 120 int ExecuteScriptAndExtractInt(const std::string& script) {
121 int value = 0; 121 int value = 0;
122 EXPECT_TRUE(content::ExecuteScriptAndExtractInt( 122 EXPECT_TRUE(content::ExecuteScriptAndExtractInt(
123 shell()->web_contents(), 123 shell(), "domAutomationController.send(" + script + ")", &value));
124 "domAutomationController.send(" + script + ")",
125 &value));
126 return value; 124 return value;
127 } 125 }
128 126
129 int GetScrollTop() { 127 int GetScrollTop() {
130 return ExecuteScriptAndExtractInt("document.scrollingElement.scrollTop"); 128 return ExecuteScriptAndExtractInt("document.scrollingElement.scrollTop");
131 } 129 }
132 130
133 // Generate touch events for a synthetic scroll from |point| for |distance|. 131 // Generate touch events for a synthetic scroll from |point| for |distance|.
134 // Returns true if the page scrolled by the desired amount, and false if 132 // Returns true if the page scrolled by the desired amount, and false if
135 // it didn't scroll at all. 133 // it didn't scroll at all.
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 bool scrolled = DoTouchScroll(gfx::Point(50, 150), gfx::Vector2d(0, 45)); 205 bool scrolled = DoTouchScroll(gfx::Point(50, 150), gfx::Vector2d(0, 45));
208 EXPECT_FALSE(scrolled); 206 EXPECT_FALSE(scrolled);
209 207
210 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchstart")); 208 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchstart"));
211 EXPECT_GE(ExecuteScriptAndExtractInt("eventCounts.touchmove"), 1); 209 EXPECT_GE(ExecuteScriptAndExtractInt("eventCounts.touchmove"), 1);
212 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchend")); 210 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchend"));
213 EXPECT_EQ(0, ExecuteScriptAndExtractInt("eventCounts.touchcancel")); 211 EXPECT_EQ(0, ExecuteScriptAndExtractInt("eventCounts.touchcancel"));
214 } 212 }
215 213
216 } // namespace content 214 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698