| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/wm/window_state.h" | 9 #include "ash/wm/window_state.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 #if defined(USE_ASH) | 45 #if defined(USE_ASH) |
| 46 #include "ash/display/display_controller.h" | 46 #include "ash/display/display_controller.h" |
| 47 #include "ash/display/display_manager.h" | 47 #include "ash/display/display_manager.h" |
| 48 #include "ash/shell.h" | 48 #include "ash/shell.h" |
| 49 #include "ash/test/cursor_manager_test_api.h" | 49 #include "ash/test/cursor_manager_test_api.h" |
| 50 #include "ash/wm/coordinate_conversion.h" | 50 #include "ash/wm/coordinate_conversion.h" |
| 51 #include "ash/wm/window_util.h" | 51 #include "ash/wm/window_util.h" |
| 52 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" | 52 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" |
| 53 #include "ui/aura/client/screen_position_client.h" | 53 #include "ui/aura/client/screen_position_client.h" |
| 54 #include "ui/aura/test/event_generator.h" | 54 #include "ui/aura/test/event_generator_delegate_aura.h" |
| 55 #include "ui/aura/window_event_dispatcher.h" | 55 #include "ui/aura/window_event_dispatcher.h" |
| 56 #include "ui/events/test/event_generator.h" |
| 56 #endif | 57 #endif |
| 57 | 58 |
| 58 using content::WebContents; | 59 using content::WebContents; |
| 59 | 60 |
| 60 namespace test { | 61 namespace test { |
| 61 | 62 |
| 62 namespace { | 63 namespace { |
| 63 | 64 |
| 64 const char kTabDragControllerInteractiveUITestUserDataKey[] = | 65 const char kTabDragControllerInteractiveUITestUserDataKey[] = |
| 65 "TabDragControllerInteractiveUITestUserData"; | 66 "TabDragControllerInteractiveUITestUserData"; |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 #endif | 354 #endif |
| 354 | 355 |
| 355 class DetachToBrowserTabDragControllerTest | 356 class DetachToBrowserTabDragControllerTest |
| 356 : public TabDragControllerTest, | 357 : public TabDragControllerTest, |
| 357 public ::testing::WithParamInterface<const char*> { | 358 public ::testing::WithParamInterface<const char*> { |
| 358 public: | 359 public: |
| 359 DetachToBrowserTabDragControllerTest() {} | 360 DetachToBrowserTabDragControllerTest() {} |
| 360 | 361 |
| 361 virtual void SetUpOnMainThread() OVERRIDE { | 362 virtual void SetUpOnMainThread() OVERRIDE { |
| 362 #if defined(OS_CHROMEOS) | 363 #if defined(OS_CHROMEOS) |
| 363 event_generator_.reset(new aura::test::EventGenerator( | 364 event_generator_.reset( |
| 364 ash::Shell::GetPrimaryRootWindow())); | 365 new ui::test::EventGenerator(ash::Shell::GetPrimaryRootWindow())); |
| 365 #endif | 366 #endif |
| 366 } | 367 } |
| 367 | 368 |
| 368 InputSource input_source() const { | 369 InputSource input_source() const { |
| 369 return strstr(GetParam(), "mouse") ? | 370 return strstr(GetParam(), "mouse") ? |
| 370 INPUT_SOURCE_MOUSE : INPUT_SOURCE_TOUCH; | 371 INPUT_SOURCE_MOUSE : INPUT_SOURCE_TOUCH; |
| 371 } | 372 } |
| 372 | 373 |
| 373 // Set root window from a point in screen coordinates | 374 // Set root window from a point in screen coordinates |
| 374 void SetEventGeneratorRootWindow(const gfx::Point& point) { | 375 void SetEventGeneratorRootWindow(const gfx::Point& point) { |
| 375 if (input_source() == INPUT_SOURCE_MOUSE) | 376 if (input_source() == INPUT_SOURCE_MOUSE) |
| 376 return; | 377 return; |
| 377 #if defined(OS_CHROMEOS) | 378 #if defined(OS_CHROMEOS) |
| 378 event_generator_.reset(new aura::test::EventGenerator( | 379 event_generator_.reset(new ui::test::EventGenerator( |
| 379 new ScreenEventGeneratorDelegate(ash::wm::GetRootWindowAt(point)))); | 380 new ScreenEventGeneratorDelegate(ash::wm::GetRootWindowAt(point)))); |
| 380 #endif | 381 #endif |
| 381 } | 382 } |
| 382 | 383 |
| 383 // The following methods update one of the mouse or touch input depending upon | 384 // The following methods update one of the mouse or touch input depending upon |
| 384 // the InputSource. | 385 // the InputSource. |
| 385 bool PressInput(const gfx::Point& location) { | 386 bool PressInput(const gfx::Point& location) { |
| 386 if (input_source() == INPUT_SOURCE_MOUSE) { | 387 if (input_source() == INPUT_SOURCE_MOUSE) { |
| 387 return ui_test_utils::SendMouseMoveSync(location) && | 388 return ui_test_utils::SendMouseMoveSync(location) && |
| 388 ui_test_utils::SendMouseEventsSync( | 389 ui_test_utils::SendMouseEventsSync( |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 } | 523 } |
| 523 | 524 |
| 524 void AddBlankTabAndShow(Browser* browser) { | 525 void AddBlankTabAndShow(Browser* browser) { |
| 525 InProcessBrowserTest::AddBlankTabAndShow(browser); | 526 InProcessBrowserTest::AddBlankTabAndShow(browser); |
| 526 } | 527 } |
| 527 | 528 |
| 528 Browser* browser() const { return InProcessBrowserTest::browser(); } | 529 Browser* browser() const { return InProcessBrowserTest::browser(); } |
| 529 | 530 |
| 530 private: | 531 private: |
| 531 #if defined(OS_CHROMEOS) | 532 #if defined(OS_CHROMEOS) |
| 532 scoped_ptr<aura::test::EventGenerator> event_generator_; | 533 scoped_ptr<ui::test::EventGenerator> event_generator_; |
| 533 #endif | 534 #endif |
| 534 | 535 |
| 535 DISALLOW_COPY_AND_ASSIGN(DetachToBrowserTabDragControllerTest); | 536 DISALLOW_COPY_AND_ASSIGN(DetachToBrowserTabDragControllerTest); |
| 536 }; | 537 }; |
| 537 | 538 |
| 538 // Creates a browser with two tabs, drags the second to the first. | 539 // Creates a browser with two tabs, drags the second to the first. |
| 539 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, DragInSameWindow) { | 540 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, DragInSameWindow) { |
| 540 // TODO(sky): this won't work with touch as it requires a long press. | 541 // TODO(sky): this won't work with touch as it requires a long press. |
| 541 if (input_source() == INPUT_SOURCE_TOUCH) { | 542 if (input_source() == INPUT_SOURCE_TOUCH) { |
| 542 VLOG(1) << "Test is DISABLED for touch input."; | 543 VLOG(1) << "Test is DISABLED for touch input."; |
| (...skipping 1667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2210 DetachToBrowserTabDragControllerTest, | 2211 DetachToBrowserTabDragControllerTest, |
| 2211 ::testing::Values("mouse", "touch")); | 2212 ::testing::Values("mouse", "touch")); |
| 2212 INSTANTIATE_TEST_CASE_P(TabDragging, | 2213 INSTANTIATE_TEST_CASE_P(TabDragging, |
| 2213 DetachToBrowserTabDragControllerTestTouch, | 2214 DetachToBrowserTabDragControllerTestTouch, |
| 2214 ::testing::Values("touch")); | 2215 ::testing::Values("touch")); |
| 2215 #elif defined(USE_ASH) | 2216 #elif defined(USE_ASH) |
| 2216 INSTANTIATE_TEST_CASE_P(TabDragging, | 2217 INSTANTIATE_TEST_CASE_P(TabDragging, |
| 2217 DetachToBrowserTabDragControllerTest, | 2218 DetachToBrowserTabDragControllerTest, |
| 2218 ::testing::Values("mouse")); | 2219 ::testing::Values("mouse")); |
| 2219 #endif | 2220 #endif |
| OLD | NEW |