| Index: content/renderer/media/user_media_client_impl_unittest.cc
|
| diff --git a/content/renderer/media/user_media_client_impl_unittest.cc b/content/renderer/media/user_media_client_impl_unittest.cc
|
| index a0b5c294ef8c37a8a7128e63b2736cba34a4a192..0e36428281baf2afcc6bb7bb856bddd672121f4a 100644
|
| --- a/content/renderer/media/user_media_client_impl_unittest.cc
|
| +++ b/content/renderer/media/user_media_client_impl_unittest.cc
|
| @@ -227,6 +227,10 @@ class UserMediaClientImplTest : public ::testing::Test {
|
| blink::WebHeap::collectAllGarbageForTesting();
|
| }
|
|
|
| + void LoadNewDocumentInFrame() {
|
| + used_media_impl_->WillCommitProvisionalLoad();
|
| + }
|
| +
|
| blink::WebMediaStream RequestLocalMediaStream() {
|
| used_media_impl_->RequestUserMedia();
|
| FakeMediaStreamDispatcherRequestUserMediaComplete();
|
| @@ -456,13 +460,13 @@ TEST_F(UserMediaClientImplTest, StopSourceWhenMediaStreamGoesOutOfScope) {
|
| EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter());
|
| }
|
|
|
| -// Test that the MediaStreams are deleted if the owning WebFrame is closing.
|
| -// In the unit test the owning frame is NULL.
|
| -TEST_F(UserMediaClientImplTest, FrameWillClose) {
|
| +// Test that the MediaStreams are deleted if a new document is loaded in the
|
| +// frame.
|
| +TEST_F(UserMediaClientImplTest, LoadNewDocumentInFrame) {
|
| // Test a stream with both audio and video.
|
| blink::WebMediaStream mixed_desc = RequestLocalMediaStream();
|
| blink::WebMediaStream desc2 = RequestLocalMediaStream();
|
| - used_media_impl_->FrameWillClose();
|
| + LoadNewDocumentInFrame();
|
| blink::WebHeap::collectAllGarbageForTesting();
|
| EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter());
|
| EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter());
|
| @@ -510,11 +514,11 @@ TEST_F(UserMediaClientImplTest, MediaStreamImplShutDown) {
|
| used_media_impl_.reset();
|
| }
|
|
|
| -// This test what happens if the WebFrame is closed while the MediaStream is
|
| -// being generated by the MediaStreamDispatcher.
|
| +// This test what happens if a new document is loaded in the frame while the
|
| +// MediaStream is being generated by the MediaStreamDispatcher.
|
| TEST_F(UserMediaClientImplTest, ReloadFrameWhileGeneratingStream) {
|
| used_media_impl_->RequestUserMedia();
|
| - used_media_impl_->FrameWillClose();
|
| + LoadNewDocumentInFrame();
|
| EXPECT_EQ(1, ms_dispatcher_->request_stream_counter());
|
| EXPECT_EQ(0, ms_dispatcher_->stop_audio_device_counter());
|
| EXPECT_EQ(0, ms_dispatcher_->stop_video_device_counter());
|
| @@ -522,13 +526,13 @@ TEST_F(UserMediaClientImplTest, ReloadFrameWhileGeneratingStream) {
|
| used_media_impl_->request_state());
|
| }
|
|
|
| -// This test what happens if the WebFrame is closed while the sources are being
|
| -// started.
|
| +// This test what happens if a newdocument is loaded in the frame while the
|
| +// sources are being started.
|
| TEST_F(UserMediaClientImplTest, ReloadFrameWhileGeneratingSources) {
|
| used_media_impl_->RequestUserMedia();
|
| FakeMediaStreamDispatcherRequestUserMediaComplete();
|
| EXPECT_EQ(1, ms_dispatcher_->request_stream_counter());
|
| - used_media_impl_->FrameWillClose();
|
| + LoadNewDocumentInFrame();
|
| EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter());
|
| EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter());
|
| EXPECT_EQ(UserMediaClientImplUnderTest::REQUEST_NOT_COMPLETE,
|
| @@ -540,7 +544,7 @@ TEST_F(UserMediaClientImplTest, ReloadFrameWhileGeneratingSources) {
|
| TEST_F(UserMediaClientImplTest, StopTrackAfterReload) {
|
| blink::WebMediaStream mixed_desc = RequestLocalMediaStream();
|
| EXPECT_EQ(1, ms_dispatcher_->request_stream_counter());
|
| - used_media_impl_->FrameWillClose();
|
| + LoadNewDocumentInFrame();
|
| blink::WebHeap::collectAllGarbageForTesting();
|
| EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter());
|
| EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter());
|
| @@ -711,10 +715,10 @@ TEST_F(UserMediaClientImplTest, AudioVideoWithSameId) {
|
| EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter());
|
| EXPECT_EQ(0, ms_dispatcher_->stop_audio_device_counter());
|
|
|
| - // Now we close the web frame, if in the above Stop() call,
|
| + // Now we load a new document in the web frame. If in the above Stop() call,
|
| // UserMediaClientImpl accidentally removed audio track, then video track will
|
| // be removed again here, which is incorrect.
|
| - used_media_impl_->FrameWillClose();
|
| + LoadNewDocumentInFrame();
|
| blink::WebHeap::collectAllGarbageForTesting();
|
| EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter());
|
| EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter());
|
|
|