| 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 2037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2048 ImmersiveModeController* immersive_controller2 = | 2048 ImmersiveModeController* immersive_controller2 = |
| 2049 browser_view2->immersive_mode_controller(); | 2049 browser_view2->immersive_mode_controller(); |
| 2050 ASSERT_EQ(ImmersiveModeController::Type::ASH, immersive_controller2->type()); | 2050 ASSERT_EQ(ImmersiveModeController::Type::ASH, immersive_controller2->type()); |
| 2051 ash::ImmersiveFullscreenControllerTestApi( | 2051 ash::ImmersiveFullscreenControllerTestApi( |
| 2052 static_cast<ImmersiveModeControllerAsh*>(immersive_controller2) | 2052 static_cast<ImmersiveModeControllerAsh*>(immersive_controller2) |
| 2053 ->controller()) | 2053 ->controller()) |
| 2054 .SetupForTest(); | 2054 .SetupForTest(); |
| 2055 chrome::ToggleFullscreenMode(browser2); | 2055 chrome::ToggleFullscreenMode(browser2); |
| 2056 ASSERT_TRUE(immersive_controller2->IsEnabled()); | 2056 ASSERT_TRUE(immersive_controller2->IsEnabled()); |
| 2057 ASSERT_FALSE(immersive_controller2->IsRevealed()); | 2057 ASSERT_FALSE(immersive_controller2->IsRevealed()); |
| 2058 ASSERT_TRUE(tab_strip2->IsImmersiveStyle()); | |
| 2059 | 2058 |
| 2060 // Move to the first tab and drag it enough so that it detaches, but not | 2059 // Move to the first tab and drag it enough so that it detaches, but not |
| 2061 // enough that it attaches to browser2. | 2060 // enough that it attaches to browser2. |
| 2062 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); | 2061 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); |
| 2063 ASSERT_TRUE(PressInput(tab_0_center)); | 2062 ASSERT_TRUE(PressInput(tab_0_center)); |
| 2064 ASSERT_TRUE(DragInputToNotifyWhenDone( | 2063 ASSERT_TRUE(DragInputToNotifyWhenDone( |
| 2065 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), | 2064 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), |
| 2066 base::Bind(&DragTabToWindowInSeparateDisplayStep2, | 2065 base::Bind(&DragTabToWindowInSeparateDisplayStep2, |
| 2067 this, tab_strip, tab_strip2))); | 2066 this, tab_strip, tab_strip2))); |
| 2068 QuitWhenNotDragging(); | 2067 QuitWhenNotDragging(); |
| 2069 | 2068 |
| 2070 // Should now be attached to tab_strip2. | 2069 // Should now be attached to tab_strip2. |
| 2071 ASSERT_TRUE(tab_strip2->IsDragSessionActive()); | 2070 ASSERT_TRUE(tab_strip2->IsDragSessionActive()); |
| 2072 ASSERT_FALSE(tab_strip->IsDragSessionActive()); | 2071 ASSERT_FALSE(tab_strip->IsDragSessionActive()); |
| 2073 ASSERT_TRUE(TabDragController::IsActive()); | 2072 ASSERT_TRUE(TabDragController::IsActive()); |
| 2074 | 2073 |
| 2075 // browser2's top chrome should be revealed and the tab strip should be | 2074 // browser2's top chrome should be revealed and the tab strip should be |
| 2076 // at normal height while user is tragging tabs_strip2's tabs. | 2075 // at normal height while user is tragging tabs_strip2's tabs. |
| 2077 ASSERT_TRUE(immersive_controller2->IsRevealed()); | 2076 ASSERT_TRUE(immersive_controller2->IsRevealed()); |
| 2078 ASSERT_FALSE(tab_strip2->IsImmersiveStyle()); | |
| 2079 | 2077 |
| 2080 // Release the mouse, stopping the drag session. | 2078 // Release the mouse, stopping the drag session. |
| 2081 ASSERT_TRUE(ReleaseInput()); | 2079 ASSERT_TRUE(ReleaseInput()); |
| 2082 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); | 2080 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); |
| 2083 ASSERT_FALSE(tab_strip->IsDragSessionActive()); | 2081 ASSERT_FALSE(tab_strip->IsDragSessionActive()); |
| 2084 ASSERT_FALSE(TabDragController::IsActive()); | 2082 ASSERT_FALSE(TabDragController::IsActive()); |
| 2085 EXPECT_EQ("0 100", IDString(browser2->tab_strip_model())); | 2083 EXPECT_EQ("0 100", IDString(browser2->tab_strip_model())); |
| 2086 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); | 2084 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); |
| 2087 | 2085 |
| 2088 // Move the mouse off of browser2's top chrome. | 2086 // Move the mouse off of browser2's top chrome. |
| 2089 aura::Window* primary_root = roots[0]; | 2087 aura::Window* primary_root = roots[0]; |
| 2090 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync( | 2088 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync( |
| 2091 primary_root->GetBoundsInScreen().CenterPoint())); | 2089 primary_root->GetBoundsInScreen().CenterPoint())); |
| 2092 | 2090 |
| 2093 // The first browser window should not be in immersive fullscreen. | 2091 // The first browser window should not be in immersive fullscreen. |
| 2094 // browser2 should still be in immersive fullscreen, but the top chrome should | 2092 // browser2 should still be in immersive fullscreen, but the top chrome should |
| 2095 // no longer be revealed. | 2093 // no longer be revealed. |
| 2096 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); | 2094 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); |
| 2097 EXPECT_FALSE(browser_view->immersive_mode_controller()->IsEnabled()); | 2095 EXPECT_FALSE(browser_view->immersive_mode_controller()->IsEnabled()); |
| 2098 | 2096 |
| 2099 EXPECT_TRUE(immersive_controller2->IsEnabled()); | 2097 EXPECT_TRUE(immersive_controller2->IsEnabled()); |
| 2100 EXPECT_FALSE(immersive_controller2->IsRevealed()); | 2098 EXPECT_FALSE(immersive_controller2->IsRevealed()); |
| 2101 EXPECT_TRUE(tab_strip2->IsImmersiveStyle()); | |
| 2102 } | 2099 } |
| 2103 | 2100 |
| 2104 // Subclass of DetachToBrowserTabDragControllerTest that | 2101 // Subclass of DetachToBrowserTabDragControllerTest that |
| 2105 // creates multiple displays with different device scale factors. | 2102 // creates multiple displays with different device scale factors. |
| 2106 class DifferentDeviceScaleFactorDisplayTabDragControllerTest | 2103 class DifferentDeviceScaleFactorDisplayTabDragControllerTest |
| 2107 : public DetachToBrowserTabDragControllerTest { | 2104 : public DetachToBrowserTabDragControllerTest { |
| 2108 public: | 2105 public: |
| 2109 DifferentDeviceScaleFactorDisplayTabDragControllerTest() {} | 2106 DifferentDeviceScaleFactorDisplayTabDragControllerTest() {} |
| 2110 virtual ~DifferentDeviceScaleFactorDisplayTabDragControllerTest() {} | 2107 virtual ~DifferentDeviceScaleFactorDisplayTabDragControllerTest() {} |
| 2111 | 2108 |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2499 DetachToBrowserTabDragControllerTest, | 2496 DetachToBrowserTabDragControllerTest, |
| 2500 ::testing::Values("mouse", "touch")); | 2497 ::testing::Values("mouse", "touch")); |
| 2501 INSTANTIATE_TEST_CASE_P(TabDragging, | 2498 INSTANTIATE_TEST_CASE_P(TabDragging, |
| 2502 DetachToBrowserTabDragControllerTestTouch, | 2499 DetachToBrowserTabDragControllerTestTouch, |
| 2503 ::testing::Values("touch")); | 2500 ::testing::Values("touch")); |
| 2504 #else | 2501 #else |
| 2505 INSTANTIATE_TEST_CASE_P(TabDragging, | 2502 INSTANTIATE_TEST_CASE_P(TabDragging, |
| 2506 DetachToBrowserTabDragControllerTest, | 2503 DetachToBrowserTabDragControllerTest, |
| 2507 ::testing::Values("mouse")); | 2504 ::testing::Values("mouse")); |
| 2508 #endif | 2505 #endif |
| OLD | NEW |