Commit 22800d9f authored by Evan Stade's avatar Evan Stade Committed by Commit Bot

Fix BrowserNonClientFrameViewAshTest.ToggleTabletModeOnMinimizedWindow

5d480c70 broke this test because it moved the code
that sets the icons from //chrome/ into //ash/. These targets
duplicate //ash/public/vector_icons (when using the component build),
so it's not valid to directly compare icon addresses. Compare by
identifier (name) instead.

Bug: 704942,836992
Change-Id: I47a916a265c976afb61058be569283623d773c10
Reviewed-on: https://chromium-review.googlesource.com/1050379
Commit-Queue: Evan Stade <estade@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#556960}
parent cdf1be68
......@@ -74,6 +74,7 @@
#include "ui/events/base_event_utils.h"
#include "ui/events/event.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/vector_icon_types.h"
#include "ui/views/widget/widget.h"
#include "ui/wm/core/window_util.h"
......@@ -426,25 +427,30 @@ IN_PROC_BROWSER_TEST_P(BrowserNonClientFrameViewAshTest,
ash::FrameCaptionButtonContainerView::TestApi test(
frame_view->caption_button_container_);
widget->Maximize();
// Restore icon for size button in maximized window state.
EXPECT_EQ(&ash::kWindowControlRestoreIcon,
test.size_button()->icon_definition_for_test());
// 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_EQ(*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.
TabletModeClient::Get()->OnTabletModeToggled(true);
EXPECT_EQ(&ash::kWindowControlRestoreIcon,
test.size_button()->icon_definition_for_test());
EXPECT_EQ(*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.
TabletModeClient::Get()->OnTabletModeToggled(false);
EXPECT_EQ(&ash::kWindowControlRestoreIcon,
test.size_button()->icon_definition_for_test());
EXPECT_EQ(*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_EQ(&ash::kWindowControlRestoreIcon,
test.size_button()->icon_definition_for_test());
EXPECT_EQ(*ash::kWindowControlRestoreIcon.name,
*test.size_button()->icon_definition_for_test()->name);
}
// This is a regression test that session restore minimized browser should
......
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