Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2295)

Unified Diff: ash/test/ash_test_helper.cc

Issue 2186363002: Set Ash material design mode in tests properly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed compile errors after rebase Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/test/ash_test_helper.cc
diff --git a/ash/test/ash_test_helper.cc b/ash/test/ash_test_helper.cc
index dcc98bcae89c811fe64c64145c3f088583714a83..53ce9edd0f2731e053eaf58e9eb4640259c61a01 100644
--- a/ash/test/ash_test_helper.cc
+++ b/ash/test/ash_test_helper.cc
@@ -7,8 +7,6 @@
#include "ash/accelerators/accelerator_controller_delegate_aura.h"
#include "ash/common/ash_switches.h"
#include "ash/common/display/display_info.h"
-#include "ash/common/material_design/material_design_controller.h"
-#include "ash/common/test/material_design_controller_test_api.h"
#include "ash/common/wm_shell.h"
#include "ash/shell.h"
#include "ash/shell_init_params.h"
@@ -71,7 +69,8 @@ AshTestHelper::AshTestHelper(base::MessageLoopForUI* message_loop)
AshTestHelper::~AshTestHelper() {}
-void AshTestHelper::SetUp(bool start_session) {
+void AshTestHelper::SetUp(bool start_session,
+ MaterialDesignController::Mode material_mode) {
ResetDisplayIdForTest();
views_delegate_.reset(new AshTestViewsDelegate);
@@ -127,6 +126,12 @@ void AshTestHelper::SetUp(bool start_session) {
ui::test::MaterialDesignControllerTestAPI::Uninitialize();
ui::MaterialDesignController::Initialize();
ash::MaterialDesignController::Initialize();
+ // If |material_mode| is not set, use the value from command line switches.
tdanderson 2016/07/29 15:16:50 I think it would be better to have this documented
mohsen 2016/07/29 18:05:19 Right. Done.
+ if (material_mode == MaterialDesignController::Mode::UNINITIALIZED)
+ material_mode = MaterialDesignController::GetMode();
+ material_design_state_.reset(
+ new test::MaterialDesignControllerTestAPI(material_mode));
+
ShellInitParams init_params;
init_params.delegate = test_shell_delegate_;
init_params.context_factory = context_factory;
@@ -152,6 +157,7 @@ void AshTestHelper::SetUp(bool start_session) {
void AshTestHelper::TearDown() {
// Tear down the shell.
Shell::DeleteInstance();
+ material_design_state_.reset();
test::MaterialDesignControllerTestAPI::Uninitialize();
ShellContentState::DestroyInstance();

Powered by Google App Engine
This is Rietveld 408576698