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

Side by Side Diff: content/renderer/media/media_stream_video_capture_source_unittest.cc

Issue 541163002: Clarify resolution change behaviors of video capture devices (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merged Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/bind.h" 5 #include "base/bind.h"
6 #include "base/callback_helpers.h" 6 #include "base/callback_helpers.h"
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "content/child/child_process.h" 10 #include "content/child/child_process.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 blink::WebString webkit_source_id_; 97 blink::WebString webkit_source_id_;
98 bool source_stopped_; 98 bool source_stopped_;
99 }; 99 };
100 100
101 TEST_F(MediaStreamVideoCapturerSourceTest, TabCaptureAllowResolutionChange) { 101 TEST_F(MediaStreamVideoCapturerSourceTest, TabCaptureAllowResolutionChange) {
102 StreamDeviceInfo device_info; 102 StreamDeviceInfo device_info;
103 device_info.device.type = MEDIA_TAB_VIDEO_CAPTURE; 103 device_info.device.type = MEDIA_TAB_VIDEO_CAPTURE;
104 InitWithDeviceInfo(device_info); 104 InitWithDeviceInfo(device_info);
105 105
106 EXPECT_CALL(mock_delegate(), StartCapture( 106 EXPECT_CALL(mock_delegate(), StartCapture(
107 testing::Field(&media::VideoCaptureParams::allow_resolution_change, true), 107 testing::Field(&media::VideoCaptureParams::resolution_change_policy,
108 media::RESOLUTION_POLICY_DYNAMIC_WITHIN_LIMIT),
108 testing::_, 109 testing::_,
109 testing::_)).Times(1); 110 testing::_)).Times(1);
110 blink::WebMediaStreamTrack track = StartSource(); 111 blink::WebMediaStreamTrack track = StartSource();
111 // When the track goes out of scope, the source will be stopped. 112 // When the track goes out of scope, the source will be stopped.
112 EXPECT_CALL(mock_delegate(), StopCapture()); 113 EXPECT_CALL(mock_delegate(), StopCapture());
113 } 114 }
114 115
115 TEST_F(MediaStreamVideoCapturerSourceTest, 116 TEST_F(MediaStreamVideoCapturerSourceTest,
116 DesktopCaptureAllowResolutionChange) { 117 DesktopCaptureAllowResolutionChange) {
117 StreamDeviceInfo device_info; 118 StreamDeviceInfo device_info;
118 device_info.device.type = MEDIA_DESKTOP_VIDEO_CAPTURE; 119 device_info.device.type = MEDIA_DESKTOP_VIDEO_CAPTURE;
119 InitWithDeviceInfo(device_info); 120 InitWithDeviceInfo(device_info);
120 121
121 EXPECT_CALL(mock_delegate(), StartCapture( 122 EXPECT_CALL(mock_delegate(), StartCapture(
122 testing::Field(&media::VideoCaptureParams::allow_resolution_change, true), 123 testing::Field(&media::VideoCaptureParams::resolution_change_policy,
124 media::RESOLUTION_POLICY_DYNAMIC_WITHIN_LIMIT),
123 testing::_, 125 testing::_,
124 testing::_)).Times(1); 126 testing::_)).Times(1);
125 blink::WebMediaStreamTrack track = StartSource(); 127 blink::WebMediaStreamTrack track = StartSource();
126 // When the track goes out of scope, the source will be stopped. 128 // When the track goes out of scope, the source will be stopped.
127 EXPECT_CALL(mock_delegate(), StopCapture()); 129 EXPECT_CALL(mock_delegate(), StopCapture());
128 } 130 }
129 131
130 TEST_F(MediaStreamVideoCapturerSourceTest, Ended) { 132 TEST_F(MediaStreamVideoCapturerSourceTest, Ended) {
131 StreamDeviceInfo device_info; 133 StreamDeviceInfo device_info;
132 device_info.device.type = MEDIA_DESKTOP_VIDEO_CAPTURE; 134 device_info.device.type = MEDIA_DESKTOP_VIDEO_CAPTURE;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 base::Bind(deliver_frame_cb, 216 base::Bind(deliver_frame_cb,
215 media::VideoFrame::CreateBlackFrame(gfx::Size(2, 2)), 217 media::VideoFrame::CreateBlackFrame(gfx::Size(2, 2)),
216 media::VideoCaptureFormat(), 218 media::VideoCaptureFormat(),
217 reference_capture_time)); 219 reference_capture_time));
218 run_loop.Run(); 220 run_loop.Run();
219 FakeMediaStreamVideoSink::RemoveFromVideoTrack(&fake_sink, track); 221 FakeMediaStreamVideoSink::RemoveFromVideoTrack(&fake_sink, track);
220 EXPECT_EQ(reference_capture_time, capture_time); 222 EXPECT_EQ(reference_capture_time, capture_time);
221 } 223 }
222 224
223 } // namespace content 225 } // namespace content
OLDNEW
« no previous file with comments | « content/common/media/video_capture_messages.h ('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