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: modify test coverage, but it is a disabled test Created 3 years, 11 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
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
11 #include "ash/common/material_design/material_design_controller.h"
sky 2017/01/18 16:40:45 Move to USE_ASH ifdef below.
Qiang(Joe) Xu 2017/01/20 17:36:24 Done.
11 #include "base/bind.h" 12 #include "base/bind.h"
12 #include "base/bind_helpers.h" 13 #include "base/bind_helpers.h"
13 #include "base/callback.h" 14 #include "base/callback.h"
14 #include "base/callback_helpers.h" 15 #include "base/callback_helpers.h"
15 #include "base/command_line.h" 16 #include "base/command_line.h"
16 #include "base/location.h" 17 #include "base/location.h"
17 #include "base/macros.h" 18 #include "base/macros.h"
18 #include "base/memory/ptr_util.h" 19 #include "base/memory/ptr_util.h"
19 #include "base/run_loop.h" 20 #include "base/run_loop.h"
20 #include "base/single_thread_task_runner.h" 21 #include "base/single_thread_task_runner.h"
(...skipping 2070 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 hidden in immersive
2103 // fullscreen mode.
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 bool is_using_material_design =
2107 ash::MaterialDesignController::IsImmersiveModeMaterial();
2108 if (is_using_material_design) {
sky 2017/01/17 18:07:01 Is this test run in both md and non-md?
Qiang(Joe) Xu 2017/01/18 01:13:52 I don't know.. Do you mean it may not actually run
sky 2017/01/18 16:40:45 You have two code paths here, one md and one non-m
yiyix 2017/01/18 20:41:50 I think the test is running with the default value
Qiang(Joe) Xu 2017/01/20 17:36:24 It seems is_using_material_deisn is exercised righ
Qiang(Joe) Xu 2017/01/20 17:36:24 I think "immersive fullscreen" means "immersive un
2109 ASSERT_FALSE(tab_strip2->visible());
2110 } else {
2111 ASSERT_TRUE(tab_strip2->visible());
2112 ASSERT_TRUE(tab_strip2->IsImmersiveStyle());
2113 }
2104 2114
2105 // Move to the first tab and drag it enough so that it detaches, but not 2115 // Move to the first tab and drag it enough so that it detaches, but not
2106 // enough that it attaches to browser2. 2116 // enough that it attaches to browser2.
2107 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); 2117 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0)));
2108 ASSERT_TRUE(PressInput(tab_0_center)); 2118 ASSERT_TRUE(PressInput(tab_0_center));
2109 ASSERT_TRUE(DragInputToNotifyWhenDone( 2119 ASSERT_TRUE(DragInputToNotifyWhenDone(
2110 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), 2120 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip),
2111 base::Bind(&DragTabToWindowInSeparateDisplayStep2, 2121 base::Bind(&DragTabToWindowInSeparateDisplayStep2,
2112 this, tab_strip, tab_strip2))); 2122 this, tab_strip, tab_strip2)));
2113 QuitWhenNotDragging(); 2123 QuitWhenNotDragging();
2114 2124
2115 // Should now be attached to tab_strip2. 2125 // Should now be attached to tab_strip2.
2116 ASSERT_TRUE(tab_strip2->IsDragSessionActive()); 2126 ASSERT_TRUE(tab_strip2->IsDragSessionActive());
2117 ASSERT_FALSE(tab_strip->IsDragSessionActive()); 2127 ASSERT_FALSE(tab_strip->IsDragSessionActive());
2118 ASSERT_TRUE(TabDragController::IsActive()); 2128 ASSERT_TRUE(TabDragController::IsActive());
2119 2129
2120 // browser2's top chrome should be revealed and the tab strip should be 2130 // 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. 2131 // at normal height while user is tragging tabs_strip2's tabs.
2122 ASSERT_TRUE(immersive_controller2->IsRevealed()); 2132 ASSERT_TRUE(immersive_controller2->IsRevealed());
2123 ASSERT_FALSE(tab_strip2->IsImmersiveStyle()); 2133 ASSERT_FALSE(tab_strip2->IsImmersiveStyle());
2134 ASSERT_TRUE(tab_strip2->visible());
2124 2135
2125 // Release the mouse, stopping the drag session. 2136 // Release the mouse, stopping the drag session.
2126 ASSERT_TRUE(ReleaseInput()); 2137 ASSERT_TRUE(ReleaseInput());
2127 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); 2138 ASSERT_FALSE(tab_strip2->IsDragSessionActive());
2128 ASSERT_FALSE(tab_strip->IsDragSessionActive()); 2139 ASSERT_FALSE(tab_strip->IsDragSessionActive());
2129 ASSERT_FALSE(TabDragController::IsActive()); 2140 ASSERT_FALSE(TabDragController::IsActive());
2130 EXPECT_EQ("0 100", IDString(browser2->tab_strip_model())); 2141 EXPECT_EQ("0 100", IDString(browser2->tab_strip_model()));
2131 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); 2142 EXPECT_EQ("1", IDString(browser()->tab_strip_model()));
2132 2143
2133 // Move the mouse off of browser2's top chrome. 2144 // Move the mouse off of browser2's top chrome.
2134 aura::Window* primary_root = roots[0]; 2145 aura::Window* primary_root = roots[0];
2135 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync( 2146 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync(
2136 primary_root->GetBoundsInScreen().CenterPoint())); 2147 primary_root->GetBoundsInScreen().CenterPoint()));
2137 2148
2138 // The first browser window should not be in immersive fullscreen. 2149 // The first browser window should not be in immersive fullscreen.
2139 // browser2 should still be in immersive fullscreen, but the top chrome should 2150 // browser2 should still be in immersive fullscreen, but the top chrome should
2140 // no longer be revealed. 2151 // no longer be revealed.
2141 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); 2152 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser());
2142 EXPECT_FALSE(browser_view->immersive_mode_controller()->IsEnabled()); 2153 EXPECT_FALSE(browser_view->immersive_mode_controller()->IsEnabled());
2143 2154
2144 EXPECT_TRUE(immersive_controller2->IsEnabled()); 2155 EXPECT_TRUE(immersive_controller2->IsEnabled());
2145 EXPECT_FALSE(immersive_controller2->IsRevealed()); 2156 EXPECT_FALSE(immersive_controller2->IsRevealed());
2146 EXPECT_TRUE(tab_strip2->IsImmersiveStyle()); 2157 if (is_using_material_design) {
2158 EXPECT_FALSE(tab_strip2->visible());
2159 } else {
2160 EXPECT_TRUE(tab_strip2->visible());
2161 EXPECT_TRUE(tab_strip2->IsImmersiveStyle());
2162 }
2147 } 2163 }
2148 2164
2149 // Subclass of DetachToBrowserTabDragControllerTest that 2165 // Subclass of DetachToBrowserTabDragControllerTest that
2150 // creates multiple displays with different device scale factors. 2166 // creates multiple displays with different device scale factors.
2151 class DifferentDeviceScaleFactorDisplayTabDragControllerTest 2167 class DifferentDeviceScaleFactorDisplayTabDragControllerTest
2152 : public DetachToBrowserTabDragControllerTest { 2168 : public DetachToBrowserTabDragControllerTest {
2153 public: 2169 public:
2154 DifferentDeviceScaleFactorDisplayTabDragControllerTest() {} 2170 DifferentDeviceScaleFactorDisplayTabDragControllerTest() {}
2155 virtual ~DifferentDeviceScaleFactorDisplayTabDragControllerTest() {} 2171 virtual ~DifferentDeviceScaleFactorDisplayTabDragControllerTest() {}
2156 2172
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
2548 DetachToBrowserTabDragControllerTest, 2564 DetachToBrowserTabDragControllerTest,
2549 ::testing::Values("mouse", "touch")); 2565 ::testing::Values("mouse", "touch"));
2550 INSTANTIATE_TEST_CASE_P(TabDragging, 2566 INSTANTIATE_TEST_CASE_P(TabDragging,
2551 DetachToBrowserTabDragControllerTestTouch, 2567 DetachToBrowserTabDragControllerTestTouch,
2552 ::testing::Values("touch")); 2568 ::testing::Values("touch"));
2553 #else 2569 #else
2554 INSTANTIATE_TEST_CASE_P(TabDragging, 2570 INSTANTIATE_TEST_CASE_P(TabDragging,
2555 DetachToBrowserTabDragControllerTest, 2571 DetachToBrowserTabDragControllerTest,
2556 ::testing::Values("mouse")); 2572 ::testing::Values("mouse"));
2557 #endif 2573 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698