| 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 "content/browser/renderer_host/input/touch_selection_controller_client_
aura.h" | 5 #include "content/browser/renderer_host/input/touch_selection_controller_client_
aura.h" |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 9 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 10 #include "content/browser/web_contents/web_contents_impl.h" | 10 #include "content/browser/web_contents/web_contents_impl.h" |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 | 348 |
| 349 selection_controller_client->Wait(); | 349 selection_controller_client->Wait(); |
| 350 | 350 |
| 351 EXPECT_EQ(ui::TouchSelectionController::SELECTION_ACTIVE, | 351 EXPECT_EQ(ui::TouchSelectionController::SELECTION_ACTIVE, |
| 352 rwhva->selection_controller()->active_status()); | 352 rwhva->selection_controller()->active_status()); |
| 353 EXPECT_FALSE(selection_controller_test_api.temporarily_hidden()); | 353 EXPECT_FALSE(selection_controller_test_api.temporarily_hidden()); |
| 354 EXPECT_TRUE(ui::TouchSelectionMenuRunner::GetInstance()->IsRunning()); | 354 EXPECT_TRUE(ui::TouchSelectionMenuRunner::GetInstance()->IsRunning()); |
| 355 | 355 |
| 356 // Put a finger down: the quick menu should go away, while touch handles stay | 356 // Put a finger down: the quick menu should go away, while touch handles stay |
| 357 // there. | 357 // there. |
| 358 ui::TouchEvent touch_down(ui::ET_TOUCH_PRESSED, gfx::PointF(10, 10), 0, | 358 ui::TouchEvent touch_down(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, |
| 359 ui::EventTimeForNow()); | 359 ui::EventTimeForNow()); |
| 360 rwhva->OnTouchEvent(&touch_down); | 360 rwhva->OnTouchEvent(&touch_down); |
| 361 EXPECT_EQ(ui::TouchSelectionController::SELECTION_ACTIVE, | 361 EXPECT_EQ(ui::TouchSelectionController::SELECTION_ACTIVE, |
| 362 rwhva->selection_controller()->active_status()); | 362 rwhva->selection_controller()->active_status()); |
| 363 EXPECT_FALSE(selection_controller_test_api.temporarily_hidden()); | 363 EXPECT_FALSE(selection_controller_test_api.temporarily_hidden()); |
| 364 EXPECT_FALSE(ui::TouchSelectionMenuRunner::GetInstance()->IsRunning()); | 364 EXPECT_FALSE(ui::TouchSelectionMenuRunner::GetInstance()->IsRunning()); |
| 365 | 365 |
| 366 // Start scrolling: touch handles should get hidden, while touch selection is | 366 // Start scrolling: touch handles should get hidden, while touch selection is |
| 367 // still active. | 367 // still active. |
| 368 ui::GestureEvent scroll_begin( | 368 ui::GestureEvent scroll_begin( |
| 369 10, 10, 0, ui::EventTimeForNow(), | 369 10, 10, 0, ui::EventTimeForNow(), |
| 370 ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_BEGIN)); | 370 ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_BEGIN)); |
| 371 rwhva->OnGestureEvent(&scroll_begin); | 371 rwhva->OnGestureEvent(&scroll_begin); |
| 372 EXPECT_EQ(ui::TouchSelectionController::SELECTION_ACTIVE, | 372 EXPECT_EQ(ui::TouchSelectionController::SELECTION_ACTIVE, |
| 373 rwhva->selection_controller()->active_status()); | 373 rwhva->selection_controller()->active_status()); |
| 374 EXPECT_TRUE(selection_controller_test_api.temporarily_hidden()); | 374 EXPECT_TRUE(selection_controller_test_api.temporarily_hidden()); |
| 375 EXPECT_FALSE(ui::TouchSelectionMenuRunner::GetInstance()->IsRunning()); | 375 EXPECT_FALSE(ui::TouchSelectionMenuRunner::GetInstance()->IsRunning()); |
| 376 | 376 |
| 377 // End scrolling: touch handles should re-appear. | 377 // End scrolling: touch handles should re-appear. |
| 378 ui::GestureEvent scroll_end( | 378 ui::GestureEvent scroll_end( |
| 379 10, 10, 0, ui::EventTimeForNow(), | 379 10, 10, 0, ui::EventTimeForNow(), |
| 380 ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_END)); | 380 ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_END)); |
| 381 rwhva->OnGestureEvent(&scroll_end); | 381 rwhva->OnGestureEvent(&scroll_end); |
| 382 EXPECT_EQ(ui::TouchSelectionController::SELECTION_ACTIVE, | 382 EXPECT_EQ(ui::TouchSelectionController::SELECTION_ACTIVE, |
| 383 rwhva->selection_controller()->active_status()); | 383 rwhva->selection_controller()->active_status()); |
| 384 EXPECT_FALSE(selection_controller_test_api.temporarily_hidden()); | 384 EXPECT_FALSE(selection_controller_test_api.temporarily_hidden()); |
| 385 EXPECT_FALSE(ui::TouchSelectionMenuRunner::GetInstance()->IsRunning()); | 385 EXPECT_FALSE(ui::TouchSelectionMenuRunner::GetInstance()->IsRunning()); |
| 386 | 386 |
| 387 // Lift the finger up: the quick menu should re-appear. | 387 // Lift the finger up: the quick menu should re-appear. |
| 388 ui::TouchEvent touch_up(ui::ET_TOUCH_RELEASED, gfx::PointF(10, 10), 0, | 388 ui::TouchEvent touch_up(ui::ET_TOUCH_RELEASED, gfx::Point(10, 10), 0, |
| 389 ui::EventTimeForNow()); | 389 ui::EventTimeForNow()); |
| 390 rwhva->OnTouchEvent(&touch_up); | 390 rwhva->OnTouchEvent(&touch_up); |
| 391 EXPECT_EQ(ui::TouchSelectionController::SELECTION_ACTIVE, | 391 EXPECT_EQ(ui::TouchSelectionController::SELECTION_ACTIVE, |
| 392 rwhva->selection_controller()->active_status()); | 392 rwhva->selection_controller()->active_status()); |
| 393 EXPECT_FALSE(selection_controller_test_api.temporarily_hidden()); | 393 EXPECT_FALSE(selection_controller_test_api.temporarily_hidden()); |
| 394 EXPECT_TRUE(ui::TouchSelectionMenuRunner::GetInstance()->IsRunning()); | 394 EXPECT_TRUE(ui::TouchSelectionMenuRunner::GetInstance()->IsRunning()); |
| 395 } | 395 } |
| 396 | 396 |
| 397 // Tests that touch selection gets deactivated after an overscroll completes. | 397 // Tests that touch selection gets deactivated after an overscroll completes. |
| 398 IN_PROC_BROWSER_TEST_F(TouchSelectionControllerClientAuraTest, | 398 IN_PROC_BROWSER_TEST_F(TouchSelectionControllerClientAuraTest, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 rwhva->OnGestureEvent(&scroll_end); | 450 rwhva->OnGestureEvent(&scroll_end); |
| 451 | 451 |
| 452 selection_controller_client->Wait(); | 452 selection_controller_client->Wait(); |
| 453 | 453 |
| 454 EXPECT_EQ(ui::TouchSelectionController::INACTIVE, | 454 EXPECT_EQ(ui::TouchSelectionController::INACTIVE, |
| 455 rwhva->selection_controller()->active_status()); | 455 rwhva->selection_controller()->active_status()); |
| 456 EXPECT_FALSE(ui::TouchSelectionMenuRunner::GetInstance()->IsRunning()); | 456 EXPECT_FALSE(ui::TouchSelectionMenuRunner::GetInstance()->IsRunning()); |
| 457 } | 457 } |
| 458 | 458 |
| 459 } // namespace content | 459 } // namespace content |
| OLD | NEW |