| OLD | NEW |
| 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" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "content/browser/web_contents/web_contents_impl.h" | 12 #include "content/browser/web_contents/web_contents_impl.h" |
| 13 #include "content/browser/web_contents/web_contents_view_aura.h" | 13 #include "content/browser/web_contents/web_contents_view_aura.h" |
| 14 #include "content/common/input/web_input_event_traits.h" | |
| 15 #include "content/public/browser/render_frame_host.h" | 14 #include "content/public/browser/render_frame_host.h" |
| 16 #include "content/public/browser/web_contents_view.h" | 15 #include "content/public/browser/web_contents_view.h" |
| 17 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
| 18 #include "content/public/test/browser_test_utils.h" | 17 #include "content/public/test/browser_test_utils.h" |
| 19 #include "content/public/test/content_browser_test.h" | 18 #include "content/public/test/content_browser_test.h" |
| 20 #include "content/public/test/content_browser_test_utils.h" | 19 #include "content/public/test/content_browser_test_utils.h" |
| 21 #include "content/public/test/test_utils.h" | 20 #include "content/public/test/test_utils.h" |
| 22 #include "content/shell/browser/shell.h" | 21 #include "content/shell/browser/shell.h" |
| 23 #include "ui/aura/test/event_generator.h" | 22 #include "ui/aura/test/event_generator.h" |
| 24 #include "ui/aura/window.h" | 23 #include "ui/aura/window.h" |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 aura::test::EventGenerator generator(content->GetRootWindow(), content); | 317 aura::test::EventGenerator generator(content->GetRootWindow(), content); |
| 319 gfx::Rect bounds = content->GetBoundsInRootWindow(); | 318 gfx::Rect bounds = content->GetBoundsInRootWindow(); |
| 320 EXPECT_EQ(touch_editable->rwhva_, rwhva); | 319 EXPECT_EQ(touch_editable->rwhva_, rwhva); |
| 321 | 320 |
| 322 ExecuteSyncJSFunction(main_frame, "focus_textfield()"); | 321 ExecuteSyncJSFunction(main_frame, "focus_textfield()"); |
| 323 touch_editable->WaitForSelectionChangeCallback(); | 322 touch_editable->WaitForSelectionChangeCallback(); |
| 324 | 323 |
| 325 // Tap textfield | 324 // Tap textfield |
| 326 touch_editable->Reset(); | 325 touch_editable->Reset(); |
| 327 generator.GestureTapAt(gfx::Point(bounds.x() + 50, bounds.y() + 40)); | 326 generator.GestureTapAt(gfx::Point(bounds.x() + 50, bounds.y() + 40)); |
| 328 // Only wait for the tap gesture ack if it's received asynchronously. | 327 // Tap Down and Tap acks are sent synchronously. |
| 329 if (WebInputEventTraits::IgnoresAckDisposition( | 328 touch_editable->WaitForSelectionChangeCallback(); |
| 330 blink::WebInputEvent::GestureTap)) { | 329 touch_editable->Reset(); |
| 331 touch_editable->WaitForSelectionChangeCallback(); | |
| 332 touch_editable->Reset(); | |
| 333 } else { | |
| 334 touch_editable->Reset(); | |
| 335 touch_editable->WaitForGestureAck(); | |
| 336 touch_editable->WaitForSelectionChangeCallback(); | |
| 337 } | |
| 338 | 330 |
| 339 // Check if cursor handle is showing. | 331 // Check if cursor handle is showing. |
| 340 ui::TouchSelectionController* controller = | 332 ui::TouchSelectionController* controller = |
| 341 touch_editable->touch_selection_controller_.get(); | 333 touch_editable->touch_selection_controller_.get(); |
| 342 EXPECT_NE(ui::TEXT_INPUT_TYPE_NONE, touch_editable->text_input_type_); | 334 EXPECT_NE(ui::TEXT_INPUT_TYPE_NONE, touch_editable->text_input_type_); |
| 343 EXPECT_TRUE(controller); | 335 EXPECT_TRUE(controller); |
| 344 | 336 |
| 345 scoped_ptr<base::Value> value = | 337 scoped_ptr<base::Value> value = |
| 346 content::ExecuteScriptAndGetValue(main_frame, "get_cursor_position()"); | 338 content::ExecuteScriptAndGetValue(main_frame, "get_cursor_position()"); |
| 347 int cursor_pos = -1; | 339 int cursor_pos = -1; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 TouchSelectionOnLongPressTest) { | 375 TouchSelectionOnLongPressTest) { |
| 384 TestTouchSelectionOnLongPress(); | 376 TestTouchSelectionOnLongPress(); |
| 385 } | 377 } |
| 386 | 378 |
| 387 IN_PROC_BROWSER_TEST_F(TouchEditableImplAuraTest, | 379 IN_PROC_BROWSER_TEST_F(TouchEditableImplAuraTest, |
| 388 TouchCursorInTextfieldTest) { | 380 TouchCursorInTextfieldTest) { |
| 389 TestTouchCursorInTextfield(); | 381 TestTouchCursorInTextfield(); |
| 390 } | 382 } |
| 391 | 383 |
| 392 } // namespace content | 384 } // namespace content |
| OLD | NEW |