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

Side by Side Diff: trunk/src/content/browser/web_contents/touch_editable_impl_aura_browsertest.cc

Issue 304253007: Revert 273770 "Enable touch text selection tests on all Aura pla..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/web_contents/touch_editable_impl_aura.h" 5 #include "content/browser/web_contents/touch_editable_impl_aura.h"
6 6
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 "base/test/test_timeouts.h" 10 #include "base/test/test_timeouts.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 generator.GestureTapAt(gfx::Point(bounds.x() + 10, bounds.y() + 10)); 160 generator.GestureTapAt(gfx::Point(bounds.x() + 10, bounds.y() + 10));
161 EXPECT_EQ(GetRenderWidgetHostViewAura(touch_editable), rwhva); 161 EXPECT_EQ(GetRenderWidgetHostViewAura(touch_editable), rwhva);
162 162
163 scoped_ptr<base::Value> value = 163 scoped_ptr<base::Value> value =
164 content::ExecuteScriptAndGetValue(main_frame, "get_selection()"); 164 content::ExecuteScriptAndGetValue(main_frame, "get_selection()");
165 std::string selection; 165 std::string selection;
166 value->GetAsString(&selection); 166 value->GetAsString(&selection);
167 167
168 // Check if selection handles are showing. 168 // Check if selection handles are showing.
169 EXPECT_TRUE(GetTouchSelectionController(touch_editable)); 169 EXPECT_TRUE(GetTouchSelectionController(touch_editable));
170 EXPECT_EQ("Some text we can select", selection); 170 EXPECT_STREQ("Some text we can select", selection.c_str());
171 171
172 // Lets move the handles a bit to modify the selection 172 // Lets move the handles a bit to modify the selection
173 touch_editable->Reset(); 173 touch_editable->Reset();
174 generator.GestureScrollSequence( 174 generator.GestureScrollSequence(
175 gfx::Point(bounds.x() + 10, bounds.y() + 47), 175 gfx::Point(10, 47),
176 gfx::Point(bounds.x() + 30, bounds.y() + 47), 176 gfx::Point(30, 47),
177 base::TimeDelta::FromMilliseconds(20), 177 base::TimeDelta::FromMilliseconds(20),
178 5); 178 5);
179 touch_editable->WaitForSelectionChangeCallback(); 179 touch_editable->WaitForSelectionChangeCallback();
180 180
181 EXPECT_TRUE(GetTouchSelectionController(touch_editable)); 181 EXPECT_TRUE(GetTouchSelectionController(touch_editable));
182 value = content::ExecuteScriptAndGetValue(main_frame, "get_selection()"); 182 value = content::ExecuteScriptAndGetValue(main_frame, "get_selection()");
183 value->GetAsString(&selection); 183 value->GetAsString(&selection);
184 184
185 // It is hard to tell what exactly the selection would be now. But it would 185 // It is hard to tell what exactly the selection would be now. But it would
186 // definitely be less than whatever was selected before. 186 // definitely be less than whatever was selected before.
(...skipping 27 matching lines...) Expand all
214 rwhva->OnGestureEvent(&long_press); 214 rwhva->OnGestureEvent(&long_press);
215 touch_editable->WaitForSelectionChangeCallback(); 215 touch_editable->WaitForSelectionChangeCallback();
216 216
217 // Check if selection handles are showing. 217 // Check if selection handles are showing.
218 EXPECT_TRUE(GetTouchSelectionController(touch_editable)); 218 EXPECT_TRUE(GetTouchSelectionController(touch_editable));
219 219
220 scoped_ptr<base::Value> value = 220 scoped_ptr<base::Value> value =
221 content::ExecuteScriptAndGetValue(main_frame, "get_selection()"); 221 content::ExecuteScriptAndGetValue(main_frame, "get_selection()");
222 std::string selection; 222 std::string selection;
223 value->GetAsString(&selection); 223 value->GetAsString(&selection);
224 EXPECT_EQ("Some", selection); 224 EXPECT_STREQ("Some", selection.c_str());
225 225
226 // Start scrolling. Handles should get hidden. 226 // Start scrolling. Handles should get hidden.
227 ui::GestureEvent scroll_begin(ui::ET_GESTURE_SCROLL_BEGIN, 227 ui::GestureEvent scroll_begin(ui::ET_GESTURE_SCROLL_BEGIN,
228 10, 228 10,
229 10, 229 10,
230 0, 230 0,
231 ui::EventTimeForNow(), 231 ui::EventTimeForNow(),
232 ui::GestureEventDetails( 232 ui::GestureEventDetails(
233 ui::ET_GESTURE_SCROLL_BEGIN, 0, 0), 233 ui::ET_GESTURE_SCROLL_BEGIN, 0, 0),
234 1); 234 1);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 rwhva->OnGestureEvent(&long_press); 275 rwhva->OnGestureEvent(&long_press);
276 touch_editable->WaitForSelectionChangeCallback(); 276 touch_editable->WaitForSelectionChangeCallback();
277 277
278 // Check if selection handles are showing. 278 // Check if selection handles are showing.
279 EXPECT_TRUE(GetTouchSelectionController(touch_editable)); 279 EXPECT_TRUE(GetTouchSelectionController(touch_editable));
280 280
281 scoped_ptr<base::Value> value = 281 scoped_ptr<base::Value> value =
282 content::ExecuteScriptAndGetValue(main_frame, "get_selection()"); 282 content::ExecuteScriptAndGetValue(main_frame, "get_selection()");
283 std::string selection; 283 std::string selection;
284 value->GetAsString(&selection); 284 value->GetAsString(&selection);
285 EXPECT_EQ("Some", selection); 285 EXPECT_STREQ("Some", selection.c_str());
286 } 286 }
287 287
288 IN_PROC_BROWSER_TEST_F(TouchEditableImplAuraTest, 288 IN_PROC_BROWSER_TEST_F(TouchEditableImplAuraTest,
289 TouchSelectionOnDoubleTapTest) { 289 TouchSelectionOnDoubleTapTest) {
290 ASSERT_NO_FATAL_FAILURE(StartTestWithPage("files/touch_selection.html")); 290 ASSERT_NO_FATAL_FAILURE(StartTestWithPage("files/touch_selection.html"));
291 WebContentsImpl* web_contents = 291 WebContentsImpl* web_contents =
292 static_cast<WebContentsImpl*>(shell()->web_contents()); 292 static_cast<WebContentsImpl*>(shell()->web_contents());
293 RenderFrameHost* main_frame = web_contents->GetMainFrame(); 293 RenderFrameHost* main_frame = web_contents->GetMainFrame();
294 WebContentsViewAura* view_aura = 294 WebContentsViewAura* view_aura =
295 static_cast<WebContentsViewAura*>(web_contents->GetView()); 295 static_cast<WebContentsViewAura*>(web_contents->GetView());
(...skipping 15 matching lines...) Expand all
311 rwhva->OnGestureEvent(&double_tap); 311 rwhva->OnGestureEvent(&double_tap);
312 touch_editable->WaitForSelectionChangeCallback(); 312 touch_editable->WaitForSelectionChangeCallback();
313 313
314 // Check if selection handles are showing. 314 // Check if selection handles are showing.
315 EXPECT_TRUE(GetTouchSelectionController(touch_editable)); 315 EXPECT_TRUE(GetTouchSelectionController(touch_editable));
316 316
317 scoped_ptr<base::Value> value = 317 scoped_ptr<base::Value> value =
318 content::ExecuteScriptAndGetValue(main_frame, "get_selection()"); 318 content::ExecuteScriptAndGetValue(main_frame, "get_selection()");
319 std::string selection; 319 std::string selection;
320 value->GetAsString(&selection); 320 value->GetAsString(&selection);
321 #if defined(OS_WIN) 321 EXPECT_STREQ("Some", selection.c_str());
322 // In Windows, the default behavior is to select the whitespace after the word
323 // when the word is selected.
324 EXPECT_EQ("Some ", selection);
325 #else
326 EXPECT_EQ("Some", selection);
327 #endif // defined (OS_WIN)
328 } 322 }
329 323
330 IN_PROC_BROWSER_TEST_F(TouchEditableImplAuraTest, 324 IN_PROC_BROWSER_TEST_F(TouchEditableImplAuraTest,
331 TouchCursorInTextfieldTest) { 325 TouchCursorInTextfieldTest) {
332 ASSERT_NO_FATAL_FAILURE(StartTestWithPage("files/touch_selection.html")); 326 ASSERT_NO_FATAL_FAILURE(StartTestWithPage("files/touch_selection.html"));
333 WebContentsImpl* web_contents = 327 WebContentsImpl* web_contents =
334 static_cast<WebContentsImpl*>(shell()->web_contents()); 328 static_cast<WebContentsImpl*>(shell()->web_contents());
335 RenderFrameHost* main_frame = web_contents->GetMainFrame(); 329 RenderFrameHost* main_frame = web_contents->GetMainFrame();
336 WebContentsViewAura* view_aura = static_cast<WebContentsViewAura*>( 330 WebContentsViewAura* view_aura = static_cast<WebContentsViewAura*>(
337 web_contents->GetView()); 331 web_contents->GetView());
(...skipping 22 matching lines...) Expand all
360 EXPECT_TRUE(GetTouchSelectionController(touch_editable)); 354 EXPECT_TRUE(GetTouchSelectionController(touch_editable));
361 355
362 scoped_ptr<base::Value> value = 356 scoped_ptr<base::Value> value =
363 content::ExecuteScriptAndGetValue(main_frame, "get_cursor_position()"); 357 content::ExecuteScriptAndGetValue(main_frame, "get_cursor_position()");
364 int cursor_pos = -1; 358 int cursor_pos = -1;
365 value->GetAsInteger(&cursor_pos); 359 value->GetAsInteger(&cursor_pos);
366 EXPECT_NE(-1, cursor_pos); 360 EXPECT_NE(-1, cursor_pos);
367 361
368 // Move the cursor handle. 362 // Move the cursor handle.
369 generator.GestureScrollSequence( 363 generator.GestureScrollSequence(
370 gfx::Point(bounds.x() + 50, bounds.y() + 59), 364 gfx::Point(50, 59),
371 gfx::Point(bounds.x() + 10, bounds.y() + 59), 365 gfx::Point(10, 59),
372 base::TimeDelta::FromMilliseconds(20), 366 base::TimeDelta::FromMilliseconds(20),
373 1); 367 1);
374 touch_editable->WaitForSelectionChangeCallback(); 368 touch_editable->WaitForSelectionChangeCallback();
375 EXPECT_TRUE(GetTouchSelectionController(touch_editable)); 369 EXPECT_TRUE(GetTouchSelectionController(touch_editable));
376 value = content::ExecuteScriptAndGetValue(main_frame, 370 value = content::ExecuteScriptAndGetValue(main_frame,
377 "get_cursor_position()"); 371 "get_cursor_position()");
378 int new_cursor_pos = -1; 372 int new_cursor_pos = -1;
379 value->GetAsInteger(&new_cursor_pos); 373 value->GetAsInteger(&new_cursor_pos);
380 EXPECT_NE(-1, new_cursor_pos); 374 EXPECT_NE(-1, new_cursor_pos);
381 // Cursor should have moved. 375 // Cursor should have moved.
382 EXPECT_NE(new_cursor_pos, cursor_pos); 376 EXPECT_NE(new_cursor_pos, cursor_pos);
383 } 377 }
384 378
385 } // namespace content 379 } // namespace content
OLDNEW
« no previous file with comments | « trunk/src/content/browser/web_contents/touch_editable_impl_aura.cc ('k') | trunk/src/content/content_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698