diff options
author | jennyz@chromium.org <jennyz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-13 17:33:12 +0000 |
---|---|---|
committer | jennyz@chromium.org <jennyz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-13 17:33:12 +0000 |
commit | 6d8c8f05dfb699ff860908602f86b7a14a2c0be1 (patch) | |
tree | 14123ded1941244e7b292bae12e9bf454cb32a19 /ash/test/ash_test_helper.cc | |
parent | bfa6ecc67b157bc3f54cbce4e37f20e9b3915cf2 (diff) | |
download | chromium_src-6d8c8f05dfb699ff860908602f86b7a14a2c0be1.zip chromium_src-6d8c8f05dfb699ff860908602f86b7a14a2c0be1.tar.gz chromium_src-6d8c8f05dfb699ff860908602f86b7a14a2c0be1.tar.bz2 |
Initialize CrasAudioHandler for testing in ash_unittests and ash_shell startup cases.
BUG=237513
R=jamescook@chromium.org, xiyuan@chromium.org
Review URL: https://codereview.chromium.org/14757010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@199757 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/test/ash_test_helper.cc')
-rw-r--r-- | ash/test/ash_test_helper.cc | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/ash/test/ash_test_helper.cc b/ash/test/ash_test_helper.cc index c95fe28..6392f3a 100644 --- a/ash/test/ash_test_helper.cc +++ b/ash/test/ash_test_helper.cc @@ -9,17 +9,19 @@ #include "ash/test/display_manager_test_api.h" #include "ash/test/shell_test_api.h" #include "ash/test/test_shell_delegate.h" -#include "base/command_line.h" #include "base/run_loop.h" #include "ui/aura/env.h" #include "ui/base/ime/text_input_test_support.h" #include "ui/compositor/scoped_animation_duration_scale_mode.h" - #if defined(ENABLE_MESSAGE_CENTER) #include "ui/message_center/message_center.h" #endif +#if defined(OS_CHROMEOS) +#include "chromeos/audio/cras_audio_handler.h" +#endif + namespace ash { namespace test { @@ -33,10 +35,6 @@ AshTestHelper::~AshTestHelper() { } void AshTestHelper::SetUp() { - // TODO(jennyz): Create mock or test AudioHandler so we can instantiate - // an ash::Shell with the new CrasAudioHandler. crbug.com/233266 - CommandLine::ForCurrentProcess()->AppendSwitch( - ash::switches::kAshDisableNewAudioHandler); // Disable animations during tests. zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); @@ -50,6 +48,15 @@ void AshTestHelper::SetUp() { // tests. message_center::MessageCenter::Initialize(); #endif + +#if defined(OS_CHROMEOS) + if (ash::switches::UseNewAudioHandler()) { + // Create CrasAuidoHandler for testing since g_browser_process is not + // created in AshTestBase tests. + chromeos::CrasAudioHandler::InitializeForTesting(); + } +#endif + ash::Shell::CreateInstance(test_shell_delegate_); Shell* shell = Shell::GetInstance(); test::DisplayManagerTestApi(shell->display_manager()). @@ -67,6 +74,11 @@ void AshTestHelper::TearDown() { message_center::MessageCenter::Shutdown(); #endif +#if defined(OS_CHROMEOS) + if (ash::switches::UseNewAudioHandler()) + chromeos::CrasAudioHandler::Shutdown(); +#endif + aura::Env::DeleteInstance(); ui::TextInputTestSupport::Shutdown(); |