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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 #include "ui/aura/window_targeter.h" | 56 #include "ui/aura/window_targeter.h" |
57 #endif | 57 #endif |
58 | 58 |
59 #if defined(USE_AURA) && !defined(OS_CHROMEOS) | 59 #if defined(USE_AURA) && !defined(OS_CHROMEOS) |
60 #include "chrome/browser/ui/views/frame/desktop_browser_frame_aura.h" | 60 #include "chrome/browser/ui/views/frame/desktop_browser_frame_aura.h" |
61 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 61 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
62 #endif | 62 #endif |
63 | 63 |
64 #if defined(USE_ASH) | 64 #if defined(USE_ASH) |
65 #include "ash/common/ash_switches.h" | 65 #include "ash/common/ash_switches.h" |
66 #include "ash/common/material_design/material_design_controller.h" | |
67 #include "ash/common/wm/root_window_finder.h" | 66 #include "ash/common/wm/root_window_finder.h" |
68 #include "ash/common/wm/window_state.h" | 67 #include "ash/common/wm/window_state.h" |
69 #include "ash/common/wm_window.h" | 68 #include "ash/common/wm_window.h" |
70 #include "ash/shell.h" | 69 #include "ash/shell.h" |
71 #include "ash/test/cursor_manager_test_api.h" | 70 #include "ash/test/cursor_manager_test_api.h" |
72 #include "ash/test/immersive_fullscreen_controller_test_api.h" | 71 #include "ash/test/immersive_fullscreen_controller_test_api.h" |
73 #include "ash/wm/window_state_aura.h" | 72 #include "ash/wm/window_state_aura.h" |
74 #include "ash/wm/window_util.h" | 73 #include "ash/wm/window_util.h" |
75 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" | 74 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" |
76 #include "chrome/browser/ui/views/frame/immersive_mode_controller_ash.h" | 75 #include "chrome/browser/ui/views/frame/immersive_mode_controller_ash.h" |
(...skipping 2020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2097 ash::ImmersiveFullscreenControllerTestApi( | 2096 ash::ImmersiveFullscreenControllerTestApi( |
2098 static_cast<ImmersiveModeControllerAsh*>(immersive_controller2) | 2097 static_cast<ImmersiveModeControllerAsh*>(immersive_controller2) |
2099 ->controller()) | 2098 ->controller()) |
2100 .SetupForTest(); | 2099 .SetupForTest(); |
2101 chrome::ToggleFullscreenMode(browser2); | 2100 chrome::ToggleFullscreenMode(browser2); |
2102 // For MD, the browser's top chrome is completely offscreen, with tabstrip | 2101 // For MD, the browser's top chrome is completely offscreen, with tabstrip |
2103 // visible. | 2102 // visible. |
2104 ASSERT_TRUE(immersive_controller2->IsEnabled()); | 2103 ASSERT_TRUE(immersive_controller2->IsEnabled()); |
2105 ASSERT_FALSE(immersive_controller2->IsRevealed()); | 2104 ASSERT_FALSE(immersive_controller2->IsRevealed()); |
2106 ASSERT_TRUE(tab_strip2->visible()); | 2105 ASSERT_TRUE(tab_strip2->visible()); |
2107 bool is_using_material_design = | |
2108 ash::MaterialDesignController::IsImmersiveModeMaterial(); | |
2109 if (!is_using_material_design) | |
2110 ASSERT_TRUE(tab_strip2->IsImmersiveStyle()); | |
2111 | 2106 |
2112 // Move to the first tab and drag it enough so that it detaches, but not | 2107 // Move to the first tab and drag it enough so that it detaches, but not |
2113 // enough that it attaches to browser2. | 2108 // enough that it attaches to browser2. |
2114 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); | 2109 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); |
2115 ASSERT_TRUE(PressInput(tab_0_center)); | 2110 ASSERT_TRUE(PressInput(tab_0_center)); |
2116 ASSERT_TRUE(DragInputToNotifyWhenDone( | 2111 ASSERT_TRUE(DragInputToNotifyWhenDone( |
2117 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), | 2112 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), |
2118 base::Bind(&DragTabToWindowInSeparateDisplayStep2, | 2113 base::Bind(&DragTabToWindowInSeparateDisplayStep2, |
2119 this, tab_strip, tab_strip2))); | 2114 this, tab_strip, tab_strip2))); |
2120 QuitWhenNotDragging(); | 2115 QuitWhenNotDragging(); |
2121 | 2116 |
2122 // Should now be attached to tab_strip2. | 2117 // Should now be attached to tab_strip2. |
2123 ASSERT_TRUE(tab_strip2->IsDragSessionActive()); | 2118 ASSERT_TRUE(tab_strip2->IsDragSessionActive()); |
2124 ASSERT_FALSE(tab_strip->IsDragSessionActive()); | 2119 ASSERT_FALSE(tab_strip->IsDragSessionActive()); |
2125 ASSERT_TRUE(TabDragController::IsActive()); | 2120 ASSERT_TRUE(TabDragController::IsActive()); |
2126 | 2121 |
2127 // browser2's top chrome should be revealed and the tab strip should be | 2122 // browser2's top chrome should be revealed and the tab strip should be |
2128 // at normal height while user is tragging tabs_strip2's tabs. | 2123 // at normal height while user is tragging tabs_strip2's tabs. |
2129 ASSERT_TRUE(immersive_controller2->IsRevealed()); | 2124 ASSERT_TRUE(immersive_controller2->IsRevealed()); |
2130 ASSERT_FALSE(tab_strip2->IsImmersiveStyle()); | |
2131 ASSERT_TRUE(tab_strip2->visible()); | 2125 ASSERT_TRUE(tab_strip2->visible()); |
2132 | 2126 |
2133 // Release the mouse, stopping the drag session. | 2127 // Release the mouse, stopping the drag session. |
2134 ASSERT_TRUE(ReleaseInput()); | 2128 ASSERT_TRUE(ReleaseInput()); |
2135 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); | 2129 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); |
2136 ASSERT_FALSE(tab_strip->IsDragSessionActive()); | 2130 ASSERT_FALSE(tab_strip->IsDragSessionActive()); |
2137 ASSERT_FALSE(TabDragController::IsActive()); | 2131 ASSERT_FALSE(TabDragController::IsActive()); |
2138 EXPECT_EQ("0 100", IDString(browser2->tab_strip_model())); | 2132 EXPECT_EQ("0 100", IDString(browser2->tab_strip_model())); |
2139 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); | 2133 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); |
2140 | 2134 |
2141 // Move the mouse off of browser2's top chrome. | 2135 // Move the mouse off of browser2's top chrome. |
2142 aura::Window* primary_root = roots[0]; | 2136 aura::Window* primary_root = roots[0]; |
2143 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync( | 2137 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync( |
2144 primary_root->GetBoundsInScreen().CenterPoint())); | 2138 primary_root->GetBoundsInScreen().CenterPoint())); |
2145 | 2139 |
2146 // The first browser window should not be in immersive fullscreen. | 2140 // The first browser window should not be in immersive fullscreen. |
2147 // browser2 should still be in immersive fullscreen, but the top chrome should | 2141 // browser2 should still be in immersive fullscreen, but the top chrome should |
2148 // no longer be revealed. | 2142 // no longer be revealed. |
2149 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); | 2143 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); |
2150 EXPECT_FALSE(browser_view->immersive_mode_controller()->IsEnabled()); | 2144 EXPECT_FALSE(browser_view->immersive_mode_controller()->IsEnabled()); |
2151 | 2145 |
2152 EXPECT_TRUE(immersive_controller2->IsEnabled()); | 2146 EXPECT_TRUE(immersive_controller2->IsEnabled()); |
2153 EXPECT_FALSE(immersive_controller2->IsRevealed()); | 2147 EXPECT_FALSE(immersive_controller2->IsRevealed()); |
2154 EXPECT_TRUE(tab_strip2->visible()); | 2148 EXPECT_TRUE(tab_strip2->visible()); |
2155 if (!is_using_material_design) | |
2156 EXPECT_TRUE(tab_strip2->IsImmersiveStyle()); | |
2157 } | 2149 } |
2158 | 2150 |
2159 // Subclass of DetachToBrowserTabDragControllerTest that | 2151 // Subclass of DetachToBrowserTabDragControllerTest that |
2160 // creates multiple displays with different device scale factors. | 2152 // creates multiple displays with different device scale factors. |
2161 class DifferentDeviceScaleFactorDisplayTabDragControllerTest | 2153 class DifferentDeviceScaleFactorDisplayTabDragControllerTest |
2162 : public DetachToBrowserTabDragControllerTest { | 2154 : public DetachToBrowserTabDragControllerTest { |
2163 public: | 2155 public: |
2164 DifferentDeviceScaleFactorDisplayTabDragControllerTest() {} | 2156 DifferentDeviceScaleFactorDisplayTabDragControllerTest() {} |
2165 virtual ~DifferentDeviceScaleFactorDisplayTabDragControllerTest() {} | 2157 virtual ~DifferentDeviceScaleFactorDisplayTabDragControllerTest() {} |
2166 | 2158 |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2558 DetachToBrowserTabDragControllerTest, | 2550 DetachToBrowserTabDragControllerTest, |
2559 ::testing::Values("mouse", "touch")); | 2551 ::testing::Values("mouse", "touch")); |
2560 INSTANTIATE_TEST_CASE_P(TabDragging, | 2552 INSTANTIATE_TEST_CASE_P(TabDragging, |
2561 DetachToBrowserTabDragControllerTestTouch, | 2553 DetachToBrowserTabDragControllerTestTouch, |
2562 ::testing::Values("touch")); | 2554 ::testing::Values("touch")); |
2563 #else | 2555 #else |
2564 INSTANTIATE_TEST_CASE_P(TabDragging, | 2556 INSTANTIATE_TEST_CASE_P(TabDragging, |
2565 DetachToBrowserTabDragControllerTest, | 2557 DetachToBrowserTabDragControllerTest, |
2566 ::testing::Values("mouse")); | 2558 ::testing::Values("mouse")); |
2567 #endif | 2559 #endif |
OLD | NEW |