| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/message_loop/message_loop_proxy.h" | 8 #include "base/message_loop/message_loop_proxy.h" |
| 9 #include "media/audio/audio_manager.h" | 9 #include "media/audio/audio_manager.h" |
| 10 #include "media/audio/audio_manager_base.h" | 10 #include "media/audio/audio_manager_base.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 const std::string& device_id, | 100 const std::string& device_id, |
| 101 const std::string& input_device_id)); | 101 const std::string& input_device_id)); |
| 102 MOCK_METHOD3(MakeAudioOutputStreamProxy, AudioOutputStream*( | 102 MOCK_METHOD3(MakeAudioOutputStreamProxy, AudioOutputStream*( |
| 103 const AudioParameters& params, | 103 const AudioParameters& params, |
| 104 const std::string& device_id, | 104 const std::string& device_id, |
| 105 const std::string& input_device_id)); | 105 const std::string& input_device_id)); |
| 106 MOCK_METHOD2(MakeAudioInputStream, AudioInputStream*( | 106 MOCK_METHOD2(MakeAudioInputStream, AudioInputStream*( |
| 107 const AudioParameters& params, const std::string& device_id)); | 107 const AudioParameters& params, const std::string& device_id)); |
| 108 MOCK_METHOD0(ShowAudioInputSettings, void()); | 108 MOCK_METHOD0(ShowAudioInputSettings, void()); |
| 109 MOCK_METHOD0(GetMessageLoop, scoped_refptr<base::MessageLoopProxy>()); | 109 MOCK_METHOD0(GetMessageLoop, scoped_refptr<base::MessageLoopProxy>()); |
| 110 MOCK_METHOD0(GetWorkerLoop, scoped_refptr<base::MessageLoopProxy>()); |
| 110 MOCK_METHOD1(GetAudioInputDeviceNames, void( | 111 MOCK_METHOD1(GetAudioInputDeviceNames, void( |
| 111 media::AudioDeviceNames* device_name)); | 112 media::AudioDeviceNames* device_name)); |
| 112 | 113 |
| 113 MOCK_METHOD1(MakeLinearOutputStream, AudioOutputStream*( | 114 MOCK_METHOD1(MakeLinearOutputStream, AudioOutputStream*( |
| 114 const AudioParameters& params)); | 115 const AudioParameters& params)); |
| 115 MOCK_METHOD3(MakeLowLatencyOutputStream, AudioOutputStream*( | 116 MOCK_METHOD3(MakeLowLatencyOutputStream, AudioOutputStream*( |
| 116 const AudioParameters& params, const std::string& device_id, | 117 const AudioParameters& params, const std::string& device_id, |
| 117 const std::string& input_device_id)); | 118 const std::string& input_device_id)); |
| 118 MOCK_METHOD2(MakeLinearInputStream, AudioInputStream*( | 119 MOCK_METHOD2(MakeLinearInputStream, AudioInputStream*( |
| 119 const AudioParameters& params, const std::string& device_id)); | 120 const AudioParameters& params, const std::string& device_id)); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 138 | 139 |
| 139 } // namespace | 140 } // namespace |
| 140 | 141 |
| 141 namespace media { | 142 namespace media { |
| 142 | 143 |
| 143 class AudioOutputProxyTest : public testing::Test { | 144 class AudioOutputProxyTest : public testing::Test { |
| 144 protected: | 145 protected: |
| 145 virtual void SetUp() { | 146 virtual void SetUp() { |
| 146 EXPECT_CALL(manager_, GetMessageLoop()) | 147 EXPECT_CALL(manager_, GetMessageLoop()) |
| 147 .WillRepeatedly(Return(message_loop_.message_loop_proxy())); | 148 .WillRepeatedly(Return(message_loop_.message_loop_proxy())); |
| 149 EXPECT_CALL(manager_, GetWorkerLoop()) |
| 150 .WillRepeatedly(Return(message_loop_.message_loop_proxy())); |
| 148 InitDispatcher(base::TimeDelta::FromMilliseconds(kTestCloseDelayMs)); | 151 InitDispatcher(base::TimeDelta::FromMilliseconds(kTestCloseDelayMs)); |
| 149 } | 152 } |
| 150 | 153 |
| 151 virtual void TearDown() { | 154 virtual void TearDown() { |
| 152 // All paused proxies should have been closed at this point. | 155 // All paused proxies should have been closed at this point. |
| 153 EXPECT_EQ(0u, dispatcher_impl_->paused_proxies_); | 156 EXPECT_EQ(0u, dispatcher_impl_->paused_proxies_); |
| 154 | 157 |
| 155 // This is necessary to free all proxy objects that have been | 158 // This is necessary to free all proxy objects that have been |
| 156 // closed by the test. | 159 // closed by the test. |
| 157 message_loop_.RunUntilIdle(); | 160 message_loop_.RunUntilIdle(); |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 WaitForCloseTimer(kTestCloseDelayMs); | 742 WaitForCloseTimer(kTestCloseDelayMs); |
| 740 EXPECT_TRUE(stream1.stop_called()); | 743 EXPECT_TRUE(stream1.stop_called()); |
| 741 EXPECT_TRUE(stream1.start_called()); | 744 EXPECT_TRUE(stream1.start_called()); |
| 742 EXPECT_TRUE(stream2.stop_called()); | 745 EXPECT_TRUE(stream2.stop_called()); |
| 743 EXPECT_TRUE(stream2.start_called()); | 746 EXPECT_TRUE(stream2.start_called()); |
| 744 EXPECT_FALSE(stream3.stop_called()); | 747 EXPECT_FALSE(stream3.stop_called()); |
| 745 EXPECT_FALSE(stream3.start_called()); | 748 EXPECT_FALSE(stream3.start_called()); |
| 746 } | 749 } |
| 747 | 750 |
| 748 } // namespace media | 751 } // namespace media |
| OLD | NEW |