OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromeos/audio/cras_audio_handler.h" | 5 #include "chromeos/audio/cras_audio_handler.h" |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 245 |
246 virtual void TearDown() OVERRIDE { | 246 virtual void TearDown() OVERRIDE { |
247 cras_audio_handler_->RemoveAudioObserver(test_observer_.get()); | 247 cras_audio_handler_->RemoveAudioObserver(test_observer_.get()); |
248 test_observer_.reset(); | 248 test_observer_.reset(); |
249 CrasAudioHandler::Shutdown(); | 249 CrasAudioHandler::Shutdown(); |
250 audio_pref_handler_ = NULL; | 250 audio_pref_handler_ = NULL; |
251 DBusThreadManager::Shutdown(); | 251 DBusThreadManager::Shutdown(); |
252 } | 252 } |
253 | 253 |
254 void SetUpCrasAudioHandler(const AudioNodeList& audio_nodes) { | 254 void SetUpCrasAudioHandler(const AudioNodeList& audio_nodes) { |
255 DBusThreadManager::InitializeWithStub(); | 255 DBusThreadManager::Initialize(); |
256 cras_audio_client_stub_ = static_cast<CrasAudioClientStubImpl*>( | 256 cras_audio_client_stub_ = static_cast<CrasAudioClientStubImpl*>( |
257 DBusThreadManager::Get()->GetCrasAudioClient()); | 257 DBusThreadManager::Get()->GetCrasAudioClient()); |
258 cras_audio_client_stub_->SetAudioDevices(audio_nodes); | 258 cras_audio_client_stub_->SetAudioDevices(audio_nodes); |
259 audio_pref_handler_ = new AudioDevicesPrefHandlerStub(); | 259 audio_pref_handler_ = new AudioDevicesPrefHandlerStub(); |
260 CrasAudioHandler::Initialize(audio_pref_handler_); | 260 CrasAudioHandler::Initialize(audio_pref_handler_); |
261 cras_audio_handler_ = CrasAudioHandler::Get(); | 261 cras_audio_handler_ = CrasAudioHandler::Get(); |
262 test_observer_.reset(new TestObserver); | 262 test_observer_.reset(new TestObserver); |
263 cras_audio_handler_->AddAudioObserver(test_observer_.get()); | 263 cras_audio_handler_->AddAudioObserver(test_observer_.get()); |
264 message_loop_.RunUntilIdle(); | 264 message_loop_.RunUntilIdle(); |
265 } | 265 } |
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1711 EXPECT_TRUE(cras_audio_handler_->has_alternative_output()); | 1711 EXPECT_TRUE(cras_audio_handler_->has_alternative_output()); |
1712 | 1712 |
1713 // Ensure the internal microphone has been selected as the active input, | 1713 // Ensure the internal microphone has been selected as the active input, |
1714 // and the input device with some random unknown type is handled gracefully. | 1714 // and the input device with some random unknown type is handled gracefully. |
1715 AudioDevice active_input; | 1715 AudioDevice active_input; |
1716 EXPECT_EQ(kInternalMic.id, cras_audio_handler_->GetActiveInputNode()); | 1716 EXPECT_EQ(kInternalMic.id, cras_audio_handler_->GetActiveInputNode()); |
1717 EXPECT_TRUE(cras_audio_handler_->has_alternative_input()); | 1717 EXPECT_TRUE(cras_audio_handler_->has_alternative_input()); |
1718 } | 1718 } |
1719 | 1719 |
1720 } // namespace chromeos | 1720 } // namespace chromeos |
OLD | NEW |