Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Side by Side Diff: chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc

Issue 2640433004: ChromeOS MD: Fix cannot drag tab onto immersive fullscreen window (Closed)
Patch Set: comments from ps11 Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/views/frame/immersive_mode_controller_ash_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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"
66 #include "ash/common/wm/root_window_finder.h" 67 #include "ash/common/wm/root_window_finder.h"
67 #include "ash/common/wm/window_state.h" 68 #include "ash/common/wm/window_state.h"
68 #include "ash/common/wm_window.h" 69 #include "ash/common/wm_window.h"
69 #include "ash/shell.h" 70 #include "ash/shell.h"
70 #include "ash/test/cursor_manager_test_api.h" 71 #include "ash/test/cursor_manager_test_api.h"
71 #include "ash/test/immersive_fullscreen_controller_test_api.h" 72 #include "ash/test/immersive_fullscreen_controller_test_api.h"
72 #include "ash/wm/window_state_aura.h" 73 #include "ash/wm/window_state_aura.h"
73 #include "ash/wm/window_util.h" 74 #include "ash/wm/window_util.h"
74 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" 75 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
75 #include "chrome/browser/ui/views/frame/immersive_mode_controller_ash.h" 76 #include "chrome/browser/ui/views/frame/immersive_mode_controller_ash.h"
(...skipping 2015 matching lines...) Expand 10 before | Expand all | Expand 10 after
2091 // Put the second browser into immersive fullscreen. 2092 // Put the second browser into immersive fullscreen.
2092 BrowserView* browser_view2 = BrowserView::GetBrowserViewForBrowser(browser2); 2093 BrowserView* browser_view2 = BrowserView::GetBrowserViewForBrowser(browser2);
2093 ImmersiveModeController* immersive_controller2 = 2094 ImmersiveModeController* immersive_controller2 =
2094 browser_view2->immersive_mode_controller(); 2095 browser_view2->immersive_mode_controller();
2095 ASSERT_EQ(ImmersiveModeController::Type::ASH, immersive_controller2->type()); 2096 ASSERT_EQ(ImmersiveModeController::Type::ASH, immersive_controller2->type());
2096 ash::ImmersiveFullscreenControllerTestApi( 2097 ash::ImmersiveFullscreenControllerTestApi(
2097 static_cast<ImmersiveModeControllerAsh*>(immersive_controller2) 2098 static_cast<ImmersiveModeControllerAsh*>(immersive_controller2)
2098 ->controller()) 2099 ->controller())
2099 .SetupForTest(); 2100 .SetupForTest();
2100 chrome::ToggleFullscreenMode(browser2); 2101 chrome::ToggleFullscreenMode(browser2);
2102 // For MD, the browser's top chrome is completely offscreen, with tabstrip
2103 // visible.
2101 ASSERT_TRUE(immersive_controller2->IsEnabled()); 2104 ASSERT_TRUE(immersive_controller2->IsEnabled());
2102 ASSERT_FALSE(immersive_controller2->IsRevealed()); 2105 ASSERT_FALSE(immersive_controller2->IsRevealed());
2103 ASSERT_TRUE(tab_strip2->IsImmersiveStyle()); 2106 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());
2104 2111
2105 // Move to the first tab and drag it enough so that it detaches, but not 2112 // Move to the first tab and drag it enough so that it detaches, but not
2106 // enough that it attaches to browser2. 2113 // enough that it attaches to browser2.
2107 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); 2114 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0)));
2108 ASSERT_TRUE(PressInput(tab_0_center)); 2115 ASSERT_TRUE(PressInput(tab_0_center));
2109 ASSERT_TRUE(DragInputToNotifyWhenDone( 2116 ASSERT_TRUE(DragInputToNotifyWhenDone(
2110 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), 2117 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip),
2111 base::Bind(&DragTabToWindowInSeparateDisplayStep2, 2118 base::Bind(&DragTabToWindowInSeparateDisplayStep2,
2112 this, tab_strip, tab_strip2))); 2119 this, tab_strip, tab_strip2)));
2113 QuitWhenNotDragging(); 2120 QuitWhenNotDragging();
2114 2121
2115 // Should now be attached to tab_strip2. 2122 // Should now be attached to tab_strip2.
2116 ASSERT_TRUE(tab_strip2->IsDragSessionActive()); 2123 ASSERT_TRUE(tab_strip2->IsDragSessionActive());
2117 ASSERT_FALSE(tab_strip->IsDragSessionActive()); 2124 ASSERT_FALSE(tab_strip->IsDragSessionActive());
2118 ASSERT_TRUE(TabDragController::IsActive()); 2125 ASSERT_TRUE(TabDragController::IsActive());
2119 2126
2120 // browser2's top chrome should be revealed and the tab strip should be 2127 // browser2's top chrome should be revealed and the tab strip should be
2121 // at normal height while user is tragging tabs_strip2's tabs. 2128 // at normal height while user is tragging tabs_strip2's tabs.
2122 ASSERT_TRUE(immersive_controller2->IsRevealed()); 2129 ASSERT_TRUE(immersive_controller2->IsRevealed());
2123 ASSERT_FALSE(tab_strip2->IsImmersiveStyle()); 2130 ASSERT_FALSE(tab_strip2->IsImmersiveStyle());
2131 ASSERT_TRUE(tab_strip2->visible());
2124 2132
2125 // Release the mouse, stopping the drag session. 2133 // Release the mouse, stopping the drag session.
2126 ASSERT_TRUE(ReleaseInput()); 2134 ASSERT_TRUE(ReleaseInput());
2127 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); 2135 ASSERT_FALSE(tab_strip2->IsDragSessionActive());
2128 ASSERT_FALSE(tab_strip->IsDragSessionActive()); 2136 ASSERT_FALSE(tab_strip->IsDragSessionActive());
2129 ASSERT_FALSE(TabDragController::IsActive()); 2137 ASSERT_FALSE(TabDragController::IsActive());
2130 EXPECT_EQ("0 100", IDString(browser2->tab_strip_model())); 2138 EXPECT_EQ("0 100", IDString(browser2->tab_strip_model()));
2131 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); 2139 EXPECT_EQ("1", IDString(browser()->tab_strip_model()));
2132 2140
2133 // Move the mouse off of browser2's top chrome. 2141 // Move the mouse off of browser2's top chrome.
2134 aura::Window* primary_root = roots[0]; 2142 aura::Window* primary_root = roots[0];
2135 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync( 2143 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync(
2136 primary_root->GetBoundsInScreen().CenterPoint())); 2144 primary_root->GetBoundsInScreen().CenterPoint()));
2137 2145
2138 // The first browser window should not be in immersive fullscreen. 2146 // The first browser window should not be in immersive fullscreen.
2139 // browser2 should still be in immersive fullscreen, but the top chrome should 2147 // browser2 should still be in immersive fullscreen, but the top chrome should
2140 // no longer be revealed. 2148 // no longer be revealed.
2141 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); 2149 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser());
2142 EXPECT_FALSE(browser_view->immersive_mode_controller()->IsEnabled()); 2150 EXPECT_FALSE(browser_view->immersive_mode_controller()->IsEnabled());
2143 2151
2144 EXPECT_TRUE(immersive_controller2->IsEnabled()); 2152 EXPECT_TRUE(immersive_controller2->IsEnabled());
2145 EXPECT_FALSE(immersive_controller2->IsRevealed()); 2153 EXPECT_FALSE(immersive_controller2->IsRevealed());
2146 EXPECT_TRUE(tab_strip2->IsImmersiveStyle()); 2154 EXPECT_TRUE(tab_strip2->visible());
2155 if (!is_using_material_design)
2156 EXPECT_TRUE(tab_strip2->IsImmersiveStyle());
2147 } 2157 }
2148 2158
2149 // Subclass of DetachToBrowserTabDragControllerTest that 2159 // Subclass of DetachToBrowserTabDragControllerTest that
2150 // creates multiple displays with different device scale factors. 2160 // creates multiple displays with different device scale factors.
2151 class DifferentDeviceScaleFactorDisplayTabDragControllerTest 2161 class DifferentDeviceScaleFactorDisplayTabDragControllerTest
2152 : public DetachToBrowserTabDragControllerTest { 2162 : public DetachToBrowserTabDragControllerTest {
2153 public: 2163 public:
2154 DifferentDeviceScaleFactorDisplayTabDragControllerTest() {} 2164 DifferentDeviceScaleFactorDisplayTabDragControllerTest() {}
2155 virtual ~DifferentDeviceScaleFactorDisplayTabDragControllerTest() {} 2165 virtual ~DifferentDeviceScaleFactorDisplayTabDragControllerTest() {}
2156 2166
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
2548 DetachToBrowserTabDragControllerTest, 2558 DetachToBrowserTabDragControllerTest,
2549 ::testing::Values("mouse", "touch")); 2559 ::testing::Values("mouse", "touch"));
2550 INSTANTIATE_TEST_CASE_P(TabDragging, 2560 INSTANTIATE_TEST_CASE_P(TabDragging,
2551 DetachToBrowserTabDragControllerTestTouch, 2561 DetachToBrowserTabDragControllerTestTouch,
2552 ::testing::Values("touch")); 2562 ::testing::Values("touch"));
2553 #else 2563 #else
2554 INSTANTIATE_TEST_CASE_P(TabDragging, 2564 INSTANTIATE_TEST_CASE_P(TabDragging,
2555 DetachToBrowserTabDragControllerTest, 2565 DetachToBrowserTabDragControllerTest,
2556 ::testing::Values("mouse")); 2566 ::testing::Values("mouse"));
2557 #endif 2567 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/immersive_mode_controller_ash_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698