| 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 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 33 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 34 #include "chrome/browser/ui/views/tabs/window_finder.h" | 34 #include "chrome/browser/ui/views/tabs/window_finder.h" |
| 35 #include "chrome/test/base/in_process_browser_test.h" | 35 #include "chrome/test/base/in_process_browser_test.h" |
| 36 #include "chrome/test/base/interactive_test_utils.h" | 36 #include "chrome/test/base/interactive_test_utils.h" |
| 37 #include "chrome/test/base/ui_test_utils.h" | 37 #include "chrome/test/base/ui_test_utils.h" |
| 38 #include "content/public/browser/notification_details.h" | 38 #include "content/public/browser/notification_details.h" |
| 39 #include "content/public/browser/notification_observer.h" | 39 #include "content/public/browser/notification_observer.h" |
| 40 #include "content/public/browser/notification_service.h" | 40 #include "content/public/browser/notification_service.h" |
| 41 #include "content/public/browser/notification_source.h" | 41 #include "content/public/browser/notification_source.h" |
| 42 #include "content/public/browser/web_contents.h" | 42 #include "content/public/browser/web_contents.h" |
| 43 #include "content/public/common/content_switches.h" |
| 43 #include "ui/base/test/ui_controls.h" | 44 #include "ui/base/test/ui_controls.h" |
| 44 #include "ui/display/display.h" | 45 #include "ui/display/display.h" |
| 45 #include "ui/display/screen.h" | 46 #include "ui/display/screen.h" |
| 46 #include "ui/views/view.h" | 47 #include "ui/views/view.h" |
| 47 #include "ui/views/widget/widget.h" | 48 #include "ui/views/widget/widget.h" |
| 48 | 49 |
| 49 #if defined(USE_AURA) | 50 #if defined(USE_AURA) |
| 50 #include "ui/aura/client/aura_constants.h" | 51 #include "ui/aura/client/aura_constants.h" |
| 51 #include "ui/aura/test/test_window_delegate.h" | 52 #include "ui/aura/test/test_window_delegate.h" |
| 52 #include "ui/aura/test/test_windows.h" | 53 #include "ui/aura/test/test_windows.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 return browser2; | 204 return browser2; |
| 204 } | 205 } |
| 205 | 206 |
| 206 void TabDragControllerTest::SetWindowFinderForTabStrip( | 207 void TabDragControllerTest::SetWindowFinderForTabStrip( |
| 207 TabStrip* tab_strip, | 208 TabStrip* tab_strip, |
| 208 std::unique_ptr<WindowFinder> window_finder) { | 209 std::unique_ptr<WindowFinder> window_finder) { |
| 209 ASSERT_TRUE(tab_strip->drag_controller_.get()); | 210 ASSERT_TRUE(tab_strip->drag_controller_.get()); |
| 210 tab_strip->drag_controller_->window_finder_ = std::move(window_finder); | 211 tab_strip->drag_controller_->window_finder_ = std::move(window_finder); |
| 211 } | 212 } |
| 212 | 213 |
| 214 void TabDragControllerTest::SetUpCommandLine(base::CommandLine* command_line) { |
| 215 command_line->AppendSwitch(switches::kDisableResizeLock); |
| 216 } |
| 217 |
| 213 namespace { | 218 namespace { |
| 214 | 219 |
| 215 enum InputSource { | 220 enum InputSource { |
| 216 INPUT_SOURCE_MOUSE = 0, | 221 INPUT_SOURCE_MOUSE = 0, |
| 217 INPUT_SOURCE_TOUCH = 1 | 222 INPUT_SOURCE_TOUCH = 1 |
| 218 }; | 223 }; |
| 219 | 224 |
| 220 int GetDetachY(TabStrip* tab_strip) { | 225 int GetDetachY(TabStrip* tab_strip) { |
| 221 return std::max(TabDragController::kTouchVerticalDetachMagnetism, | 226 return std::max(TabDragController::kTouchVerticalDetachMagnetism, |
| 222 TabDragController::kVerticalDetachMagnetism) + | 227 TabDragController::kVerticalDetachMagnetism) + |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 // Drag to target_tab_strip. This should stop the nested loop from dragging | 666 // Drag to target_tab_strip. This should stop the nested loop from dragging |
| 662 // the window. | 667 // the window. |
| 663 gfx::Point target_point(target_tab_strip->width() -1, | 668 gfx::Point target_point(target_tab_strip->width() -1, |
| 664 target_tab_strip->height() / 2); | 669 target_tab_strip->height() / 2); |
| 665 views::View::ConvertPointToScreen(target_tab_strip, &target_point); | 670 views::View::ConvertPointToScreen(target_tab_strip, &target_point); |
| 666 ASSERT_TRUE(test->DragInputToAsync(target_point)); | 671 ASSERT_TRUE(test->DragInputToAsync(target_point)); |
| 667 } | 672 } |
| 668 | 673 |
| 669 } // namespace | 674 } // namespace |
| 670 | 675 |
| 671 #if defined(OS_CHROMEOS) || defined(OS_LINUX) | 676 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 672 // TODO(sky,sad): Disabled as it fails due to resize locks with a real | 677 // TODO: Disabled as mouse isn't updated propertly, http://crbug.com/640741. |
| 673 // compositor. crbug.com/331924 | |
| 674 #define MAYBE_DragToSeparateWindow DISABLED_DragToSeparateWindow | 678 #define MAYBE_DragToSeparateWindow DISABLED_DragToSeparateWindow |
| 675 #else | 679 #else |
| 676 #define MAYBE_DragToSeparateWindow DragToSeparateWindow | 680 #define MAYBE_DragToSeparateWindow DragToSeparateWindow |
| 677 #endif | 681 #endif |
| 678 // Creates two browsers, drags from first into second. | 682 // Creates two browsers, drags from first into second. |
| 679 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, | 683 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, |
| 680 MAYBE_DragToSeparateWindow) { | 684 MAYBE_DragToSeparateWindow) { |
| 681 TabStrip* tab_strip = GetTabStripForBrowser(browser()); | 685 TabStrip* tab_strip = GetTabStripForBrowser(browser()); |
| 682 | 686 |
| 683 // Add another tab to browser(). | 687 // Add another tab to browser(). |
| (...skipping 1817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2501 DetachToBrowserTabDragControllerTest, | 2505 DetachToBrowserTabDragControllerTest, |
| 2502 ::testing::Values("mouse", "touch")); | 2506 ::testing::Values("mouse", "touch")); |
| 2503 INSTANTIATE_TEST_CASE_P(TabDragging, | 2507 INSTANTIATE_TEST_CASE_P(TabDragging, |
| 2504 DetachToBrowserTabDragControllerTestTouch, | 2508 DetachToBrowserTabDragControllerTestTouch, |
| 2505 ::testing::Values("touch")); | 2509 ::testing::Values("touch")); |
| 2506 #else | 2510 #else |
| 2507 INSTANTIATE_TEST_CASE_P(TabDragging, | 2511 INSTANTIATE_TEST_CASE_P(TabDragging, |
| 2508 DetachToBrowserTabDragControllerTest, | 2512 DetachToBrowserTabDragControllerTest, |
| 2509 ::testing::Values("mouse")); | 2513 ::testing::Values("mouse")); |
| 2510 #endif | 2514 #endif |
| OLD | NEW |