Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1364)

Unified Diff: content/renderer/media/media_stream_video_capture_source_unittest.cc

Issue 218763007: Update MediaStreamTrack::Stop to latest draft. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/media_stream_video_capture_source_unittest.cc
diff --git a/content/renderer/media/media_stream_video_capture_source_unittest.cc b/content/renderer/media/media_stream_video_capture_source_unittest.cc
index 0a29e767a4c468ba78d0b0ced739dbb971321e36..cfb5ff038aa2721efbe3b7ce49b4d4b97bfe3f76 100644
--- a/content/renderer/media/media_stream_video_capture_source_unittest.cc
+++ b/content/renderer/media/media_stream_video_capture_source_unittest.cc
@@ -21,6 +21,7 @@ class MockVideoCapturerDelegate : public VideoCapturerDelegate {
void(const media::VideoCaptureParams& params,
const NewFrameCallback& new_frame_callback,
const StartedCallback& started_callback));
+ MOCK_METHOD0(StopDeliver,void());
private:
virtual ~MockVideoCapturerDelegate() {}
@@ -42,12 +43,12 @@ class MediaStreamVideoCapturerSourceTest : public testing::Test {
webkit_source_.setExtraData(source_);
}
- void StartSource() {
+ blink::WebMediaStreamTrack StartSource() {
MockMediaConstraintFactory factory;
bool enabled = true;
MediaStreamDependencyFactory* dependency_factory = NULL;
- // CreateVideoTrack will trigger OnSupportedFormats.
- MediaStreamVideoTrack::CreateVideoTrack(
+ // CreateVideoTrack will trigger OnConstraintsApplied.
+ return MediaStreamVideoTrack::CreateVideoTrack(
source_, factory.CreateWebMediaConstraints(),
base::Bind(
&MediaStreamVideoCapturerSourceTest::OnConstraintsApplied,
@@ -74,7 +75,9 @@ TEST_F(MediaStreamVideoCapturerSourceTest, TabCaptureAllowResolutionChange) {
testing::Field(&media::VideoCaptureParams::allow_resolution_change, true),
testing::_,
testing::_)).Times(1);
- StartSource();
+ blink::WebMediaStreamTrack track = StartSource();
+ // When the track goes out of scope, the source will be stopped.
+ EXPECT_CALL(*delegate_, StopDeliver());
}
TEST_F(MediaStreamVideoCapturerSourceTest,
@@ -87,7 +90,9 @@ TEST_F(MediaStreamVideoCapturerSourceTest,
testing::Field(&media::VideoCaptureParams::allow_resolution_change, true),
testing::_,
testing::_)).Times(1);
- StartSource();
+ blink::WebMediaStreamTrack track = StartSource();
+ // When the track goes out of scope, the source will be stopped.
+ EXPECT_CALL(*delegate_, StopDeliver());
}
} // namespace content
« no previous file with comments | « content/renderer/media/media_stream_track.cc ('k') | content/renderer/media/media_stream_video_capturer_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698