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

Side by Side Diff: content/browser/media/webrtc_getusermedia_browsertest.cc

Issue 195363002: VideoCapturerDelegate: Retrieve supported/in-use format(s) for constraint negotiation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 "base/debug/trace_event_impl.h" 5 #include "base/debug/trace_event_impl.h"
6 #include "base/json/json_reader.h" 6 #include "base/json/json_reader.h"
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "base/test/trace_event_analyzer.h" 8 #include "base/test/trace_event_analyzer.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "content/browser/media/webrtc_internals.h" 10 #include "content/browser/media/webrtc_internals.h"
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 "something invalid"))); 326 "something invalid")));
327 327
328 // Test with empty optional audio sourceID. 328 // Test with empty optional audio sourceID.
329 EXPECT_EQ(kOK, ExecuteJavascriptAndReturnResult( 329 EXPECT_EQ(kOK, ExecuteJavascriptAndReturnResult(
330 GenerateGetUserMediaWithOptionalSourceID( 330 GenerateGetUserMediaWithOptionalSourceID(
331 kGetUserMediaAndStop, 331 kGetUserMediaAndStop,
332 "", 332 "",
333 video_ids[0]))); 333 video_ids[0])));
334 } 334 }
335 335
336 // Test that opening an unsupported resolution ends up in an error.
337 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest,
338 GetVideoStreamWithUnsupportedVideoSize) {
339 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
perkj_chrome 2014/03/12 19:55:48 Oh, I did this in https://codereview.chromium.org/
mcasas 2014/03/13 08:04:56 I'll remove these two tests then, but I'd recommen
340 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
341 NavigateToURL(shell(), url);
342
343 std::string too_large_constraints = GenerateGetUserMediaCall(
344 kGetUserMediaAndStop, 800, 800, 600, 600, 20, 20);
345 DCHECK_NE(kOK, ExecuteJavascriptAndReturnResult(too_large_constraints));
346 }
347
348 // Test that opening an unsupported frame rate ends up in an error.
349 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest,
350 GetVideoStreamWithUnsupportedFrameRate) {
351 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
perkj_chrome 2014/03/12 19:55:48 Do we need a special test for this? I think this i
mcasas 2014/03/13 08:04:56 See above.
352 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
353 NavigateToURL(shell(), url);
354
355 std::string too_fast_constraints = GenerateGetUserMediaCall(
356 kGetUserMediaAndStop, 640, 640, 480, 480, 30, 30);
357 DCHECK_NE(kOK, ExecuteJavascriptAndReturnResult(too_fast_constraints));
358 }
359
336 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, TwoGetUserMediaAndStop) { 360 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, TwoGetUserMediaAndStop) {
337 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 361 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
338 362
339 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); 363 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
340 NavigateToURL(shell(), url); 364 NavigateToURL(shell(), url);
341 365
342 ExecuteJavascriptAndWaitForOk( 366 ExecuteJavascriptAndWaitForOk(
343 "twoGetUserMediaAndStop({video: true, audio: true});"); 367 "twoGetUserMediaAndStop({video: true, audio: true});");
344 } 368 }
345 369
(...skipping 11 matching lines...) Expand all
357 } 381 }
358 382
359 // This test calls getUserMedia and checks for aspect ratio behavior. 383 // This test calls getUserMedia and checks for aspect ratio behavior.
360 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, 384 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest,
361 TestGetUserMediaAspectRatio4To3) { 385 TestGetUserMediaAspectRatio4To3) {
362 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 386 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
363 387
364 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); 388 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
365 389
366 std::string constraints_4_3 = GenerateGetUserMediaCall( 390 std::string constraints_4_3 = GenerateGetUserMediaCall(
367 kGetUserMediaAndAnalyseAndStop, 640, 640, 480, 480, 30, 30); 391 kGetUserMediaAndAnalyseAndStop, 640, 640, 480, 480, 20, 20);
perkj_chrome 2014/03/12 19:55:48 Can we skip changing the maxFramerate and only cha
mcasas 2014/03/13 08:04:56 Done.
368 392
369 // TODO(mcasas): add more aspect ratios, in particular 16:10 crbug.com/275594. 393 // TODO(mcasas): add more aspect ratios, in particular 16:10 crbug.com/275594.
370 394
371 NavigateToURL(shell(), url); 395 NavigateToURL(shell(), url);
372 ASSERT_EQ("4:3 letterbox", 396 ASSERT_EQ("4:3 letterbox",
373 ExecuteJavascriptAndReturnResult(constraints_4_3)); 397 ExecuteJavascriptAndReturnResult(constraints_4_3));
374 } 398 }
375 399
376 // This test calls getUserMedia and checks for aspect ratio behavior. 400 // This test calls getUserMedia and checks for aspect ratio behavior.
377 // TODO(perkj): Enable this test as soon as crbug/349450 is fixed. 401 // TODO(perkj): Enable this test as soon as crbug/349450 is fixed.
378 // Currently the render pipeline doesn't support cropping where the new cropped 402 // Currently the render pipeline doesn't support cropping where the new cropped
379 // frame doesn't have the same top left coordinates as the original frame. 403 // frame doesn't have the same top left coordinates as the original frame.
380 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, 404 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest,
381 DISABLED_TestGetUserMediaAspectRatio16To9) { 405 DISABLED_TestGetUserMediaAspectRatio16To9) {
382 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 406 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
383 407
384 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); 408 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
385 409
386 std::string constraints_16_9 = GenerateGetUserMediaCall( 410 std::string constraints_16_9 = GenerateGetUserMediaCall(
387 kGetUserMediaAndAnalyseAndStop, 640, 640, 360, 360, 30, 30); 411 kGetUserMediaAndAnalyseAndStop, 640, 640, 360, 360, 20, 20);
388 412
389 NavigateToURL(shell(), url); 413 NavigateToURL(shell(), url);
390 ASSERT_EQ("16:9 letterbox", 414 ASSERT_EQ("16:9 letterbox",
391 ExecuteJavascriptAndReturnResult(constraints_16_9)); 415 ExecuteJavascriptAndReturnResult(constraints_16_9));
392 } 416 }
393 417
394 namespace { 418 namespace {
395 419
396 struct UserMediaSizes { 420 struct UserMediaSizes {
397 int min_width; 421 int min_width;
(...skipping 29 matching lines...) Expand all
427 user_media().min_height, 451 user_media().min_height,
428 user_media().max_height, 452 user_media().max_height,
429 user_media().min_frame_rate, 453 user_media().min_frame_rate,
430 user_media().max_frame_rate); 454 user_media().max_frame_rate);
431 DVLOG(1) << "Calling getUserMedia: " << call; 455 DVLOG(1) << "Calling getUserMedia: " << call;
432 NavigateToURL(shell(), url); 456 NavigateToURL(shell(), url);
433 ExecuteJavascriptAndWaitForOk(call); 457 ExecuteJavascriptAndWaitForOk(call);
434 } 458 }
435 459
436 static const UserMediaSizes kAllUserMediaSizes[] = { 460 static const UserMediaSizes kAllUserMediaSizes[] = {
437 {320, 320, 180, 180, 30, 30}, 461 {320, 320, 180, 180, 20, 20},
438 {320, 320, 240, 240, 30, 30}, 462 {320, 320, 240, 240, 20, 20},
439 {640, 640, 360, 360, 30, 30}, 463 {640, 640, 360, 360, 20, 20},
440 {640, 640, 480, 480, 30, 30}, 464 {640, 640, 480, 480, 20, 20},
441 {960, 960, 720, 720, 30, 30}, 465 {960, 960, 720, 720, 20, 20},
442 {1280, 1280, 720, 720, 30, 30}, 466 {1280, 1280, 720, 720, 20, 20},
443 {1920, 1920, 1080, 1080, 30, 30}}; 467 {1920, 1920, 1080, 1080, 20, 20}};
444 468
445 INSTANTIATE_TEST_CASE_P(UserMedia, 469 INSTANTIATE_TEST_CASE_P(UserMedia,
446 WebRtcConstraintsBrowserTest, 470 WebRtcConstraintsBrowserTest,
447 testing::ValuesIn(kAllUserMediaSizes)); 471 testing::ValuesIn(kAllUserMediaSizes));
448 472
449 } // namespace content 473 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698