Chromium Code Reviews| 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/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "content/renderer/media/media_stream.h" | 7 #include "content/renderer/media/media_stream.h" |
| 8 #include "content/renderer/media/media_stream_impl.h" | 8 #include "content/renderer/media/media_stream_impl.h" |
| 9 #include "content/renderer/media/media_stream_track.h" | |
| 9 #include "content/renderer/media/mock_media_stream_dependency_factory.h" | 10 #include "content/renderer/media/mock_media_stream_dependency_factory.h" |
| 10 #include "content/renderer/media/mock_media_stream_dispatcher.h" | 11 #include "content/renderer/media/mock_media_stream_dispatcher.h" |
| 11 #include "content/renderer/media/mock_media_stream_video_source.h" | 12 #include "content/renderer/media/mock_media_stream_video_source.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "third_party/WebKit/public/platform/WebMediaStream.h" | 14 #include "third_party/WebKit/public/platform/WebMediaStream.h" |
| 14 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" | 15 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" |
| 15 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 16 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
| 16 #include "third_party/WebKit/public/platform/WebString.h" | 17 #include "third_party/WebKit/public/platform/WebString.h" |
| 17 #include "third_party/WebKit/public/platform/WebVector.h" | 18 #include "third_party/WebKit/public/platform/WebVector.h" |
| 18 | 19 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 36 REQUEST_NOT_STARTED, | 37 REQUEST_NOT_STARTED, |
| 37 REQUEST_NOT_COMPLETE, | 38 REQUEST_NOT_COMPLETE, |
| 38 REQUEST_SUCCEEDED, | 39 REQUEST_SUCCEEDED, |
| 39 REQUEST_FAILED, | 40 REQUEST_FAILED, |
| 40 }; | 41 }; |
| 41 | 42 |
| 42 MediaStreamImplUnderTest(MediaStreamDispatcher* media_stream_dispatcher, | 43 MediaStreamImplUnderTest(MediaStreamDispatcher* media_stream_dispatcher, |
| 43 MediaStreamDependencyFactory* dependency_factory) | 44 MediaStreamDependencyFactory* dependency_factory) |
| 44 : MediaStreamImpl(NULL, media_stream_dispatcher, dependency_factory), | 45 : MediaStreamImpl(NULL, media_stream_dispatcher, dependency_factory), |
| 45 state_(REQUEST_NOT_STARTED), | 46 state_(REQUEST_NOT_STARTED), |
| 47 result_(NUM_MEDIA_REQUEST_RESULTS), | |
| 46 factory_(dependency_factory), | 48 factory_(dependency_factory), |
| 47 video_source_(NULL) { | 49 video_source_(NULL) { |
| 48 } | 50 } |
| 49 | 51 |
| 50 void RequestUserMedia() { | 52 void RequestUserMedia() { |
| 51 blink::WebUserMediaRequest user_media_request; | 53 blink::WebUserMediaRequest user_media_request; |
| 52 state_ = REQUEST_NOT_COMPLETE; | 54 state_ = REQUEST_NOT_COMPLETE; |
| 53 requestUserMedia(user_media_request); | 55 requestUserMedia(user_media_request); |
| 54 } | 56 } |
| 55 | 57 |
| 56 virtual void CompleteGetUserMediaRequest( | 58 virtual void GetUserMediaRequestSucceeded( |
| 57 const blink::WebMediaStream& stream, | 59 const blink::WebMediaStream& stream, |
| 58 blink::WebUserMediaRequest* request_info, | 60 blink::WebUserMediaRequest* request_info) OVERRIDE { |
| 59 content::MediaStreamRequestResult result) OVERRIDE { | |
| 60 last_generated_stream_ = stream; | 61 last_generated_stream_ = stream; |
| 61 result_ = result; | 62 state_ = REQUEST_SUCCEEDED; |
| 62 state_ = (result == MEDIA_DEVICE_OK ? REQUEST_SUCCEEDED : REQUEST_FAILED); | |
| 63 } | 63 } |
| 64 | 64 |
| 65 virtual blink::WebMediaStream GetMediaStream( | 65 virtual void GetUserMediaRequestFailed( |
| 66 const GURL& url) OVERRIDE { | 66 blink::WebUserMediaRequest* request_info, |
|
tommi (sloooow) - chröme
2014/04/03 08:53:16
fix indent
perkj_chrome
2014/04/03 11:58:34
Done.
| |
| 67 return last_generated_stream_; | 67 content::MediaStreamRequestResult result) OVERRIDE { |
| 68 last_generated_stream_.reset(); | |
| 69 state_ = REQUEST_FAILED; | |
|
tommi (sloooow) - chröme
2014/04/03 08:53:16
fix spacing
perkj_chrome
2014/04/03 11:58:34
Done.
| |
| 70 result_ = result; | |
| 68 } | 71 } |
| 69 | 72 |
| 70 virtual MediaStreamVideoSource* CreateVideoSource( | 73 virtual MediaStreamVideoSource* CreateVideoSource( |
| 71 const StreamDeviceInfo& device, | 74 const StreamDeviceInfo& device, |
| 72 const MediaStreamSource::SourceStoppedCallback& stop_callback) OVERRIDE { | 75 const MediaStreamSource::SourceStoppedCallback& stop_callback) OVERRIDE { |
| 73 video_source_ = new MockMediaStreamVideoCapturerSource(device, | 76 video_source_ = new MockMediaStreamVideoCapturerSource(device, |
| 74 stop_callback, | 77 stop_callback, |
| 75 factory_); | 78 factory_); |
| 76 return video_source_; | 79 return video_source_; |
| 77 } | 80 } |
| 78 | 81 |
| 79 using MediaStreamImpl::OnLocalMediaStreamStop; | |
| 80 using MediaStreamImpl::OnLocalSourceStopped; | 82 using MediaStreamImpl::OnLocalSourceStopped; |
| 81 | 83 |
| 82 const blink::WebMediaStream& last_generated_stream() { | 84 const blink::WebMediaStream& last_generated_stream() { |
| 83 return last_generated_stream_; | 85 return last_generated_stream_; |
| 84 } | 86 } |
| 85 | 87 |
| 88 void ClearLastGeneratedStream() { | |
| 89 last_generated_stream_.reset(); | |
| 90 } | |
| 91 | |
| 86 MockMediaStreamVideoCapturerSource* last_created_video_source() const { | 92 MockMediaStreamVideoCapturerSource* last_created_video_source() const { |
| 87 return video_source_; | 93 return video_source_; |
| 88 } | 94 } |
| 89 | 95 |
| 90 RequestState request_state() const { return state_; } | 96 RequestState request_state() const { return state_; } |
| 91 content::MediaStreamRequestResult error_reason() const { return result_; } | 97 content::MediaStreamRequestResult error_reason() const { return result_; } |
| 92 | 98 |
| 93 private: | 99 private: |
| 94 blink::WebMediaStream last_generated_stream_; | 100 blink::WebMediaStream last_generated_stream_; |
| 95 RequestState state_; | 101 RequestState state_; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 217 desc1.audioTracks(desc1_audio_tracks); | 223 desc1.audioTracks(desc1_audio_tracks); |
| 218 blink::WebVector<blink::WebMediaStreamTrack> desc2_audio_tracks; | 224 blink::WebVector<blink::WebMediaStreamTrack> desc2_audio_tracks; |
| 219 desc2.audioTracks(desc2_audio_tracks); | 225 desc2.audioTracks(desc2_audio_tracks); |
| 220 EXPECT_NE(desc1_audio_tracks[0].source().id(), | 226 EXPECT_NE(desc1_audio_tracks[0].source().id(), |
| 221 desc2_audio_tracks[0].source().id()); | 227 desc2_audio_tracks[0].source().id()); |
| 222 | 228 |
| 223 EXPECT_NE(desc1_audio_tracks[0].source().extraData(), | 229 EXPECT_NE(desc1_audio_tracks[0].source().extraData(), |
| 224 desc2_audio_tracks[0].source().extraData()); | 230 desc2_audio_tracks[0].source().extraData()); |
| 225 } | 231 } |
| 226 | 232 |
| 227 TEST_F(MediaStreamImplTest, StopLocalMediaStream) { | 233 TEST_F(MediaStreamImplTest, StopLocalTracks) { |
| 228 // Generate a stream with both audio and video. | 234 // Generate a stream with both audio and video. |
| 229 blink::WebMediaStream mixed_desc = RequestLocalMediaStream(); | 235 blink::WebMediaStream mixed_desc = RequestLocalMediaStream(); |
| 230 | 236 |
| 231 // Stop generated local streams. | 237 blink::WebVector<blink::WebMediaStreamTrack> audio_tracks; |
| 232 ms_impl_->OnLocalMediaStreamStop(mixed_desc.id().utf8()); | 238 mixed_desc.audioTracks(audio_tracks); |
| 239 MediaStreamTrack* audio_track = MediaStreamTrack::GetTrack(audio_tracks[0]); | |
| 240 audio_track->StopTrack(); | |
| 233 EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter()); | 241 EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter()); |
| 242 | |
| 243 blink::WebVector<blink::WebMediaStreamTrack> video_tracks; | |
| 244 mixed_desc.videoTracks(video_tracks); | |
| 245 MediaStreamTrack* video_track = MediaStreamTrack::GetTrack(video_tracks[0]); | |
| 246 video_track->StopTrack(); | |
| 234 EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter()); | 247 EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter()); |
| 235 } | 248 } |
| 236 | 249 |
| 237 // This test that a source is not stopped even if the MediaStream is stopped if | 250 // This test that a source is not stopped even if the tracks in a |
| 238 // there are two MediaStreams using the same device. The source is stopped | 251 // MediaStream is stopped if there are two MediaStreams with tracks using the |
| 239 // if there are no more MediaStreams using the device. | 252 // same device. The source is stopped |
| 240 TEST_F(MediaStreamImplTest, StopLocalMediaStreamWhenTwoStreamUseSameDevices) { | 253 // if there are no more MediaStream tracks using the device. |
| 254 TEST_F(MediaStreamImplTest, StopLocalTracksWhenTwoStreamUseSameDevices) { | |
| 241 // Generate a stream with both audio and video. | 255 // Generate a stream with both audio and video. |
| 242 blink::WebMediaStream desc1 = RequestLocalMediaStream(); | 256 blink::WebMediaStream desc1 = RequestLocalMediaStream(); |
| 243 blink::WebMediaStream desc2 = RequestLocalMediaStream(); | 257 blink::WebMediaStream desc2 = RequestLocalMediaStream(); |
| 244 | 258 |
| 245 ms_impl_->OnLocalMediaStreamStop(desc2.id().utf8()); | 259 blink::WebVector<blink::WebMediaStreamTrack> audio_tracks1; |
| 260 desc1.audioTracks(audio_tracks1); | |
| 261 MediaStreamTrack* audio_track1 = MediaStreamTrack::GetTrack(audio_tracks1[0]); | |
| 262 audio_track1->StopTrack(); | |
| 246 EXPECT_EQ(0, ms_dispatcher_->stop_audio_device_counter()); | 263 EXPECT_EQ(0, ms_dispatcher_->stop_audio_device_counter()); |
| 264 | |
| 265 blink::WebVector<blink::WebMediaStreamTrack> audio_tracks2; | |
| 266 desc2.audioTracks(audio_tracks2); | |
| 267 MediaStreamTrack* audio_track2 = MediaStreamTrack::GetTrack(audio_tracks2[0]); | |
| 268 audio_track2->StopTrack(); | |
| 269 EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter()); | |
| 270 | |
| 271 blink::WebVector<blink::WebMediaStreamTrack> video_tracks1; | |
| 272 desc1.videoTracks(video_tracks1); | |
| 273 MediaStreamTrack* video_track1 = MediaStreamTrack::GetTrack(video_tracks1[0]); | |
| 274 video_track1->StopTrack(); | |
| 247 EXPECT_EQ(0, ms_dispatcher_->stop_video_device_counter()); | 275 EXPECT_EQ(0, ms_dispatcher_->stop_video_device_counter()); |
| 248 | 276 |
| 249 ms_impl_->OnLocalMediaStreamStop(desc1.id().utf8()); | 277 blink::WebVector<blink::WebMediaStreamTrack> video_tracks2; |
| 278 desc2.videoTracks(video_tracks2); | |
| 279 MediaStreamTrack* video_track2 = MediaStreamTrack::GetTrack(video_tracks2[0]); | |
| 280 video_track2->StopTrack(); | |
| 281 EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter()); | |
| 282 } | |
| 283 | |
| 284 TEST_F(MediaStreamImplTest, StopSourceWhenMediaStreamGoesOutOfScope) { | |
| 285 // Generate a stream with both audio and video. | |
| 286 RequestLocalMediaStream(); | |
| 287 // Makes sure the test itself don't hold a reference to the created | |
| 288 // MediaStream. | |
| 289 ms_impl_->ClearLastGeneratedStream(); | |
| 290 | |
| 291 // Expect the sources to be stopped when the MediaStream goes out of scope. | |
| 250 EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter()); | 292 EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter()); |
| 251 EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter()); | 293 EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter()); |
| 252 } | 294 } |
| 253 | |
| 254 // Test that the source is stopped even if there are two MediaStreams using | |
| 255 // the same source. | |
| 256 TEST_F(MediaStreamImplTest, StopSource) { | |
| 257 // Generate a stream with both audio and video. | |
| 258 blink::WebMediaStream desc1 = RequestLocalMediaStream(); | |
| 259 blink::WebMediaStream desc2 = RequestLocalMediaStream(); | |
| 260 | |
| 261 // Stop the video source. | |
| 262 blink::WebVector<blink::WebMediaStreamTrack> video_tracks; | |
| 263 desc1.videoTracks(video_tracks); | |
| 264 ms_impl_->OnLocalSourceStopped(video_tracks[0].source()); | |
| 265 EXPECT_EQ(0, ms_dispatcher_->stop_audio_device_counter()); | |
| 266 EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter()); | |
| 267 | |
| 268 // Stop the audio source. | |
| 269 blink::WebVector<blink::WebMediaStreamTrack> audio_tracks; | |
| 270 desc1.audioTracks(audio_tracks); | |
| 271 ms_impl_->OnLocalSourceStopped(audio_tracks[0].source()); | |
| 272 EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter()); | |
| 273 EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter()); | |
| 274 } | |
| 275 | 295 |
| 276 // Test that the MediaStreams are deleted if the owning WebFrame is deleted. | 296 // Test that the MediaStreams are deleted if the owning WebFrame is deleted. |
| 277 // In the unit test the owning frame is NULL. | 297 // In the unit test the owning frame is NULL. |
| 278 TEST_F(MediaStreamImplTest, FrameWillClose) { | 298 TEST_F(MediaStreamImplTest, FrameWillClose) { |
| 279 // Test a stream with both audio and video. | 299 // Test a stream with both audio and video. |
| 280 blink::WebMediaStream mixed_desc = RequestLocalMediaStream(); | 300 blink::WebMediaStream mixed_desc = RequestLocalMediaStream(); |
| 301 blink::WebMediaStream desc2 = RequestLocalMediaStream(); | |
| 281 | 302 |
| 282 // Test that the MediaStreams are deleted if the owning WebFrame is deleted. | 303 // Test that the MediaStreams are deleted if the owning WebFrame is deleted. |
| 283 // In the unit test the owning frame is NULL. | 304 // In the unit test the owning frame is NULL. |
| 284 ms_impl_->FrameWillClose(NULL); | 305 ms_impl_->FrameWillClose(NULL); |
| 285 EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter()); | 306 EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter()); |
| 286 EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter()); | 307 EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter()); |
| 287 } | 308 } |
| 288 | 309 |
| 289 // This test what happens if a source to a MediaSteam fails to start. | 310 // This test what happens if a source to a MediaSteam fails to start. |
| 290 TEST_F(MediaStreamImplTest, MediaSourceFailToStart) { | 311 TEST_F(MediaStreamImplTest, MediaSourceFailToStart) { |
| 291 ms_impl_->RequestUserMedia(); | 312 ms_impl_->RequestUserMedia(); |
| 292 FakeMediaStreamDispatcherComplete(); | 313 FakeMediaStreamDispatcherComplete(); |
| 293 FailToStartMockedVideoSource(); | 314 FailToStartMockedVideoSource(); |
| 294 EXPECT_EQ(MediaStreamImplUnderTest::REQUEST_FAILED, | 315 EXPECT_EQ(MediaStreamImplUnderTest::REQUEST_FAILED, |
| 295 ms_impl_->request_state()); | 316 ms_impl_->request_state()); |
| 296 EXPECT_EQ(MEDIA_DEVICE_TRACK_START_FAILURE, | 317 EXPECT_EQ(MEDIA_DEVICE_TRACK_START_FAILURE, |
| 297 ms_impl_->error_reason()); | 318 ms_impl_->error_reason()); |
| 298 EXPECT_EQ(1, ms_dispatcher_->request_stream_counter()); | 319 EXPECT_EQ(1, ms_dispatcher_->request_stream_counter()); |
| 299 EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter()); | 320 EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter()); |
| 300 EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter()); | 321 EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter()); |
| 301 } | 322 } |
| 302 | 323 |
| 303 // This test what happens if MediaStreamImpl is deleted while the sources of a | 324 // This test what happens if MediaStreamImpl is deleted before a source has |
| 304 // MediaStream is being started. | 325 // started. |
| 305 TEST_F(MediaStreamImplTest, MediaStreamImplShutDown) { | 326 TEST_F(MediaStreamImplTest, MediaStreamImplShutDown) { |
| 306 ms_impl_->RequestUserMedia(); | 327 ms_impl_->RequestUserMedia(); |
| 307 FakeMediaStreamDispatcherComplete(); | 328 FakeMediaStreamDispatcherComplete(); |
| 308 EXPECT_EQ(1, ms_dispatcher_->request_stream_counter()); | 329 EXPECT_EQ(1, ms_dispatcher_->request_stream_counter()); |
| 309 EXPECT_EQ(MediaStreamImplUnderTest::REQUEST_NOT_COMPLETE, | 330 EXPECT_EQ(MediaStreamImplUnderTest::REQUEST_NOT_COMPLETE, |
| 310 ms_impl_->request_state()); | 331 ms_impl_->request_state()); |
| 311 | |
| 312 MockMediaStreamVideoCapturerSource* video_source = | |
| 313 ms_impl_->last_created_video_source(); | |
| 314 // Hold on to a blink reference to the source to guarantee that its not | |
| 315 // deleted when MediaStreamImpl is deleted. | |
| 316 blink::WebMediaStreamSource blink_source = video_source->owner(); | |
| 317 ms_impl_.reset(); | 332 ms_impl_.reset(); |
| 318 video_source->StartMockedSource(); | |
| 319 } | 333 } |
| 320 | 334 |
| 321 // This test what happens if the WebFrame is closed while the MediaStream is | 335 // This test what happens if the WebFrame is closed while the MediaStream is |
| 322 // being generated by the MediaStreamDispatcher. | 336 // being generated by the MediaStreamDispatcher. |
| 323 TEST_F(MediaStreamImplTest, ReloadFrameWhileGeneratingStream) { | 337 TEST_F(MediaStreamImplTest, ReloadFrameWhileGeneratingStream) { |
| 324 ms_impl_->RequestUserMedia(); | 338 ms_impl_->RequestUserMedia(); |
| 325 ms_impl_->FrameWillClose(NULL); | 339 ms_impl_->FrameWillClose(NULL); |
| 326 EXPECT_EQ(1, ms_dispatcher_->request_stream_counter()); | 340 EXPECT_EQ(1, ms_dispatcher_->request_stream_counter()); |
| 327 EXPECT_EQ(0, ms_dispatcher_->stop_audio_device_counter()); | 341 EXPECT_EQ(0, ms_dispatcher_->stop_audio_device_counter()); |
| 328 EXPECT_EQ(0, ms_dispatcher_->stop_video_device_counter()); | 342 EXPECT_EQ(0, ms_dispatcher_->stop_video_device_counter()); |
| 329 EXPECT_EQ(MediaStreamImplUnderTest::REQUEST_NOT_COMPLETE, | 343 EXPECT_EQ(MediaStreamImplUnderTest::REQUEST_NOT_COMPLETE, |
| 330 ms_impl_->request_state()); | 344 ms_impl_->request_state()); |
| 331 } | 345 } |
| 332 | 346 |
| 333 // This test what happens if the WebFrame is closed while the sources are being | 347 // This test what happens if the WebFrame is closed while the sources are being |
| 334 // started. | 348 // started. |
| 335 TEST_F(MediaStreamImplTest, ReloadFrameWhileGeneratingSources) { | 349 TEST_F(MediaStreamImplTest, ReloadFrameWhileGeneratingSources) { |
| 336 ms_impl_->RequestUserMedia(); | 350 ms_impl_->RequestUserMedia(); |
| 337 FakeMediaStreamDispatcherComplete(); | 351 FakeMediaStreamDispatcherComplete(); |
| 338 EXPECT_EQ(1, ms_dispatcher_->request_stream_counter()); | 352 EXPECT_EQ(1, ms_dispatcher_->request_stream_counter()); |
| 339 ms_impl_->FrameWillClose(NULL); | 353 ms_impl_->FrameWillClose(NULL); |
| 340 EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter()); | 354 EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter()); |
| 341 EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter()); | 355 EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter()); |
| 342 EXPECT_EQ(MediaStreamImplUnderTest::REQUEST_NOT_COMPLETE, | 356 EXPECT_EQ(MediaStreamImplUnderTest::REQUEST_NOT_COMPLETE, |
| 343 ms_impl_->request_state()); | 357 ms_impl_->request_state()); |
| 344 } | 358 } |
| 345 | 359 |
| 346 // This test what happens if stop is called on a stream after the frame has | 360 // This test what happens if stop is called on a track after the frame has |
| 347 // been reloaded. | 361 // been reloaded. |
| 348 TEST_F(MediaStreamImplTest, StopStreamAfterReload) { | 362 TEST_F(MediaStreamImplTest, StopTrackAfterReload) { |
| 349 blink::WebMediaStream mixed_desc = RequestLocalMediaStream(); | 363 blink::WebMediaStream mixed_desc = RequestLocalMediaStream(); |
| 350 EXPECT_EQ(1, ms_dispatcher_->request_stream_counter()); | 364 EXPECT_EQ(1, ms_dispatcher_->request_stream_counter()); |
| 351 ms_impl_->FrameWillClose(NULL); | 365 ms_impl_->FrameWillClose(NULL); |
| 352 EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter()); | 366 EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter()); |
| 353 EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter()); | 367 EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter()); |
| 354 ms_impl_->OnLocalMediaStreamStop(mixed_desc.id().utf8()); | 368 |
| 369 blink::WebVector<blink::WebMediaStreamTrack> audio_tracks; | |
| 370 mixed_desc.audioTracks(audio_tracks); | |
| 371 MediaStreamTrack* audio_track = MediaStreamTrack::GetTrack(audio_tracks[0]); | |
| 372 audio_track->StopTrack(); | |
| 355 EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter()); | 373 EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter()); |
| 374 | |
| 375 blink::WebVector<blink::WebMediaStreamTrack> video_tracks; | |
| 376 mixed_desc.videoTracks(video_tracks); | |
| 377 MediaStreamTrack* video_track = MediaStreamTrack::GetTrack(video_tracks[0]); | |
| 378 video_track->StopTrack(); | |
| 356 EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter()); | 379 EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter()); |
| 357 } | 380 } |
| 358 | 381 |
| 359 } // namespace content | 382 } // namespace content |
| OLD | NEW |