Chromium Code Reviews| Index: chrome/browser/ui/views/frame/immersive_mode_controller_ash_unittest.cc |
| diff --git a/chrome/browser/ui/views/frame/immersive_mode_controller_ash_unittest.cc b/chrome/browser/ui/views/frame/immersive_mode_controller_ash_unittest.cc |
| index 47b90161e3e225ffcd1bbb4b8ac0ea33f2e984fc..5c1e10fcc86c3fed57f629f85a2f040df3a48498 100644 |
| --- a/chrome/browser/ui/views/frame/immersive_mode_controller_ash_unittest.cc |
| +++ b/chrome/browser/ui/views/frame/immersive_mode_controller_ash_unittest.cc |
| @@ -5,6 +5,7 @@ |
| #include "chrome/browser/ui/views/frame/immersive_mode_controller_ash.h" |
| #include "ash/common/ash_switches.h" |
| +#include "ash/common/material_design/material_design_controller.h" |
| #include "ash/common/shelf/shelf_types.h" |
| #include "ash/root_window_controller.h" |
| #include "ash/shelf/shelf_layout_manager.h" |
| @@ -125,19 +126,30 @@ TEST_F(ImmersiveModeControllerAshTest, Layout) { |
| EXPECT_TRUE(browser_view()->GetWidget()->IsFullscreen()); |
| EXPECT_TRUE(controller()->IsEnabled()); |
| EXPECT_FALSE(controller()->IsRevealed()); |
| - |
| - // Entering immersive fullscreen should make the tab strip use the immersive |
| - // style and hide the toolbar. |
| - EXPECT_TRUE(tabstrip->visible()); |
| - EXPECT_TRUE(tabstrip->IsImmersiveStyle()); |
| EXPECT_FALSE(toolbar->visible()); |
| + // For MD, the browser's top chrome is completely hidden in immersive |
| + // fullscreen mode. |
| + bool is_using_material_design = |
| + ash::MaterialDesignController::IsShelfMaterial(); |
| + if (is_using_material_design) { |
|
msw
2016/07/20 20:06:51
Should this check tabstrip->IsImmersiveStyle in MD
yiyix
2016/07/21 18:32:36
As we stopped showing tab indicator hints in MD in
|
| + EXPECT_FALSE(tabstrip->visible()); |
| + } else { |
| + EXPECT_TRUE(tabstrip->visible()); |
| + EXPECT_TRUE(tabstrip->IsImmersiveStyle()); |
| + } |
| // The tab indicators should be flush with the top of the widget. |
| EXPECT_EQ(0, GetBoundsInWidget(tabstrip).y()); |
| - // The web contents should be immediately below the tab indicators. |
| - EXPECT_EQ(Tab::GetImmersiveHeight(), |
| - GetBoundsInWidget(contents_web_view).y()); |
| + // In MD, since tab strip and tool bar are both hidden in immersive fullscreen |
|
msw
2016/07/20 20:06:51
nit: 'the tab strip'
yiyix
2016/07/21 18:32:36
Done.
|
| + // mode, the web contents should extend to the edge of screen. In non-MD, the |
| + // web contents should be immediately below the tab indicators. |
| + if (is_using_material_design) { |
| + EXPECT_EQ(0, GetBoundsInWidget(contents_web_view).y()); |
| + } else { |
| + EXPECT_EQ(Tab::GetImmersiveHeight(), |
| + GetBoundsInWidget(contents_web_view).y()); |
| + } |
| // Revealing the top-of-window views should set the tab strip back to the |
| // normal style and show the toolbar. |
| @@ -154,8 +166,12 @@ TEST_F(ImmersiveModeControllerAshTest, Layout) { |
| // The web contents should be at the same y position as they were when the |
| // top-of-window views were hidden. |
| - EXPECT_EQ(Tab::GetImmersiveHeight(), |
| - GetBoundsInWidget(contents_web_view).y()); |
| + if (ash::MaterialDesignController::IsShelfMaterial()) { |
|
msw
2016/07/20 20:06:51
nit: use |is_using_material_design| here too. (or
yiyix
2016/07/21 18:32:36
Done.
|
| + EXPECT_EQ(0, GetBoundsInWidget(contents_web_view).y()); |
| + } else { |
| + EXPECT_EQ(Tab::GetImmersiveHeight(), |
| + GetBoundsInWidget(contents_web_view).y()); |
| + } |
| // Repeat the test for when in both immersive fullscreen and tab fullscreen. |
| SetTabFullscreen(true); |
| @@ -236,22 +252,27 @@ TEST_F(ImmersiveModeControllerAshTest, TabAndBrowserFullscreen) { |
| // 1) Test that entering tab fullscreen from immersive fullscreen hides the |
| // tab indicators and the shelf. |
| + // Note that tab indicators hints are removed from MD, so function |
|
msw
2016/07/20 20:06:50
nit: "indicators are", "so ShouldHideTabIndicators
yiyix
2016/07/21 18:32:36
Done.
Thank you for carefully reading my comments.
|
| + // ShouldHideTabIndicators() always return true. |
| ToggleFullscreen(); |
| ASSERT_TRUE(controller()->IsEnabled()); |
| EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); |
| - EXPECT_FALSE(controller()->ShouldHideTabIndicators()); |
| + if (!ash::MaterialDesignController::IsShelfMaterial()) |
| + EXPECT_FALSE(controller()->ShouldHideTabIndicators()); |
| SetTabFullscreen(true); |
| ASSERT_TRUE(controller()->IsEnabled()); |
| EXPECT_EQ(ash::SHELF_HIDDEN, shelf->visibility_state()); |
| - EXPECT_TRUE(controller()->ShouldHideTabIndicators()); |
| + if (!ash::MaterialDesignController::IsShelfMaterial()) |
| + EXPECT_TRUE(controller()->ShouldHideTabIndicators()); |
| // 2) Test that exiting tab fullscreen shows the tab indicators and autohides |
| // the shelf. |
| SetTabFullscreen(false); |
| ASSERT_TRUE(controller()->IsEnabled()); |
| EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); |
| - EXPECT_FALSE(controller()->ShouldHideTabIndicators()); |
| + if (!ash::MaterialDesignController::IsShelfMaterial()) |
| + EXPECT_FALSE(controller()->ShouldHideTabIndicators()); |
| // 3) Test that exiting tab fullscreen and immersive fullscreen |
| // simultaneously correctly updates the shelf visibility and whether the tab |
| @@ -260,7 +281,8 @@ TEST_F(ImmersiveModeControllerAshTest, TabAndBrowserFullscreen) { |
| ToggleFullscreen(); |
| ASSERT_FALSE(controller()->IsEnabled()); |
| EXPECT_EQ(ash::SHELF_VISIBLE, shelf->visibility_state()); |
| - EXPECT_TRUE(controller()->ShouldHideTabIndicators()); |
| + if (!ash::MaterialDesignController::IsShelfMaterial()) |
| + EXPECT_TRUE(controller()->ShouldHideTabIndicators()); |
| } |
| // Ensure the circular tab-loading throbbers are not painted as layers in |