| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/sync_socket.h" | 9 #include "base/sync_socket.h" |
| 10 #include "content/browser/media/capture/audio_mirroring_manager.h" | 10 #include "content/browser/media/capture/audio_mirroring_manager.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 using ::testing::_; | 25 using ::testing::_; |
| 26 using ::testing::Assign; | 26 using ::testing::Assign; |
| 27 using ::testing::DoAll; | 27 using ::testing::DoAll; |
| 28 using ::testing::NotNull; | 28 using ::testing::NotNull; |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 const int kRenderProcessId = 1; | 31 const int kRenderProcessId = 1; |
| 32 const int kRenderFrameId = 5; | 32 const int kRenderFrameId = 5; |
| 33 const int kStreamId = 50; | 33 const int kStreamId = 50; |
| 34 const int kBadStreamId = 99; | 34 const int kBadStreamId = 99; |
| 35 const int kSwitchOutputDeviceRequestId = 1; | |
| 36 const GURL kSecurityOrigin("http://localhost"); | 35 const GURL kSecurityOrigin("http://localhost"); |
| 37 const std::string kDefaultDeviceID = ""; | 36 const GURL kDefaultSecurityOrigin; |
| 37 const std::string kDefaultDeviceID; |
| 38 const std::string kBadDeviceID = "bad-device-id"; | 38 const std::string kBadDeviceID = "bad-device-id"; |
| 39 } // namespace | 39 } // namespace |
| 40 | 40 |
| 41 namespace content { | 41 namespace content { |
| 42 | 42 |
| 43 class MockAudioMirroringManager : public AudioMirroringManager { | 43 class MockAudioMirroringManager : public AudioMirroringManager { |
| 44 public: | 44 public: |
| 45 MockAudioMirroringManager() {} | 45 MockAudioMirroringManager() {} |
| 46 virtual ~MockAudioMirroringManager() {} | 46 virtual ~MockAudioMirroringManager() {} |
| 47 | 47 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 64 const ResourceContext::SaltCallback& salt_callback) | 64 const ResourceContext::SaltCallback& salt_callback) |
| 65 : AudioRendererHost(kRenderProcessId, | 65 : AudioRendererHost(kRenderProcessId, |
| 66 audio_manager, | 66 audio_manager, |
| 67 mirroring_manager, | 67 mirroring_manager, |
| 68 media_internals, | 68 media_internals, |
| 69 media_stream_manager, | 69 media_stream_manager, |
| 70 salt_callback), | 70 salt_callback), |
| 71 shared_memory_length_(0) {} | 71 shared_memory_length_(0) {} |
| 72 | 72 |
| 73 // A list of mock methods. | 73 // A list of mock methods. |
| 74 MOCK_METHOD3(OnDeviceAuthorized, |
| 75 void(int stream_id, |
| 76 bool success, |
| 77 const media::AudioParameters& output_params)); |
| 74 MOCK_METHOD2(OnStreamCreated, void(int stream_id, int length)); | 78 MOCK_METHOD2(OnStreamCreated, void(int stream_id, int length)); |
| 75 MOCK_METHOD1(OnStreamPlaying, void(int stream_id)); | 79 MOCK_METHOD1(OnStreamPlaying, void(int stream_id)); |
| 76 MOCK_METHOD1(OnStreamPaused, void(int stream_id)); | 80 MOCK_METHOD1(OnStreamPaused, void(int stream_id)); |
| 77 MOCK_METHOD1(OnStreamError, void(int stream_id)); | 81 MOCK_METHOD1(OnStreamError, void(int stream_id)); |
| 78 MOCK_METHOD3(OnOutputDeviceSwitched, | 82 MOCK_METHOD3(OnOutputDeviceSwitched, |
| 79 void(int stream_id, | 83 void(int stream_id, |
| 80 int request_id, | 84 media::SwitchOutputDeviceResult result, |
| 81 media::SwitchOutputDeviceResult result)); | 85 const media::AudioParameters& output_params)); |
| 82 | 86 |
| 83 private: | 87 private: |
| 84 virtual ~MockAudioRendererHost() { | 88 virtual ~MockAudioRendererHost() { |
| 85 // Make sure all audio streams have been deleted. | 89 // Make sure all audio streams have been deleted. |
| 86 EXPECT_TRUE(audio_entries_.empty()); | 90 EXPECT_TRUE(audio_entries_.empty()); |
| 87 } | 91 } |
| 88 | 92 |
| 89 // This method is used to dispatch IPC messages to the renderer. We intercept | 93 // This method is used to dispatch IPC messages to the renderer. We intercept |
| 90 // these messages here and dispatch to our mock methods to verify the | 94 // these messages here and dispatch to our mock methods to verify the |
| 91 // conversation between this object and the renderer. | 95 // conversation between this object and the renderer. |
| 92 virtual bool Send(IPC::Message* message) { | 96 virtual bool Send(IPC::Message* message) { |
| 93 CHECK(message); | 97 CHECK(message); |
| 94 | 98 |
| 95 // In this method we dispatch the messages to the according handlers as if | 99 // In this method we dispatch the messages to the according handlers as if |
| 96 // we are the renderer. | 100 // we are the renderer. |
| 97 bool handled = true; | 101 bool handled = true; |
| 98 IPC_BEGIN_MESSAGE_MAP(MockAudioRendererHost, *message) | 102 IPC_BEGIN_MESSAGE_MAP(MockAudioRendererHost, *message) |
| 103 IPC_MESSAGE_HANDLER(AudioMsg_NotifyDeviceAuthorized, |
| 104 OnNotifyDeviceAuthorized) |
| 99 IPC_MESSAGE_HANDLER(AudioMsg_NotifyStreamCreated, | 105 IPC_MESSAGE_HANDLER(AudioMsg_NotifyStreamCreated, |
| 100 OnNotifyStreamCreated) | 106 OnNotifyStreamCreated) |
| 101 IPC_MESSAGE_HANDLER(AudioMsg_NotifyStreamStateChanged, | 107 IPC_MESSAGE_HANDLER(AudioMsg_NotifyStreamStateChanged, |
| 102 OnNotifyStreamStateChanged) | 108 OnNotifyStreamStateChanged) |
| 103 IPC_MESSAGE_HANDLER(AudioMsg_NotifyOutputDeviceSwitched, | 109 IPC_MESSAGE_HANDLER(AudioMsg_NotifyOutputDeviceSwitched, |
| 104 OnNotifyOutputDeviceSwitched) | 110 OnNotifyOutputDeviceSwitched) |
| 105 IPC_MESSAGE_UNHANDLED(handled = false) | 111 IPC_MESSAGE_UNHANDLED(handled = false) |
| 106 IPC_END_MESSAGE_MAP() | 112 IPC_END_MESSAGE_MAP() |
| 107 EXPECT_TRUE(handled); | 113 EXPECT_TRUE(handled); |
| 108 | 114 |
| 109 delete message; | 115 delete message; |
| 110 return true; | 116 return true; |
| 111 } | 117 } |
| 112 | 118 |
| 119 void OnNotifyDeviceAuthorized(int stream_id, |
| 120 bool success, |
| 121 const media::AudioParameters& output_params) { |
| 122 OnDeviceAuthorized(stream_id, success, output_params); |
| 123 } |
| 124 |
| 113 void OnNotifyStreamCreated( | 125 void OnNotifyStreamCreated( |
| 114 int stream_id, base::SharedMemoryHandle handle, | 126 int stream_id, base::SharedMemoryHandle handle, |
| 115 base::SyncSocket::TransitDescriptor socket_descriptor, uint32 length) { | 127 base::SyncSocket::TransitDescriptor socket_descriptor, uint32 length) { |
| 116 // Maps the shared memory. | 128 // Maps the shared memory. |
| 117 shared_memory_.reset(new base::SharedMemory(handle, false)); | 129 shared_memory_.reset(new base::SharedMemory(handle, false)); |
| 118 CHECK(shared_memory_->Map(length)); | 130 CHECK(shared_memory_->Map(length)); |
| 119 CHECK(shared_memory_->memory()); | 131 CHECK(shared_memory_->memory()); |
| 120 shared_memory_length_ = length; | 132 shared_memory_length_ = length; |
| 121 | 133 |
| 122 // Create the SyncSocket using the handle. | 134 // Create the SyncSocket using the handle. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 140 case media::AUDIO_OUTPUT_IPC_DELEGATE_STATE_ERROR: | 152 case media::AUDIO_OUTPUT_IPC_DELEGATE_STATE_ERROR: |
| 141 OnStreamError(stream_id); | 153 OnStreamError(stream_id); |
| 142 break; | 154 break; |
| 143 default: | 155 default: |
| 144 FAIL() << "Unknown stream state"; | 156 FAIL() << "Unknown stream state"; |
| 145 break; | 157 break; |
| 146 } | 158 } |
| 147 } | 159 } |
| 148 | 160 |
| 149 void OnNotifyOutputDeviceSwitched(int stream_id, | 161 void OnNotifyOutputDeviceSwitched(int stream_id, |
| 150 int request_id, | 162 media::SwitchOutputDeviceResult result, |
| 151 media::SwitchOutputDeviceResult result) { | 163 const media::AudioParameters& params) { |
| 152 switch (result) { | 164 switch (result) { |
| 153 case media::SWITCH_OUTPUT_DEVICE_RESULT_SUCCESS: | 165 case media::SWITCH_OUTPUT_DEVICE_RESULT_SUCCESS: |
| 154 case media::SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_FOUND: | 166 case media::SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_FOUND: |
| 155 case media::SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_AUTHORIZED: | 167 case media::SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_AUTHORIZED: |
| 156 case media::SWITCH_OUTPUT_DEVICE_RESULT_ERROR_OBSOLETE: | 168 case media::SWITCH_OUTPUT_DEVICE_RESULT_ERROR_INTERNAL: |
| 157 case media::SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_SUPPORTED: | 169 OnOutputDeviceSwitched(stream_id, result, params); |
| 158 OnOutputDeviceSwitched(stream_id, request_id, result); | |
| 159 break; | 170 break; |
| 160 default: | 171 default: |
| 161 FAIL() << "Unknown SwitchOutputDevice result"; | 172 FAIL() << "Unknown SwitchOutputDevice result"; |
| 162 break; | 173 break; |
| 163 } | 174 } |
| 164 } | 175 } |
| 165 | 176 |
| 166 scoped_ptr<base::SharedMemory> shared_memory_; | 177 scoped_ptr<base::SharedMemory> shared_memory_; |
| 167 scoped_ptr<base::SyncSocket> sync_socket_; | 178 scoped_ptr<base::SyncSocket> sync_socket_; |
| 168 uint32 shared_memory_length_; | 179 uint32 shared_memory_length_; |
| 169 | 180 |
| 170 DISALLOW_COPY_AND_ASSIGN(MockAudioRendererHost); | 181 DISALLOW_COPY_AND_ASSIGN(MockAudioRendererHost); |
| 171 }; | 182 }; |
| 172 | 183 |
| 173 namespace { | 184 namespace { |
| 174 std::string ReturnMockSalt() { | 185 std::string ReturnMockSalt() { |
| 175 return std::string(); | 186 return std::string(); |
| 176 } | 187 } |
| 177 | 188 |
| 178 ResourceContext::SaltCallback GetMockSaltCallback() { | 189 ResourceContext::SaltCallback GetMockSaltCallback() { |
| 179 return base::Bind(&ReturnMockSalt); | 190 return base::Bind(&ReturnMockSalt); |
| 180 } | 191 } |
| 192 |
| 193 void WaitForEnumeration(base::RunLoop* loop, |
| 194 const AudioOutputDeviceEnumeration& e) { |
| 195 loop->Quit(); |
| 181 } | 196 } |
| 197 } // namespace |
| 182 | 198 |
| 183 class AudioRendererHostTest : public testing::Test { | 199 class AudioRendererHostTest : public testing::Test { |
| 184 public: | 200 public: |
| 185 AudioRendererHostTest() { | 201 AudioRendererHostTest() { |
| 186 audio_manager_.reset(media::AudioManager::CreateForTesting()); | 202 audio_manager_.reset(media::AudioManager::CreateForTesting()); |
| 187 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 203 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 188 switches::kUseFakeDeviceForMediaStream); | 204 switches::kUseFakeDeviceForMediaStream); |
| 189 media_stream_manager_.reset(new MediaStreamManager(audio_manager_.get())); | 205 media_stream_manager_.reset(new MediaStreamManager(audio_manager_.get())); |
| 206 |
| 207 // Enable caching to make enumerations run in a single thread |
| 208 media_stream_manager_->audio_output_device_enumerator()->SetCachePolicy( |
| 209 AudioOutputDeviceEnumerator::CACHE_POLICY_MANUAL_INVALIDATION); |
| 210 base::RunLoop().RunUntilIdle(); |
| 211 base::RunLoop run_loop; |
| 212 media_stream_manager_->audio_output_device_enumerator()->Enumerate( |
| 213 base::Bind(&WaitForEnumeration, &run_loop)); |
| 214 run_loop.Run(); |
| 215 |
| 190 host_ = new MockAudioRendererHost(audio_manager_.get(), &mirroring_manager_, | 216 host_ = new MockAudioRendererHost(audio_manager_.get(), &mirroring_manager_, |
| 191 MediaInternals::GetInstance(), | 217 MediaInternals::GetInstance(), |
| 192 media_stream_manager_.get(), | 218 media_stream_manager_.get(), |
| 193 GetMockSaltCallback()); | 219 GetMockSaltCallback()); |
| 194 | 220 |
| 195 // Simulate IPC channel connected. | 221 // Simulate IPC channel connected. |
| 196 host_->set_peer_process_for_testing(base::Process::Current()); | 222 host_->set_peer_process_for_testing(base::Process::Current()); |
| 197 } | 223 } |
| 198 | 224 |
| 199 ~AudioRendererHostTest() override { | 225 ~AudioRendererHostTest() override { |
| 200 // Simulate closing the IPC channel and give the audio thread time to close | 226 // Simulate closing the IPC channel and give the audio thread time to close |
| 201 // the underlying streams. | 227 // the underlying streams. |
| 202 host_->OnChannelClosing(); | 228 host_->OnChannelClosing(); |
| 203 SyncWithAudioThread(); | 229 SyncWithAudioThread(); |
| 204 | 230 |
| 205 // Release the reference to the mock object. The object will be destructed | 231 // Release the reference to the mock object. The object will be destructed |
| 206 // on message_loop_. | 232 // on message_loop_. |
| 207 host_ = NULL; | 233 host_ = NULL; |
| 208 } | 234 } |
| 209 | 235 |
| 210 protected: | 236 protected: |
| 211 void Create(bool unified_stream) { | 237 void Create(bool unified_stream) { |
| 238 EXPECT_CALL(*host_.get(), OnDeviceAuthorized(kStreamId, true, _)); |
| 212 EXPECT_CALL(*host_.get(), OnStreamCreated(kStreamId, _)); | 239 EXPECT_CALL(*host_.get(), OnStreamCreated(kStreamId, _)); |
| 213 | 240 |
| 214 EXPECT_CALL(mirroring_manager_, | 241 EXPECT_CALL(mirroring_manager_, |
| 215 AddDiverter(kRenderProcessId, kRenderFrameId, NotNull())) | 242 AddDiverter(kRenderProcessId, kRenderFrameId, NotNull())) |
| 216 .RetiresOnSaturation(); | 243 .RetiresOnSaturation(); |
| 217 | 244 |
| 218 // Send a create stream message to the audio output stream and wait until | 245 // Send a create stream message to the audio output stream and wait until |
| 219 // we receive the created message. | 246 // we receive the created message. |
| 220 int session_id; | 247 int session_id; |
| 221 media::AudioParameters params; | 248 media::AudioParameters params; |
| 222 if (unified_stream) { | 249 if (unified_stream) { |
| 223 // Use AudioInputDeviceManager::kFakeOpenSessionId as the session id to | 250 // Use AudioInputDeviceManager::kFakeOpenSessionId as the session id to |
| 224 // pass the permission check. | 251 // pass the permission check. |
| 225 session_id = AudioInputDeviceManager::kFakeOpenSessionId; | 252 session_id = AudioInputDeviceManager::kFakeOpenSessionId; |
| 226 params = media::AudioParameters( | 253 params = media::AudioParameters( |
| 227 media::AudioParameters::AUDIO_FAKE, | 254 media::AudioParameters::AUDIO_FAKE, |
| 228 media::CHANNEL_LAYOUT_STEREO, | 255 media::CHANNEL_LAYOUT_STEREO, |
| 229 media::AudioParameters::kAudioCDSampleRate, 16, | 256 media::AudioParameters::kAudioCDSampleRate, 16, |
| 230 media::AudioParameters::kAudioCDSampleRate / 10, | 257 media::AudioParameters::kAudioCDSampleRate / 10, |
| 231 media::AudioParameters::NO_EFFECTS); | 258 media::AudioParameters::NO_EFFECTS); |
| 232 } else { | 259 } else { |
| 233 session_id = 0; | 260 session_id = 0; |
| 234 params = media::AudioParameters( | 261 params = media::AudioParameters( |
| 235 media::AudioParameters::AUDIO_FAKE, | 262 media::AudioParameters::AUDIO_FAKE, |
| 236 media::CHANNEL_LAYOUT_STEREO, | 263 media::CHANNEL_LAYOUT_STEREO, |
| 237 media::AudioParameters::kAudioCDSampleRate, 16, | 264 media::AudioParameters::kAudioCDSampleRate, 16, |
| 238 media::AudioParameters::kAudioCDSampleRate / 10); | 265 media::AudioParameters::kAudioCDSampleRate / 10); |
| 239 } | 266 } |
| 240 host_->OnCreateStream(kStreamId, kRenderFrameId, session_id, params); | 267 host_->OnRequestDeviceAuthorization(kStreamId, kRenderFrameId, session_id, |
| 268 kDefaultDeviceID, |
| 269 kDefaultSecurityOrigin); |
| 270 host_->OnCreateStream(kStreamId, kRenderFrameId, params); |
| 241 | 271 |
| 242 // At some point in the future, a corresponding RemoveDiverter() call must | 272 // At some point in the future, a corresponding RemoveDiverter() call must |
| 243 // be made. | 273 // be made. |
| 244 EXPECT_CALL(mirroring_manager_, RemoveDiverter(NotNull())) | 274 EXPECT_CALL(mirroring_manager_, RemoveDiverter(NotNull())) |
| 245 .RetiresOnSaturation(); | 275 .RetiresOnSaturation(); |
| 246 SyncWithAudioThread(); | 276 SyncWithAudioThread(); |
| 247 } | 277 } |
| 248 | 278 |
| 249 void Close() { | 279 void Close() { |
| 250 // Send a message to AudioRendererHost to tell it we want to close the | 280 // Send a message to AudioRendererHost to tell it we want to close the |
| (...skipping 13 matching lines...) Expand all Loading... |
| 264 host_->OnPauseStream(kStreamId); | 294 host_->OnPauseStream(kStreamId); |
| 265 SyncWithAudioThread(); | 295 SyncWithAudioThread(); |
| 266 } | 296 } |
| 267 | 297 |
| 268 void SetVolume(double volume) { | 298 void SetVolume(double volume) { |
| 269 host_->OnSetVolume(kStreamId, volume); | 299 host_->OnSetVolume(kStreamId, volume); |
| 270 SyncWithAudioThread(); | 300 SyncWithAudioThread(); |
| 271 } | 301 } |
| 272 | 302 |
| 273 void SwitchOutputDevice(int stream_id, | 303 void SwitchOutputDevice(int stream_id, |
| 274 std::string device_id, | 304 const std::string& device_id, |
| 305 const GURL& security_origin, |
| 275 media::SwitchOutputDeviceResult expected_result) { | 306 media::SwitchOutputDeviceResult expected_result) { |
| 276 EXPECT_CALL(*host_.get(), | 307 EXPECT_CALL(*host_.get(), |
| 277 OnOutputDeviceSwitched(stream_id, kSwitchOutputDeviceRequestId, | 308 OnOutputDeviceSwitched(stream_id, expected_result, _)); |
| 278 expected_result)); | |
| 279 host_->OnSwitchOutputDevice(stream_id, kRenderFrameId, device_id, | 309 host_->OnSwitchOutputDevice(stream_id, kRenderFrameId, device_id, |
| 280 kSecurityOrigin, kSwitchOutputDeviceRequestId); | 310 security_origin); |
| 281 SyncWithAudioThread(); | 311 SyncWithAudioThread(); |
| 282 } | 312 } |
| 283 | 313 |
| 284 void SimulateError() { | 314 void SimulateError() { |
| 285 EXPECT_EQ(1u, host_->audio_entries_.size()) | 315 EXPECT_EQ(1u, host_->audio_entries_.size()) |
| 286 << "Calls Create() before calling this method"; | 316 << "Calls Create() before calling this method"; |
| 287 | 317 |
| 288 // Expect an error signal sent through IPC. | 318 // Expect an error signal sent through IPC. |
| 289 EXPECT_CALL(*host_.get(), OnStreamError(kStreamId)); | 319 EXPECT_CALL(*host_.get(), OnStreamError(kStreamId)); |
| 290 | 320 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 TEST_F(AudioRendererHostTest, SetVolume) { | 377 TEST_F(AudioRendererHostTest, SetVolume) { |
| 348 Create(false); | 378 Create(false); |
| 349 SetVolume(0.5); | 379 SetVolume(0.5); |
| 350 Play(); | 380 Play(); |
| 351 Pause(); | 381 Pause(); |
| 352 Close(); | 382 Close(); |
| 353 } | 383 } |
| 354 | 384 |
| 355 TEST_F(AudioRendererHostTest, SwitchOutputDevice) { | 385 TEST_F(AudioRendererHostTest, SwitchOutputDevice) { |
| 356 Create(false); | 386 Create(false); |
| 357 SwitchOutputDevice(kStreamId, kDefaultDeviceID, | 387 SwitchOutputDevice(kStreamId, kDefaultDeviceID, kDefaultSecurityOrigin, |
| 358 media::SWITCH_OUTPUT_DEVICE_RESULT_SUCCESS); | 388 media::SWITCH_OUTPUT_DEVICE_RESULT_SUCCESS); |
| 359 Close(); | 389 Close(); |
| 360 } | 390 } |
| 361 | 391 |
| 362 TEST_F(AudioRendererHostTest, SwitchOutputDeviceNotAuthorized) { | 392 TEST_F(AudioRendererHostTest, SwitchOutputDeviceNotAuthorized) { |
| 363 Create(false); | 393 Create(false); |
| 364 SwitchOutputDevice(kStreamId, kBadDeviceID, | 394 SwitchOutputDevice(kStreamId, kBadDeviceID, kSecurityOrigin, |
| 365 media::SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_AUTHORIZED); | 395 media::SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_AUTHORIZED); |
| 366 Close(); | 396 Close(); |
| 367 } | 397 } |
| 368 | 398 |
| 369 TEST_F(AudioRendererHostTest, SwitchOutputDeviceNoStream) { | 399 TEST_F(AudioRendererHostTest, SwitchOutputDeviceNoStream) { |
| 370 Create(false); | 400 Create(false); |
| 371 SwitchOutputDevice(kBadStreamId, kDefaultDeviceID, | 401 SwitchOutputDevice(kBadStreamId, kDefaultDeviceID, kDefaultSecurityOrigin, |
| 372 media::SWITCH_OUTPUT_DEVICE_RESULT_ERROR_OBSOLETE); | 402 media::SWITCH_OUTPUT_DEVICE_RESULT_ERROR_INTERNAL); |
| 373 Close(); | 403 Close(); |
| 374 } | 404 } |
| 375 | 405 |
| 376 // Simulate the case where a stream is not properly closed. | 406 // Simulate the case where a stream is not properly closed. |
| 377 TEST_F(AudioRendererHostTest, CreatePlayAndShutdown) { | 407 TEST_F(AudioRendererHostTest, CreatePlayAndShutdown) { |
| 378 Create(false); | 408 Create(false); |
| 379 Play(); | 409 Play(); |
| 380 } | 410 } |
| 381 | 411 |
| 382 // Simulate the case where a stream is not properly closed. | 412 // Simulate the case where a stream is not properly closed. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 403 } | 433 } |
| 404 | 434 |
| 405 TEST_F(AudioRendererHostTest, CreateUnifiedStreamAndClose) { | 435 TEST_F(AudioRendererHostTest, CreateUnifiedStreamAndClose) { |
| 406 Create(true); | 436 Create(true); |
| 407 Close(); | 437 Close(); |
| 408 } | 438 } |
| 409 | 439 |
| 410 // TODO(hclam): Add tests for data conversation in low latency mode. | 440 // TODO(hclam): Add tests for data conversation in low latency mode. |
| 411 | 441 |
| 412 } // namespace content | 442 } // namespace content |
| OLD | NEW |