Index: content/renderer/media/media_stream_impl_unittest.cc |
diff --git a/content/renderer/media/media_stream_impl_unittest.cc b/content/renderer/media/media_stream_impl_unittest.cc |
index cddf1192150b8a9ad4f2ae09bdca2a3a85d3ab0a..997340a0b6278371e984229d91a55166ea1fbfe1 100644 |
--- a/content/renderer/media/media_stream_impl_unittest.cc |
+++ b/content/renderer/media/media_stream_impl_unittest.cc |
@@ -43,9 +43,11 @@ class MediaStreamImplUnderTest : public MediaStreamImpl { |
REQUEST_FAILED, |
}; |
- MediaStreamImplUnderTest(MediaStreamDispatcher* media_stream_dispatcher, |
- PeerConnectionDependencyFactory* dependency_factory) |
- : MediaStreamImpl(NULL, media_stream_dispatcher, dependency_factory), |
+ MediaStreamImplUnderTest( |
+ PeerConnectionDependencyFactory* dependency_factory, |
+ scoped_ptr<MediaStreamDispatcher> media_stream_dispatcher) |
+ : MediaStreamImpl( |
+ NULL, dependency_factory, media_stream_dispatcher.Pass()), |
state_(REQUEST_NOT_STARTED), |
result_(NUM_MEDIA_REQUEST_RESULTS), |
factory_(dependency_factory), |
@@ -128,10 +130,11 @@ class MediaStreamImplTest : public ::testing::Test { |
virtual void SetUp() { |
// Create our test object. |
child_process_.reset(new ChildProcess()); |
- ms_dispatcher_.reset(new MockMediaStreamDispatcher()); |
dependency_factory_.reset(new MockPeerConnectionDependencyFactory()); |
- ms_impl_.reset(new MediaStreamImplUnderTest(ms_dispatcher_.get(), |
- dependency_factory_.get())); |
+ ms_dispatcher_ = new MockMediaStreamDispatcher(); |
+ ms_impl_.reset(new MediaStreamImplUnderTest( |
+ dependency_factory_.get(), |
+ scoped_ptr<MediaStreamDispatcher>(ms_dispatcher_).Pass())); |
} |
blink::WebMediaStream RequestLocalMediaStream() { |
@@ -199,7 +202,7 @@ class MediaStreamImplTest : public ::testing::Test { |
protected: |
base::MessageLoop message_loop_; |
scoped_ptr<ChildProcess> child_process_; |
- scoped_ptr<MockMediaStreamDispatcher> ms_dispatcher_; |
+ MockMediaStreamDispatcher* ms_dispatcher_; // Owned my |ms_impl_|. |
scoped_ptr<MediaStreamImplUnderTest> ms_impl_; |
scoped_ptr<MockPeerConnectionDependencyFactory> dependency_factory_; |
}; |
@@ -329,16 +332,13 @@ TEST_F(MediaStreamImplTest, StopSourceWhenMediaStreamGoesOutOfScope) { |
EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter()); |
} |
-// Test that the MediaStreams are deleted if the owning WebFrame is deleted. |
+// Test that the MediaStreams are deleted if the owning WebFrame is closing. |
// In the unit test the owning frame is NULL. |
TEST_F(MediaStreamImplTest, FrameWillClose) { |
// Test a stream with both audio and video. |
blink::WebMediaStream mixed_desc = RequestLocalMediaStream(); |
blink::WebMediaStream desc2 = RequestLocalMediaStream(); |
- |
- // Test that the MediaStreams are deleted if the owning WebFrame is deleted. |
- // In the unit test the owning frame is NULL. |
- ms_impl_->FrameWillClose(NULL); |
+ ms_impl_->FrameWillClose(); |
EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter()); |
EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter()); |
} |
@@ -387,7 +387,7 @@ TEST_F(MediaStreamImplTest, MediaStreamImplShutDown) { |
// being generated by the MediaStreamDispatcher. |
TEST_F(MediaStreamImplTest, ReloadFrameWhileGeneratingStream) { |
ms_impl_->RequestUserMedia(); |
- ms_impl_->FrameWillClose(NULL); |
+ ms_impl_->FrameWillClose(); |
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()); |
@@ -401,7 +401,7 @@ TEST_F(MediaStreamImplTest, ReloadFrameWhileGeneratingSources) { |
ms_impl_->RequestUserMedia(); |
FakeMediaStreamDispatcherRequestUserMediaComplete(); |
EXPECT_EQ(1, ms_dispatcher_->request_stream_counter()); |
- ms_impl_->FrameWillClose(NULL); |
+ ms_impl_->FrameWillClose(); |
EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter()); |
EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter()); |
EXPECT_EQ(MediaStreamImplUnderTest::REQUEST_NOT_COMPLETE, |
@@ -413,7 +413,7 @@ TEST_F(MediaStreamImplTest, ReloadFrameWhileGeneratingSources) { |
TEST_F(MediaStreamImplTest, StopTrackAfterReload) { |
blink::WebMediaStream mixed_desc = RequestLocalMediaStream(); |
EXPECT_EQ(1, ms_dispatcher_->request_stream_counter()); |
- ms_impl_->FrameWillClose(NULL); |
+ ms_impl_->FrameWillClose(); |
EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter()); |
EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter()); |