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

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: fixed build 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 scoped_refptr<VideoCapturerDelegate> delegate_; 89 scoped_refptr<VideoCapturerDelegate> delegate_;
90 bool source_stopped_; 90 bool source_stopped_;
91 }; 91 };
92 92
93 TEST_F(MediaStreamVideoCapturerSourceTest, TabCaptureAllowResolutionChange) { 93 TEST_F(MediaStreamVideoCapturerSourceTest, TabCaptureAllowResolutionChange) {
94 StreamDeviceInfo device_info; 94 StreamDeviceInfo device_info;
95 device_info.device.type = MEDIA_TAB_VIDEO_CAPTURE; 95 device_info.device.type = MEDIA_TAB_VIDEO_CAPTURE;
96 InitWithDeviceInfo(device_info); 96 InitWithDeviceInfo(device_info);
97 97
98 EXPECT_CALL(mock_delegate(), StartCapture( 98 EXPECT_CALL(mock_delegate(), StartCapture(
99 testing::Field(&media::VideoCaptureParams::allow_resolution_change, true), 99 testing::Field(&media::VideoCaptureParams::resolution_change_policy,
100 media::RESOLUTION_POLICY_DYNAMIC_WITHIN_LIMIT),
100 testing::_, 101 testing::_,
101 testing::_)).Times(1); 102 testing::_)).Times(1);
102 blink::WebMediaStreamTrack track = StartSource(); 103 blink::WebMediaStreamTrack track = StartSource();
103 // When the track goes out of scope, the source will be stopped. 104 // When the track goes out of scope, the source will be stopped.
104 EXPECT_CALL(mock_delegate(), StopCapture()); 105 EXPECT_CALL(mock_delegate(), StopCapture());
105 } 106 }
106 107
107 TEST_F(MediaStreamVideoCapturerSourceTest, 108 TEST_F(MediaStreamVideoCapturerSourceTest,
108 DesktopCaptureAllowResolutionChange) { 109 DesktopCaptureAllowResolutionChange) {
109 StreamDeviceInfo device_info; 110 StreamDeviceInfo device_info;
110 device_info.device.type = MEDIA_DESKTOP_VIDEO_CAPTURE; 111 device_info.device.type = MEDIA_DESKTOP_VIDEO_CAPTURE;
111 InitWithDeviceInfo(device_info); 112 InitWithDeviceInfo(device_info);
112 113
113 EXPECT_CALL(mock_delegate(), StartCapture( 114 EXPECT_CALL(mock_delegate(), StartCapture(
114 testing::Field(&media::VideoCaptureParams::allow_resolution_change, true), 115 testing::Field(&media::VideoCaptureParams::resolution_change_policy,
116 media::RESOLUTION_POLICY_DYNAMIC_WITHIN_LIMIT),
115 testing::_, 117 testing::_,
116 testing::_)).Times(1); 118 testing::_)).Times(1);
117 blink::WebMediaStreamTrack track = StartSource(); 119 blink::WebMediaStreamTrack track = StartSource();
118 // When the track goes out of scope, the source will be stopped. 120 // When the track goes out of scope, the source will be stopped.
119 EXPECT_CALL(mock_delegate(), StopCapture()); 121 EXPECT_CALL(mock_delegate(), StopCapture());
120 } 122 }
121 123
122 TEST_F(MediaStreamVideoCapturerSourceTest, Ended) { 124 TEST_F(MediaStreamVideoCapturerSourceTest, Ended) {
123 StreamDeviceInfo device_info; 125 StreamDeviceInfo device_info;
124 device_info.device.type = MEDIA_DESKTOP_VIDEO_CAPTURE; 126 device_info.device.type = MEDIA_DESKTOP_VIDEO_CAPTURE;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 base::Bind(deliver_frame_cb, 207 base::Bind(deliver_frame_cb,
206 media::VideoFrame::CreateBlackFrame(gfx::Size(2, 2)), 208 media::VideoFrame::CreateBlackFrame(gfx::Size(2, 2)),
207 media::VideoCaptureFormat(), 209 media::VideoCaptureFormat(),
208 reference_capture_time)); 210 reference_capture_time));
209 run_loop.Run(); 211 run_loop.Run();
210 FakeMediaStreamVideoSink::RemoveFromVideoTrack(&fake_sink, track); 212 FakeMediaStreamVideoSink::RemoveFromVideoTrack(&fake_sink, track);
211 EXPECT_EQ(reference_capture_time, capture_time); 213 EXPECT_EQ(reference_capture_time, capture_time);
212 } 214 }
213 215
214 } // namespace content 216 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698