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

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

Issue 190643003: Fix/Add content_unittests to work for the code behind --enable-audio-track-processing (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: removed an empty line. Created 6 years, 9 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
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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "content/renderer/media/media_stream_video_source.h" 10 #include "content/renderer/media/media_stream_video_source.h"
11 #include "content/renderer/media/media_stream_video_track.h" 11 #include "content/renderer/media/media_stream_video_track.h"
12 #include "content/renderer/media/mock_media_constraint_factory.h"
12 #include "content/renderer/media/mock_media_stream_dependency_factory.h" 13 #include "content/renderer/media/mock_media_stream_dependency_factory.h"
13 #include "content/renderer/media/mock_media_stream_video_source.h" 14 #include "content/renderer/media/mock_media_stream_video_source.h"
14 #include "media/base/video_frame.h" 15 #include "media/base/video_frame.h"
15 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
16 17
17 namespace content { 18 namespace content {
18 19
19 class ConstraintsFactory {
20 public:
21 void AddMandatory(const std::string& key, int value) {
22 mandatory_.push_back(blink::WebMediaConstraint(base::UTF8ToUTF16(key),
23 base::IntToString16(value)));
24 }
25 void AddMandatory(const std::string& key, double value) {
26 mandatory_.push_back(blink::WebMediaConstraint(
27 base::UTF8ToUTF16(key),
28 base::UTF8ToUTF16(base::DoubleToString(value))));
29 }
30
31 void AddOptional(const std::string& key, int value) {
32 optional_.push_back(blink::WebMediaConstraint(base::UTF8ToUTF16(key),
33 base::IntToString16(value)));
34 }
35
36 void AddOptional(const std::string& key, double value) {
37 optional_.push_back(blink::WebMediaConstraint(
38 base::UTF8ToUTF16(key),
39 base::UTF8ToUTF16(base::DoubleToString(value))));
40 }
41
42 blink::WebMediaConstraints CreateConstraints() {
43 blink::WebVector<blink::WebMediaConstraint> mandatory(mandatory_);
44 blink::WebVector<blink::WebMediaConstraint> optional(optional_);
45 blink::WebMediaConstraints constraints;
46 constraints.initialize(optional, mandatory);
47 return constraints;
48 }
49
50 private:
51 std::vector<blink::WebMediaConstraint> mandatory_;
52 std::vector<blink::WebMediaConstraint> optional_;
53 };
54
55 class MediaStreamVideoSourceTest 20 class MediaStreamVideoSourceTest
56 : public ::testing::Test { 21 : public ::testing::Test {
57 public: 22 public:
58 MediaStreamVideoSourceTest() 23 MediaStreamVideoSourceTest()
59 : number_of_successful_constraints_applied_(0), 24 : number_of_successful_constraints_applied_(0),
60 number_of_failed_constraints_applied_(0), 25 number_of_failed_constraints_applied_(0),
61 mock_source_(new MockMediaStreamVideoSource(&factory_, true)) { 26 mock_source_(new MockMediaStreamVideoSource(&factory_, true)) {
62 media::VideoCaptureFormats formats; 27 media::VideoCaptureFormats formats;
63 formats.push_back(media::VideoCaptureFormat( 28 formats.push_back(media::VideoCaptureFormat(
64 gfx::Size(1280, 720), 30, media::PIXEL_FORMAT_I420)); 29 gfx::Size(1280, 720), 30, media::PIXEL_FORMAT_I420));
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 CreateTrack("123", constraints); 182 CreateTrack("123", constraints);
218 CreateTrack("123", constraints); 183 CreateTrack("123", constraints);
219 mock_source()->CompleteGetSupportedFormats(); 184 mock_source()->CompleteGetSupportedFormats();
220 mock_source()->StartMockedSource(); 185 mock_source()->StartMockedSource();
221 EXPECT_EQ(2, NumberOfSuccessConstraintsCallbacks()); 186 EXPECT_EQ(2, NumberOfSuccessConstraintsCallbacks());
222 } 187 }
223 188
224 // Test that the capture output is CIF if we set max constraints to CIF. 189 // Test that the capture output is CIF if we set max constraints to CIF.
225 // and the capture device support CIF. 190 // and the capture device support CIF.
226 TEST_F(MediaStreamVideoSourceTest, MandatoryConstraintCif5Fps) { 191 TEST_F(MediaStreamVideoSourceTest, MandatoryConstraintCif5Fps) {
227 ConstraintsFactory factory; 192 MockMediaConstraintFactory factory;
228 factory.AddMandatory(MediaStreamVideoSource::kMaxWidth, 352); 193 factory.AddMandatory(MediaStreamVideoSource::kMaxWidth, 352);
229 factory.AddMandatory(MediaStreamVideoSource::kMaxHeight, 288); 194 factory.AddMandatory(MediaStreamVideoSource::kMaxHeight, 288);
230 factory.AddMandatory(MediaStreamVideoSource::kMaxFrameRate, 5); 195 factory.AddMandatory(MediaStreamVideoSource::kMaxFrameRate, 5);
231 196
232 CreateTrackAndStartSource(factory.CreateConstraints(), 352, 288, 5); 197 CreateTrackAndStartSource(factory.CreateWebMediaConstraints(), 352, 288, 5);
233 } 198 }
234 199
235 // Test that the capture output is 720P if the camera support it and the 200 // Test that the capture output is 720P if the camera support it and the
236 // optional constraint is set to 720P. 201 // optional constraint is set to 720P.
237 TEST_F(MediaStreamVideoSourceTest, MandatoryMinVgaOptional720P) { 202 TEST_F(MediaStreamVideoSourceTest, MandatoryMinVgaOptional720P) {
238 ConstraintsFactory factory; 203 MockMediaConstraintFactory factory;
239 factory.AddMandatory(MediaStreamVideoSource::kMinWidth, 640); 204 factory.AddMandatory(MediaStreamVideoSource::kMinWidth, 640);
240 factory.AddMandatory(MediaStreamVideoSource::kMinHeight, 480); 205 factory.AddMandatory(MediaStreamVideoSource::kMinHeight, 480);
241 factory.AddOptional(MediaStreamVideoSource::kMinWidth, 1280); 206 factory.AddOptional(MediaStreamVideoSource::kMinWidth, 1280);
242 factory.AddOptional(MediaStreamVideoSource::kMinAspectRatio, 207 factory.AddOptional(MediaStreamVideoSource::kMinAspectRatio,
243 1280.0 / 720); 208 1280.0 / 720);
244 209
245 CreateTrackAndStartSource(factory.CreateConstraints(), 1280, 720, 30); 210 CreateTrackAndStartSource(factory.CreateWebMediaConstraints(), 1280, 720, 30);
246 } 211 }
247 212
248 // Test that the capture output have aspect ratio 4:3 if a mandatory constraint 213 // Test that the capture output have aspect ratio 4:3 if a mandatory constraint
249 // require it even if an optional constraint request a higher resolution 214 // require it even if an optional constraint request a higher resolution
250 // that don't have this aspect ratio. 215 // that don't have this aspect ratio.
251 TEST_F(MediaStreamVideoSourceTest, MandatoryAspectRatio4To3) { 216 TEST_F(MediaStreamVideoSourceTest, MandatoryAspectRatio4To3) {
252 ConstraintsFactory factory; 217 MockMediaConstraintFactory factory;
253 factory.AddMandatory(MediaStreamVideoSource::kMinWidth, 640); 218 factory.AddMandatory(MediaStreamVideoSource::kMinWidth, 640);
254 factory.AddMandatory(MediaStreamVideoSource::kMinHeight, 480); 219 factory.AddMandatory(MediaStreamVideoSource::kMinHeight, 480);
255 factory.AddMandatory(MediaStreamVideoSource::kMaxAspectRatio, 220 factory.AddMandatory(MediaStreamVideoSource::kMaxAspectRatio,
256 640.0 / 480); 221 640.0 / 480);
257 factory.AddOptional(MediaStreamVideoSource::kMinWidth, 1280); 222 factory.AddOptional(MediaStreamVideoSource::kMinWidth, 1280);
258 223
259 CreateTrackAndStartSource(factory.CreateConstraints(), 640, 480, 30); 224 CreateTrackAndStartSource(factory.CreateWebMediaConstraints(), 640, 480, 30);
260 } 225 }
261 226
262 // Test that AddTrack fail if the mandatory aspect ratio 227 // Test that AddTrack fail if the mandatory aspect ratio
263 // is set higher than supported. 228 // is set higher than supported.
264 TEST_F(MediaStreamVideoSourceTest, MandatoryAspectRatioTooHigh) { 229 TEST_F(MediaStreamVideoSourceTest, MandatoryAspectRatioTooHigh) {
265 ConstraintsFactory factory; 230 MockMediaConstraintFactory factory;
266 factory.AddMandatory(MediaStreamVideoSource::kMinAspectRatio, 2); 231 factory.AddMandatory(MediaStreamVideoSource::kMinAspectRatio, 2);
267 CreateTrack("123", factory.CreateConstraints()); 232 CreateTrack("123", factory.CreateWebMediaConstraints());
268 mock_source()->CompleteGetSupportedFormats(); 233 mock_source()->CompleteGetSupportedFormats();
269 EXPECT_EQ(1, NumberOfFailedConstraintsCallbacks()); 234 EXPECT_EQ(1, NumberOfFailedConstraintsCallbacks());
270 } 235 }
271 236
272 // Test that the source ignores an optional aspect ratio that is higher than 237 // Test that the source ignores an optional aspect ratio that is higher than
273 // supported. 238 // supported.
274 TEST_F(MediaStreamVideoSourceTest, OptionalAspectRatioTooHigh) { 239 TEST_F(MediaStreamVideoSourceTest, OptionalAspectRatioTooHigh) {
275 ConstraintsFactory factory; 240 MockMediaConstraintFactory factory;
276 factory.AddOptional(MediaStreamVideoSource::kMinAspectRatio, 2); 241 factory.AddOptional(MediaStreamVideoSource::kMinAspectRatio, 2);
277 CreateTrack("123", factory.CreateConstraints()); 242 CreateTrack("123", factory.CreateWebMediaConstraints());
278 mock_source()->CompleteGetSupportedFormats(); 243 mock_source()->CompleteGetSupportedFormats();
279 244
280 const media::VideoCaptureParams& params = mock_source()->start_params(); 245 const media::VideoCaptureParams& params = mock_source()->start_params();
281 double aspect_ratio = 246 double aspect_ratio =
282 static_cast<double>(params.requested_format.frame_size.width()) / 247 static_cast<double>(params.requested_format.frame_size.width()) /
283 params.requested_format.frame_size.height(); 248 params.requested_format.frame_size.height();
284 EXPECT_LT(aspect_ratio, 2); 249 EXPECT_LT(aspect_ratio, 2);
285 } 250 }
286 251
287 // Test that the source starts video with the default resolution if the 252 // Test that the source starts video with the default resolution if the
288 // that is the only supported. 253 // that is the only supported.
289 TEST_F(MediaStreamVideoSourceTest, DefaultCapability) { 254 TEST_F(MediaStreamVideoSourceTest, DefaultCapability) {
290 media::VideoCaptureFormats formats; 255 media::VideoCaptureFormats formats;
291 formats.push_back(media::VideoCaptureFormat( 256 formats.push_back(media::VideoCaptureFormat(
292 gfx::Size(MediaStreamVideoSource::kDefaultWidth, 257 gfx::Size(MediaStreamVideoSource::kDefaultWidth,
293 MediaStreamVideoSource::kDefaultHeight), 258 MediaStreamVideoSource::kDefaultHeight),
294 MediaStreamVideoSource::kDefaultFrameRate, 259 MediaStreamVideoSource::kDefaultFrameRate,
295 media::PIXEL_FORMAT_I420)); 260 media::PIXEL_FORMAT_I420));
296 mock_source()->SetSupportedFormats(formats); 261 mock_source()->SetSupportedFormats(formats);
297 262
298 blink::WebMediaConstraints constraints; 263 blink::WebMediaConstraints constraints;
299 constraints.initialize(); 264 constraints.initialize();
300 CreateTrackAndStartSource(constraints, 265 CreateTrackAndStartSource(constraints,
301 MediaStreamVideoSource::kDefaultWidth, 266 MediaStreamVideoSource::kDefaultWidth,
302 MediaStreamVideoSource::kDefaultHeight, 267 MediaStreamVideoSource::kDefaultHeight,
303 30); 268 30);
304 } 269 }
305 270
306 TEST_F(MediaStreamVideoSourceTest, InvalidMandatoryConstraint) { 271 TEST_F(MediaStreamVideoSourceTest, InvalidMandatoryConstraint) {
307 ConstraintsFactory factory; 272 MockMediaConstraintFactory factory;
308 factory.AddMandatory("weird key", 640); 273 factory.AddMandatory("weird key", 640);
309 CreateTrack("123", factory.CreateConstraints()); 274 CreateTrack("123", factory.CreateWebMediaConstraints());
310 mock_source()->CompleteGetSupportedFormats(); 275 mock_source()->CompleteGetSupportedFormats();
311 EXPECT_EQ(1, NumberOfFailedConstraintsCallbacks()); 276 EXPECT_EQ(1, NumberOfFailedConstraintsCallbacks());
312 } 277 }
313 278
314 // Test that the source ignores an unknown optional constraint. 279 // Test that the source ignores an unknown optional constraint.
315 TEST_F(MediaStreamVideoSourceTest, InvalidOptionalConstraint) { 280 TEST_F(MediaStreamVideoSourceTest, InvalidOptionalConstraint) {
316 ConstraintsFactory factory; 281 MockMediaConstraintFactory factory;
317 factory.AddOptional("weird key", 640); 282 factory.AddOptional("weird key", 640);
318 283
319 CreateTrackAndStartSource(factory.CreateConstraints(), 284 CreateTrackAndStartSource(factory.CreateWebMediaConstraints(),
320 MediaStreamVideoSource::kDefaultWidth, 285 MediaStreamVideoSource::kDefaultWidth,
321 MediaStreamVideoSource::kDefaultHeight, 286 MediaStreamVideoSource::kDefaultHeight,
322 30); 287 30);
323 } 288 }
324 289
325 // Tests that the source starts video with the max width and height set by 290 // Tests that the source starts video with the max width and height set by
326 // constraints for screencast. 291 // constraints for screencast.
327 TEST_F(MediaStreamVideoSourceTest, ScreencastResolutionWithConstraint) { 292 TEST_F(MediaStreamVideoSourceTest, ScreencastResolutionWithConstraint) {
328 media::VideoCaptureFormats formats; 293 media::VideoCaptureFormats formats;
329 formats.push_back(media::VideoCaptureFormat( 294 formats.push_back(media::VideoCaptureFormat(
330 gfx::Size(480, 270), 30, media::PIXEL_FORMAT_I420)); 295 gfx::Size(480, 270), 30, media::PIXEL_FORMAT_I420));
331 mock_source()->SetSupportedFormats(formats); 296 mock_source()->SetSupportedFormats(formats);
332 ConstraintsFactory factory; 297 MockMediaConstraintFactory factory;
333 factory.AddMandatory(MediaStreamVideoSource::kMaxWidth, 480); 298 factory.AddMandatory(MediaStreamVideoSource::kMaxWidth, 480);
334 factory.AddMandatory(MediaStreamVideoSource::kMaxHeight, 270); 299 factory.AddMandatory(MediaStreamVideoSource::kMaxHeight, 270);
335 300
336 CreateTrackAndStartSource(factory.CreateConstraints(), 480, 270, 30); 301 CreateTrackAndStartSource(factory.CreateWebMediaConstraints(), 480, 270, 30);
337 EXPECT_EQ(480, mock_source()->max_requested_height()); 302 EXPECT_EQ(480, mock_source()->max_requested_height());
338 EXPECT_EQ(270, mock_source()->max_requested_width()); 303 EXPECT_EQ(270, mock_source()->max_requested_width());
339 } 304 }
340 305
341 // Test that optional constraints are applied in order. 306 // Test that optional constraints are applied in order.
342 TEST_F(MediaStreamVideoSourceTest, OptionalConstraints) { 307 TEST_F(MediaStreamVideoSourceTest, OptionalConstraints) {
343 ConstraintsFactory factory; 308 MockMediaConstraintFactory factory;
344 // Min width of 2056 pixels can not be fulfilled. 309 // Min width of 2056 pixels can not be fulfilled.
345 factory.AddOptional(MediaStreamVideoSource::kMinWidth, 2056); 310 factory.AddOptional(MediaStreamVideoSource::kMinWidth, 2056);
346 factory.AddOptional(MediaStreamVideoSource::kMinWidth, 641); 311 factory.AddOptional(MediaStreamVideoSource::kMinWidth, 641);
347 // Since min width is set to 641 pixels, max width 640 can not be fulfilled. 312 // Since min width is set to 641 pixels, max width 640 can not be fulfilled.
348 factory.AddOptional(MediaStreamVideoSource::kMaxWidth, 640); 313 factory.AddOptional(MediaStreamVideoSource::kMaxWidth, 640);
349 CreateTrackAndStartSource(factory.CreateConstraints(), 1280, 720, 30); 314 CreateTrackAndStartSource(factory.CreateWebMediaConstraints(), 1280, 720, 30);
350 } 315 }
351 316
352 // Test that the webrtc video adapter can be created and that it received 317 // Test that the webrtc video adapter can be created and that it received
353 // video frames if the source deliver video frames. 318 // video frames if the source deliver video frames.
354 TEST_F(MediaStreamVideoSourceTest, AdapterReceiveVideoFrame) { 319 TEST_F(MediaStreamVideoSourceTest, AdapterReceiveVideoFrame) {
355 ConstraintsFactory factory; 320 MockMediaConstraintFactory factory;
356 CreateTrackAndStartSource(factory.CreateConstraints(), 321 CreateTrackAndStartSource(factory.CreateWebMediaConstraints(),
357 MediaStreamVideoSource::kDefaultWidth, 322 MediaStreamVideoSource::kDefaultWidth,
358 MediaStreamVideoSource::kDefaultHeight, 323 MediaStreamVideoSource::kDefaultHeight,
359 MediaStreamVideoSource::kDefaultFrameRate); 324 MediaStreamVideoSource::kDefaultFrameRate);
360 ASSERT_TRUE(mock_source()->GetAdapter()); 325 ASSERT_TRUE(mock_source()->GetAdapter());
361 MockVideoSource* adapter = static_cast<MockVideoSource*>( 326 MockVideoSource* adapter = static_cast<MockVideoSource*>(
362 mock_source()->GetAdapter()); 327 mock_source()->GetAdapter());
363 EXPECT_EQ(0, adapter->GetFrameNum()); 328 EXPECT_EQ(0, adapter->GetFrameNum());
364 329
365 scoped_refptr<media::VideoFrame> frame = 330 scoped_refptr<media::VideoFrame> frame =
366 media::VideoFrame::CreateBlackFrame( 331 media::VideoFrame::CreateBlackFrame(
367 gfx::Size(MediaStreamVideoSource::kDefaultWidth, 332 gfx::Size(MediaStreamVideoSource::kDefaultWidth,
368 MediaStreamVideoSource::kDefaultHeight)); 333 MediaStreamVideoSource::kDefaultHeight));
369 mock_source()->DeliverVideoFrame(frame); 334 mock_source()->DeliverVideoFrame(frame);
370 EXPECT_EQ(1, adapter->GetFrameNum()); 335 EXPECT_EQ(1, adapter->GetFrameNum());
371 EXPECT_EQ(MediaStreamVideoSource::kDefaultWidth, 336 EXPECT_EQ(MediaStreamVideoSource::kDefaultWidth,
372 adapter->GetLastFrameWidth()); 337 adapter->GetLastFrameWidth());
373 EXPECT_EQ(MediaStreamVideoSource::kDefaultHeight, 338 EXPECT_EQ(MediaStreamVideoSource::kDefaultHeight,
374 adapter->GetLastFrameHeight()); 339 adapter->GetLastFrameHeight());
375 } 340 }
376 341
377 // Test that the source crops to the requested max width and 342 // Test that the source crops to the requested max width and
378 // height even though the camera delivers a larger frame. 343 // height even though the camera delivers a larger frame.
379 TEST_F(MediaStreamVideoSourceTest, DeliverCroppedVideoFrameOptional640360) { 344 TEST_F(MediaStreamVideoSourceTest, DeliverCroppedVideoFrameOptional640360) {
380 ConstraintsFactory factory; 345 MockMediaConstraintFactory factory;
381 factory.AddOptional(MediaStreamVideoSource::kMaxWidth, 640); 346 factory.AddOptional(MediaStreamVideoSource::kMaxWidth, 640);
382 factory.AddOptional(MediaStreamVideoSource::kMaxHeight, 360); 347 factory.AddOptional(MediaStreamVideoSource::kMaxHeight, 360);
383 TestSourceCropFrame(640, 480, factory.CreateConstraints(), 640, 360); 348 TestSourceCropFrame(640, 480, factory.CreateWebMediaConstraints(), 640, 360);
384 } 349 }
385 350
386 TEST_F(MediaStreamVideoSourceTest, DeliverCroppedVideoFrameMandatory640360) { 351 TEST_F(MediaStreamVideoSourceTest, DeliverCroppedVideoFrameMandatory640360) {
387 ConstraintsFactory factory; 352 MockMediaConstraintFactory factory;
388 factory.AddMandatory(MediaStreamVideoSource::kMaxWidth, 640); 353 factory.AddMandatory(MediaStreamVideoSource::kMaxWidth, 640);
389 factory.AddMandatory(MediaStreamVideoSource::kMaxHeight, 360); 354 factory.AddMandatory(MediaStreamVideoSource::kMaxHeight, 360);
390 TestSourceCropFrame(640, 480, factory.CreateConstraints(), 640, 360); 355 TestSourceCropFrame(640, 480, factory.CreateWebMediaConstraints(), 640, 360);
391 } 356 }
392 357
393 TEST_F(MediaStreamVideoSourceTest, DeliverCroppedVideoFrameMandatory732489) { 358 TEST_F(MediaStreamVideoSourceTest, DeliverCroppedVideoFrameMandatory732489) {
394 ConstraintsFactory factory; 359 MockMediaConstraintFactory factory;
395 factory.AddMandatory(MediaStreamVideoSource::kMaxWidth, 732); 360 factory.AddMandatory(MediaStreamVideoSource::kMaxWidth, 732);
396 factory.AddMandatory(MediaStreamVideoSource::kMaxHeight, 489); 361 factory.AddMandatory(MediaStreamVideoSource::kMaxHeight, 489);
397 factory.AddMandatory(MediaStreamVideoSource::kMinWidth, 732); 362 factory.AddMandatory(MediaStreamVideoSource::kMinWidth, 732);
398 factory.AddMandatory(MediaStreamVideoSource::kMinWidth, 489); 363 factory.AddMandatory(MediaStreamVideoSource::kMinWidth, 489);
399 TestSourceCropFrame(1280, 720, factory.CreateConstraints(), 732, 489); 364 TestSourceCropFrame(1280, 720, factory.CreateWebMediaConstraints(), 732, 489);
400 } 365 }
401 366
402 // Test that the source crops to the requested max width and 367 // Test that the source crops to the requested max width and
403 // height even though the requested frame has odd size. 368 // height even though the requested frame has odd size.
404 TEST_F(MediaStreamVideoSourceTest, DeliverCroppedVideoFrame637359) { 369 TEST_F(MediaStreamVideoSourceTest, DeliverCroppedVideoFrame637359) {
405 ConstraintsFactory factory; 370 MockMediaConstraintFactory factory;
406 factory.AddOptional(MediaStreamVideoSource::kMaxWidth, 637); 371 factory.AddOptional(MediaStreamVideoSource::kMaxWidth, 637);
407 factory.AddOptional(MediaStreamVideoSource::kMaxHeight, 359); 372 factory.AddOptional(MediaStreamVideoSource::kMaxHeight, 359);
408 TestSourceCropFrame(640, 480, factory.CreateConstraints(), 637, 359); 373 TestSourceCropFrame(640, 480, factory.CreateWebMediaConstraints(), 637, 359);
409 } 374 }
410 375
411 TEST_F(MediaStreamVideoSourceTest, DeliverSmallerSizeWhenTooLargeMax) { 376 TEST_F(MediaStreamVideoSourceTest, DeliverSmallerSizeWhenTooLargeMax) {
412 ConstraintsFactory factory; 377 MockMediaConstraintFactory factory;
413 factory.AddOptional(MediaStreamVideoSource::kMaxWidth, 1920); 378 factory.AddOptional(MediaStreamVideoSource::kMaxWidth, 1920);
414 factory.AddOptional(MediaStreamVideoSource::kMaxHeight, 1080); 379 factory.AddOptional(MediaStreamVideoSource::kMaxHeight, 1080);
415 factory.AddOptional(MediaStreamVideoSource::kMinWidth, 1280); 380 factory.AddOptional(MediaStreamVideoSource::kMinWidth, 1280);
416 factory.AddOptional(MediaStreamVideoSource::kMinHeight, 720); 381 factory.AddOptional(MediaStreamVideoSource::kMinHeight, 720);
417 TestSourceCropFrame(1280, 720, factory.CreateConstraints(), 1280, 720); 382 TestSourceCropFrame(1280, 720, factory.CreateWebMediaConstraints(),
383 1280, 720);
418 } 384 }
419 385
420 } // namespace content 386 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698