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

Unified Diff: media/audio/mac/audio_device_listener_mac_unittest.cc

Issue 11344005: Handle audio device changes on Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: locking Created 8 years, 2 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/mac/audio_device_listener_mac_unittest.cc
diff --git a/media/audio/mac/audio_device_listener_mac_unittest.cc b/media/audio/mac/audio_device_listener_mac_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7eefadd20106b874f5196ea0148eb5f8eb503f64
--- /dev/null
+++ b/media/audio/mac/audio_device_listener_mac_unittest.cc
@@ -0,0 +1,42 @@
+// Copyright (c) 2012 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 <string>
+
+#include "base/bind.h"
+#include "media/audio/mac/audio_device_listener_mac.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace media {
+
+class AudioDeviceListenerMacTest : public testing::Test {
+ public:
+ AudioDeviceListenerMacTest() {
+ }
+
+ virtual void SetUp() {
+ output_device_listener_.reset(new AudioDeviceListenerMac(base::Bind(
+ &AudioDeviceListenerMacTest::OnDeviceChange, base::Unretained(this))));
+ }
+
+ void SimulateDefaultOutputDeviceChange() {
+ output_device_listener_->OnDefaultDeviceChanged();
+ }
+
+ MOCK_METHOD0(OnDeviceChange, void());
+
+ private:
+ scoped_ptr<AudioDeviceListenerMac> output_device_listener_;
+
+ DISALLOW_COPY_AND_ASSIGN(AudioDeviceListenerMacTest);
+};
+
+// Simulate a device change event and ensure we get the right callback.
+TEST_F(AudioDeviceListenerMacTest, OutputDeviceChange) {
+ EXPECT_CALL(*this, OnDeviceChange()).Times(1);
+ SimulateDefaultOutputDeviceChange();
+}
+
+} // namespace media

Powered by Google App Engine
This is Rietveld 408576698