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..edbd2761c56b4f8d433cf2e6ecd32cd2c75aa006 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" |
| @@ -126,18 +127,29 @@ TEST_F(ImmersiveModeControllerAshTest, Layout) { |
| 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()); |
| + // In MD, tab strip and tool bar are both hidden in immersive fullscreen mode; |
|
tdanderson
2016/07/19 21:10:24
Suggested rewording of entire comment: "For MD, th
yiyix
2016/07/20 06:03:08
Done.
|
| + // whereas the tab strip are are shown in non-MD. |
| + if (ash::MaterialDesignController::IsShelfMaterial()) { |
| + EXPECT_FALSE(tabstrip->visible()); |
| + EXPECT_FALSE(toolbar->visible()); |
| + } else { |
| + EXPECT_TRUE(tabstrip->visible()); |
| + EXPECT_TRUE(tabstrip->IsImmersiveStyle()); |
|
tdanderson
2016/07/19 21:10:24
I'd move this to line 131 assuming it is true in b
yiyix
2016/07/20 06:03:08
Done.
|
| + EXPECT_FALSE(toolbar->visible()); |
| + } |
| // 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 |
| + // mode, the web connents should extend to the edge of screen. In non-MD, the |
|
tdanderson
2016/07/19 21:10:24
connents->contents
yiyix
2016/07/20 06:03:08
I was careless. Thanks.
|
| + // web contents should be immediately below the tab indicators. |
| + if (ash::MaterialDesignController::IsShelfMaterial()) { |
|
tdanderson
2016/07/19 21:10:23
nit: consider using a local variable const bool md
yiyix
2016/07/20 06:03:08
Done.
|
| + 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()) { |
| + 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 |
| + // ShouldHideTabIndicators() always return true. |
|
tdanderson
2016/07/19 21:10:24
Omit this comment, and instead replace with expect
|
| 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 |