| 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 "chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.h" | 5 #include "chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/location.h" |
| 14 #include "base/macros.h" | 15 #include "base/macros.h" |
| 15 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
| 16 #include "base/run_loop.h" | 17 #include "base/run_loop.h" |
| 18 #include "base/single_thread_task_runner.h" |
| 17 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
| 20 #include "base/threading/thread_task_runner_handle.h" |
| 18 #include "build/build_config.h" | 21 #include "build/build_config.h" |
| 19 #include "chrome/browser/chrome_notification_types.h" | 22 #include "chrome/browser/chrome_notification_types.h" |
| 20 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" |
| 21 #include "chrome/browser/ui/browser_commands.h" | 24 #include "chrome/browser/ui/browser_commands.h" |
| 22 #include "chrome/browser/ui/browser_list.h" | 25 #include "chrome/browser/ui/browser_list.h" |
| 23 #include "chrome/browser/ui/browser_tabstrip.h" | 26 #include "chrome/browser/ui/browser_tabstrip.h" |
| 24 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 27 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 25 #include "chrome/browser/ui/views/frame/browser_view.h" | 28 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 26 #include "chrome/browser/ui/views/frame/native_browser_frame_factory.h" | 29 #include "chrome/browser/ui/views/frame/native_browser_frame_factory.h" |
| 27 #include "chrome/browser/ui/views/tabs/tab.h" | 30 #include "chrome/browser/ui/views/tabs/tab.h" |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 #endif | 448 #endif |
| 446 return true; | 449 return true; |
| 447 } | 450 } |
| 448 | 451 |
| 449 bool DragInputToNotifyWhenDone(int x, | 452 bool DragInputToNotifyWhenDone(int x, |
| 450 int y, | 453 int y, |
| 451 const base::Closure& task) { | 454 const base::Closure& task) { |
| 452 if (input_source() == INPUT_SOURCE_MOUSE) | 455 if (input_source() == INPUT_SOURCE_MOUSE) |
| 453 return ui_controls::SendMouseMoveNotifyWhenDone(x, y, task); | 456 return ui_controls::SendMouseMoveNotifyWhenDone(x, y, task); |
| 454 #if defined(OS_CHROMEOS) | 457 #if defined(OS_CHROMEOS) |
| 455 base::MessageLoop::current()->PostTask(FROM_HERE, task); | 458 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); |
| 456 event_generator_->MoveTouch(gfx::Point(x, y)); | 459 event_generator_->MoveTouch(gfx::Point(x, y)); |
| 457 #else | 460 #else |
| 458 NOTREACHED(); | 461 NOTREACHED(); |
| 459 #endif | 462 #endif |
| 460 return true; | 463 return true; |
| 461 } | 464 } |
| 462 | 465 |
| 463 bool DragInputToDelayedNotifyWhenDone(int x, | 466 bool DragInputToDelayedNotifyWhenDone(int x, |
| 464 int y, | 467 int y, |
| 465 const base::Closure& task, | 468 const base::Closure& task, |
| 466 base::TimeDelta delay) { | 469 base::TimeDelta delay) { |
| 467 if (input_source() == INPUT_SOURCE_MOUSE) | 470 if (input_source() == INPUT_SOURCE_MOUSE) |
| 468 return ui_controls::SendMouseMoveNotifyWhenDone(x, y, task); | 471 return ui_controls::SendMouseMoveNotifyWhenDone(x, y, task); |
| 469 #if defined(OS_CHROMEOS) | 472 #if defined(OS_CHROMEOS) |
| 470 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, task, delay); | 473 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(FROM_HERE, task, |
| 474 delay); |
| 471 event_generator_->MoveTouch(gfx::Point(x, y)); | 475 event_generator_->MoveTouch(gfx::Point(x, y)); |
| 472 #else | 476 #else |
| 473 NOTREACHED(); | 477 NOTREACHED(); |
| 474 #endif | 478 #endif |
| 475 return true; | 479 return true; |
| 476 } | 480 } |
| 477 | 481 |
| 478 bool DragInput2ToNotifyWhenDone(int x, | 482 bool DragInput2ToNotifyWhenDone(int x, |
| 479 int y, | 483 int y, |
| 480 const base::Closure& task) { | 484 const base::Closure& task) { |
| 481 if (input_source() == INPUT_SOURCE_MOUSE) | 485 if (input_source() == INPUT_SOURCE_MOUSE) |
| 482 return ui_controls::SendMouseMoveNotifyWhenDone(x, y, task); | 486 return ui_controls::SendMouseMoveNotifyWhenDone(x, y, task); |
| 483 #if defined(OS_CHROMEOS) | 487 #if defined(OS_CHROMEOS) |
| 484 base::MessageLoop::current()->PostTask(FROM_HERE, task); | 488 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); |
| 485 event_generator_->MoveTouchId(gfx::Point(x, y), 1); | 489 event_generator_->MoveTouchId(gfx::Point(x, y), 1); |
| 486 #else | 490 #else |
| 487 NOTREACHED(); | 491 NOTREACHED(); |
| 488 #endif | 492 #endif |
| 489 return true; | 493 return true; |
| 490 } | 494 } |
| 491 | 495 |
| 492 bool ReleaseInput() { | 496 bool ReleaseInput() { |
| 493 if (input_source() == INPUT_SOURCE_MOUSE) { | 497 if (input_source() == INPUT_SOURCE_MOUSE) { |
| 494 return ui_test_utils::SendMouseEventsSync( | 498 return ui_test_utils::SendMouseEventsSync( |
| (...skipping 1978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2473 DetachToBrowserTabDragControllerTest, | 2477 DetachToBrowserTabDragControllerTest, |
| 2474 ::testing::Values("mouse", "touch")); | 2478 ::testing::Values("mouse", "touch")); |
| 2475 INSTANTIATE_TEST_CASE_P(TabDragging, | 2479 INSTANTIATE_TEST_CASE_P(TabDragging, |
| 2476 DetachToBrowserTabDragControllerTestTouch, | 2480 DetachToBrowserTabDragControllerTestTouch, |
| 2477 ::testing::Values("touch")); | 2481 ::testing::Values("touch")); |
| 2478 #else | 2482 #else |
| 2479 INSTANTIATE_TEST_CASE_P(TabDragging, | 2483 INSTANTIATE_TEST_CASE_P(TabDragging, |
| 2480 DetachToBrowserTabDragControllerTest, | 2484 DetachToBrowserTabDragControllerTest, |
| 2481 ::testing::Values("mouse")); | 2485 ::testing::Values("mouse")); |
| 2482 #endif | 2486 #endif |
| OLD | NEW |