Commit d30a6822 authored by Evan Stade's avatar Evan Stade Committed by Commit Bot

Ash: Port two browser frame tests to Ash.

One of them lives on in browser because the Ash version trips a dcheck
when run in classic Ash mode.

Bug: 854704
Change-Id: I7822cc088c255b8c16c91cb1b5304c5e2b974115
Reviewed-on: https://chromium-review.googlesource.com/1170127
Commit-Queue: Evan Stade <estade@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#582333}
parent dfcd02b9
......@@ -132,7 +132,7 @@ class ASH_EXPORT NonClientFrameViewAsh : public views::NonClientFrameView,
private:
class OverlayView;
friend class NonClientFrameViewAshSizeLock;
friend class CustomFrameTestWidgetDelegate;
friend class NonClientFrameViewAshTestWidgetDelegate;
friend class TestWidgetConstraintsDelegate;
// views::NonClientFrameView:
......
......@@ -87,7 +87,6 @@
#include "ui/gfx/vector_icon_types.h"
#include "ui/views/focus/focus_manager.h"
#include "ui/views/widget/widget.h"
#include "ui/wm/core/window_util.h"
namespace {
......@@ -388,10 +387,13 @@ IN_PROC_BROWSER_TEST_P(BrowserNonClientFrameViewAshTest,
// Tests that FrameCaptionButtonContainer has been relaid out in response to
// tablet mode being toggled.
// TODO(estade): Implement this behavior in OopAsh (test by checking the
// window's caption button bounds).
IN_PROC_BROWSER_TEST_P(BrowserNonClientFrameViewAshTest,
ToggleTabletModeRelayout) {
// For OopAsh, this test is covered by
// CustomFrameViewAshTest.ToggleTabletModeRelayout.
if (!features::IsAshInBrowserProcess())
return;
BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser());
BrowserNonClientFrameViewAsh* frame_view = GetFrameViewAsh(browser_view);
......@@ -440,45 +442,6 @@ IN_PROC_BROWSER_TEST_P(BrowserNonClientFrameViewAshTest,
EXPECT_EQ(*min_window_size, frame_view->GetMinimumSize());
}
// Tests that when browser frame is minimized, toggling tablet mode doesn't
// trigger caption button update (https://crbug.com/822890).
IN_PROC_BROWSER_TEST_P(BrowserNonClientFrameViewAshTest,
ToggleTabletModeOnMinimizedWindow) {
BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser());
Widget* widget = browser_view->GetWidget();
BrowserNonClientFrameViewAsh* frame_view = GetFrameViewAsh(browser_view);
ash::FrameCaptionButtonContainerView::TestApi test(
frame_view->caption_button_container_);
widget->Maximize();
// Restore icon for size button in maximized window state. Compare by name
// because the address may not be the same for different build targets in the
// component build.
EXPECT_STREQ(ash::kWindowControlRestoreIcon.name,
test.size_button()->icon_definition_for_test()->name);
widget->Minimize();
// When entering tablet mode in minimized window state, size button should not
// get updated.
ash::Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager(
true);
EXPECT_STREQ(ash::kWindowControlRestoreIcon.name,
test.size_button()->icon_definition_for_test()->name);
// When leaving tablet mode in minimized window state, size button should not
// get updated.
ash::Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager(
false);
EXPECT_STREQ(ash::kWindowControlRestoreIcon.name,
test.size_button()->icon_definition_for_test()->name);
// When unminimizing in non-tablet mode, size button should match with
// maximized window state, which is restore icon.
::wm::Unminimize(widget->GetNativeWindow());
EXPECT_STREQ(ash::kWindowControlRestoreIcon.name,
test.size_button()->icon_definition_for_test()->name);
}
// This is a regression test that session restore minimized browser should
// re-layout the header (https://crbug.com/827444).
IN_PROC_BROWSER_TEST_P(BrowserNonClientFrameViewAshTest,
......
......@@ -39,8 +39,6 @@
-BrowserNonClientFrameViewAshTest.AvatarDisplayOnTeleportedWindow/*
-BrowserNonClientFrameViewAshTest.HeaderHeightForSnappedBrowserInSplitView/*
-BrowserNonClientFrameViewAshTest.ImmersiveModeTopViewInset/*
-BrowserNonClientFrameViewAshTest.ToggleTabletModeOnMinimizedWindow/*
-BrowserNonClientFrameViewAshTest.ToggleTabletModeRelayout/*
-BrowserNonClientFrameViewAshTest.TopViewInset/*
# Direct access to ash window frames, tablet mode, overview mode, etc.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment