| 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
|
|
|