| Index: media/audio/audio_manager_factory_unittest.cc
|
| diff --git a/media/audio/audio_manager_factory_unittest.cc b/media/audio/audio_manager_factory_unittest.cc
|
| index 1d13c2e0269751ce48c34b9ad754823f0145a42f..099cb1cdedea0b6bb7640e79e68f94f40f87e0fb 100644
|
| --- a/media/audio/audio_manager_factory_unittest.cc
|
| +++ b/media/audio/audio_manager_factory_unittest.cc
|
| @@ -3,6 +3,7 @@
|
| // found in the LICENSE file.
|
|
|
| #include "base/memory/scoped_ptr.h"
|
| +#include "base/message_loop/message_loop.h"
|
| #include "media/audio/audio_manager.h"
|
| #include "media/audio/audio_manager_factory.h"
|
| #include "media/audio/fake_audio_log_factory.h"
|
| @@ -17,10 +18,14 @@ class FakeAudioManagerFactory : public AudioManagerFactory {
|
| FakeAudioManagerFactory() {}
|
| ~FakeAudioManagerFactory() override {}
|
|
|
| - AudioManager* CreateInstance(AudioLogFactory* audio_log_factory) override {
|
| + AudioManager* CreateInstance(
|
| + const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
|
| + const scoped_refptr<base::SingleThreadTaskRunner>& worker_task_runner,
|
| + AudioLogFactory* audio_log_factory) override {
|
| // |created_instance_| is used for verifying. Ownership is transferred to
|
| // caller.
|
| - created_instance_ = new FakeAudioManager(audio_log_factory);
|
| + created_instance_ = new FakeAudioManager(task_runner, worker_task_runner,
|
| + audio_log_factory);
|
| return created_instance_;
|
| }
|
|
|
| @@ -34,10 +39,14 @@ class FakeAudioManagerFactory : public AudioManagerFactory {
|
|
|
| // Verifies that SetFactory has the intended effect.
|
| TEST(AudioManagerFactoryTest, CreateInstance) {
|
| + FakeAudioLogFactory fake_audio_log_factory;
|
| + base::MessageLoop message_loop;
|
| // Create an audio manager and verify that it is not null.
|
| - scoped_ptr<AudioManager> manager(AudioManager::CreateForTesting());
|
| + scoped_ptr<AudioManager> manager(AudioManager::Create(
|
| + message_loop.task_runner(), message_loop.task_runner(), nullptr,
|
| + &fake_audio_log_factory));
|
| ASSERT_NE(nullptr, manager.get());
|
| - manager.reset();
|
| + AudioManager::Destroy(manager.release());
|
|
|
| // Set the factory. Note that ownership of |factory| is transferred to
|
| // AudioManager.
|
| @@ -46,13 +55,16 @@ TEST(AudioManagerFactoryTest, CreateInstance) {
|
|
|
| // Create the AudioManager instance. Verify that it matches the instance
|
| // provided by the factory.
|
| - manager.reset(AudioManager::CreateForTesting());
|
| + manager.reset(AudioManager::Create(message_loop.task_runner(),
|
| + message_loop.task_runner(), nullptr,
|
| + &fake_audio_log_factory));
|
| ASSERT_NE(nullptr, manager.get());
|
| ASSERT_EQ(factory->created_instance(), manager.get());
|
|
|
| // Reset AudioManagerFactory to prevent factory from persisting to other
|
| - // tests on the same process. |manager| will reset when scope exits.
|
| + // tests on the same process.
|
| AudioManager::ResetFactoryForTesting();
|
| + AudioManager::Destroy(manager.release());
|
| }
|
|
|
| } // namespace media
|
|
|