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

Unified Diff: media/audio/audio_manager_factory_unittest.cc

Issue 1806313003: Pass task runners to AudioManager constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: destroy AudioManagerPulse Created 4 years, 9 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: 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..2c0cccf81010e534450e4dfac4f58d121b6e5fb3 100644
--- a/media/audio/audio_manager_factory_unittest.cc
+++ b/media/audio/audio_manager_factory_unittest.cc
@@ -5,6 +5,7 @@
#include "base/memory/scoped_ptr.h"
#include "media/audio/audio_manager.h"
#include "media/audio/audio_manager_factory.h"
+#include "media/audio/audio_thread.h"
#include "media/audio/fake_audio_log_factory.h"
#include "media/audio/fake_audio_manager.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -20,7 +21,10 @@ class FakeAudioManagerFactory : public AudioManagerFactory {
AudioManager* CreateInstance(AudioLogFactory* audio_log_factory) override {
// |created_instance_| is used for verifying. Ownership is transferred to
// caller.
- created_instance_ = new FakeAudioManager(audio_log_factory);
+ base::Thread* audio_thread = AudioThread::Get();
+ created_instance_ =
+ new FakeAudioManager(audio_thread->task_runner(),
+ audio_thread->task_runner(), audio_log_factory);
return created_instance_;
}
@@ -37,7 +41,7 @@ TEST(AudioManagerFactoryTest, CreateInstance) {
// Create an audio manager and verify that it is not null.
scoped_ptr<AudioManager> manager(AudioManager::CreateForTesting());
ASSERT_NE(nullptr, manager.get());
- manager.reset();
+ AudioManager::Destroy(manager.release());
// Set the factory. Note that ownership of |factory| is transferred to
// AudioManager.
@@ -51,8 +55,9 @@ TEST(AudioManagerFactoryTest, CreateInstance) {
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

Powered by Google App Engine
This is Rietveld 408576698