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 2f00c04d988ccfd6ae25e3c52e11d2d35171c92e..63f3b8ae4bfaade6e5c364f1472a5cda680ff6da 100644 |
--- a/content/renderer/media/media_stream_impl_unittest.cc |
+++ b/content/renderer/media/media_stream_impl_unittest.cc |
@@ -91,11 +91,11 @@ class MediaStreamImplTest : public ::testing::Test { |
bool video) { |
ms_impl_->RequestUserMedia(audio, video); |
FakeMediaStreamDispatcherComplete(); |
- if (video) { |
- // TODO(perkj): Only change the video source at the moment since audio |
- // sources are not implemented. |
- ChangeSourceStateToLive(); |
- } |
+ if (video) |
+ ChangeVideoSourceStateToLive(); |
+ if (audio) |
+ ChangeAudioSourceStateToLive(); |
+ |
EXPECT_EQ(MediaStreamImplUnderTest::REQUEST_SUCCEEDED, |
ms_impl_->request_state()); |
@@ -126,18 +126,30 @@ class MediaStreamImplTest : public ::testing::Test { |
ms_dispatcher_->video_array()); |
} |
- void ChangeSourceStateToLive() { |
+ void ChangeVideoSourceStateToLive() { |
if (dependency_factory_->last_video_source() != NULL) { |
dependency_factory_->last_video_source()->SetLive(); |
} |
} |
- void ChangeSourceStateToEnded() { |
+ void ChangeAudioSourceStateToLive() { |
+ if (dependency_factory_->last_audio_source() != NULL) { |
+ dependency_factory_->last_audio_source()->SetLive(); |
+ } |
+ } |
+ |
+ void ChangeVideoSourceStateToEnded() { |
if (dependency_factory_->last_video_source() != NULL) { |
dependency_factory_->last_video_source()->SetEnded(); |
} |
} |
+ void ChangeAudioSourceStateToEnded() { |
+ if (dependency_factory_->last_audio_source() != NULL) { |
+ dependency_factory_->last_audio_source()->SetEnded(); |
+ } |
+ } |
+ |
protected: |
scoped_ptr<MockMediaStreamDispatcher> ms_dispatcher_; |
scoped_ptr<MediaStreamImplUnderTest> ms_impl_; |
@@ -183,7 +195,8 @@ TEST_F(MediaStreamImplTest, LocalMediaStream) { |
TEST_F(MediaStreamImplTest, MediaSourceFailToStart) { |
ms_impl_->RequestUserMedia(true, true); |
FakeMediaStreamDispatcherComplete(); |
- ChangeSourceStateToEnded(); |
+ ChangeVideoSourceStateToEnded(); |
+ ChangeAudioSourceStateToEnded(); |
EXPECT_EQ(MediaStreamImplUnderTest::REQUEST_FAILED, |
ms_impl_->request_state()); |
EXPECT_EQ(1, ms_dispatcher_->request_stream_counter()); |
@@ -199,7 +212,8 @@ TEST_F(MediaStreamImplTest, MediaStreamImplShutDown) { |
EXPECT_EQ(MediaStreamImplUnderTest::REQUEST_NOT_COMPLETE, |
ms_impl_->request_state()); |
ms_impl_.reset(); |
- ChangeSourceStateToLive(); |
+ ChangeAudioSourceStateToLive(); |
+ ChangeVideoSourceStateToLive(); |
} |
// This test what happens if the WebFrame is closed while the MediaStream is |
@@ -209,7 +223,8 @@ TEST_F(MediaStreamImplTest, ReloadFrameWhileGeneratingStream) { |
ms_impl_->FrameWillClose(NULL); |
EXPECT_EQ(1, ms_dispatcher_->request_stream_counter()); |
EXPECT_EQ(0, ms_dispatcher_->stop_stream_counter()); |
- ChangeSourceStateToLive(); |
+ ChangeAudioSourceStateToLive(); |
+ ChangeVideoSourceStateToLive(); |
EXPECT_EQ(MediaStreamImplUnderTest::REQUEST_NOT_COMPLETE, |
ms_impl_->request_state()); |
} |
@@ -223,7 +238,8 @@ TEST_F(MediaStreamImplTest, ReloadFrameWhileGeneratingSources) { |
EXPECT_EQ(1, ms_dispatcher_->request_stream_counter()); |
ms_impl_->FrameWillClose(NULL); |
EXPECT_EQ(1, ms_dispatcher_->stop_stream_counter()); |
- ChangeSourceStateToLive(); |
+ ChangeAudioSourceStateToLive(); |
+ ChangeVideoSourceStateToLive(); |
EXPECT_EQ(MediaStreamImplUnderTest::REQUEST_NOT_COMPLETE, |
ms_impl_->request_state()); |
} |