Commit b540add3 authored by Peter Boström's avatar Peter Boström Committed by Commit Bot

Set MD mode before initializing window in test

Prevents DCHECK failure when turning on MD Refresh by default in tests
ToolbarActionsBarUnitTest.TestHighlightMode/{0,1}. This was due to an
inconsistent MD mode in the test as the browser window gets constructed
and initialized with the default mode before it's overridden with
ToolbarActionsBarUnitTest::GetParam().

Bug: chromium:846410
Change-Id: Id1fc1a0137d27cb4be7c5ddc32f2a2c9c203e117
Reviewed-on: https://chromium-review.googlesource.com/1102992
Commit-Queue: Peter Boström <pbos@chromium.org>
Reviewed-by: default avatarBret Sepulveda <bsep@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568193}
parent fb3f6d7e
......@@ -148,6 +148,10 @@ ToolbarActionsBarUnitTest::ToolbarActionsBarUnitTest()
ToolbarActionsBarUnitTest::~ToolbarActionsBarUnitTest() {}
void ToolbarActionsBarUnitTest::SetUp() {
// Overriding MD state needs to be done before setting up the test window to
// maintain consistency throughout its lifetime.
material_design_state_ =
std::make_unique<ui::test::MaterialDesignControllerTestAPI>(GetParam());
BrowserWithTestWindowTest::SetUp();
extensions::LoadErrorReporter::Init(false);
......@@ -164,8 +168,6 @@ void ToolbarActionsBarUnitTest::SetUp() {
extensions::extension_action_test_util::CreateToolbarModelForProfile(
profile());
material_design_state_.reset(
new ui::test::MaterialDesignControllerTestAPI(GetParam()));
ToolbarActionsBar::disable_animations_for_testing_ = true;
browser_action_test_util_ = BrowserActionTestUtil::Create(browser(), false);
......@@ -179,8 +181,8 @@ void ToolbarActionsBarUnitTest::TearDown() {
browser_action_test_util_.reset();
overflow_browser_action_test_util_.reset();
ToolbarActionsBar::disable_animations_for_testing_ = false;
material_design_state_.reset();
BrowserWithTestWindowTest::TearDown();
material_design_state_.reset();
}
void ToolbarActionsBarUnitTest::ActivateTab(int index) {
......
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