Index: chromecast/media/audio/cast_audio_manager_factory_test.cc |
diff --git a/chromecast/media/audio/cast_audio_manager_factory_test.cc b/chromecast/media/audio/cast_audio_manager_factory_test.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..10ffb981341195f81af94066e9479b3562ecaf96 |
--- /dev/null |
+++ b/chromecast/media/audio/cast_audio_manager_factory_test.cc |
@@ -0,0 +1,34 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chromecast/media/audio/cast_audio_manager.h" |
+#include "chromecast/media/audio/cast_audio_manager_factory.h" |
+#include "chromecast/public/cast_media_shlib.h" |
+#include "chromecast/public/media/cast_audio_output_device.h" |
+#include "media/audio/audio_manager.h" |
+#include "testing/gtest/include/gtest/gtest.h" |
+ |
+namespace chromecast { |
+namespace media { |
+ |
+// This is a very simple test which verifies that setting a |
+// CastAudioManagerFactory will delegate calls on AudioManager and |
+// AudioOutputStream to to the CastMediaShlib layer. Testing the behavior of |
+// each call in the AudioManager implementation itself shall occur elsewhere. |
+TEST(CastAudioManagerFactoryTest, AudioOutputDeviceIsUsed) { |
+ ::media::AudioManager::SetFactory(new CastAudioManagerFactory()); |
+ ::media::AudioManager* manager = ::media::AudioManager::CreateForTesting(); |
+ ASSERT_TRUE(manager); |
+ |
+ // Check that the correct AudioManager is being used, and that the underlying |
+ // delegate is the CastMediaShlib object. |
+ const CastAudioOutputDevice* output_device = |
+ CastMediaShlib::GetAudioOutputDevice(); |
+ ASSERT_TRUE(output_device); |
+ CastAudioManager* cast_manager = reinterpret_cast<CastAudioManager*>(manager); |
+ EXPECT_EQ(cast_manager->GetAudioOutputDeviceForTesting(), output_device); |
+} |
+ |
+} // namespace media |
+} // namespace chromecast |