OLD | NEW |
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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/debug/trace_event_impl.h" | 6 #include "base/debug/trace_event_impl.h" |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "base/test/trace_event_analyzer.h" | 9 #include "base/test/trace_event_analyzer.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 } | 461 } |
462 | 462 |
463 // This test calls getUserMedia and checks for aspect ratio behavior. | 463 // This test calls getUserMedia and checks for aspect ratio behavior. |
464 IN_PROC_BROWSER_TEST_P(WebRtcGetUserMediaBrowserTest, | 464 IN_PROC_BROWSER_TEST_P(WebRtcGetUserMediaBrowserTest, |
465 TestGetUserMediaAspectRatio4To3) { | 465 TestGetUserMediaAspectRatio4To3) { |
466 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 466 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
467 | 467 |
468 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); | 468 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); |
469 | 469 |
470 std::string constraints_4_3 = GenerateGetUserMediaCall( | 470 std::string constraints_4_3 = GenerateGetUserMediaCall( |
471 kGetUserMediaAndAnalyseAndStop, 640, 640, 480, 480, 30, 30); | 471 kGetUserMediaAndAnalyseAndStop, 640, 640, 480, 480, 10, 30); |
472 | 472 |
473 NavigateToURL(shell(), url); | 473 NavigateToURL(shell(), url); |
474 ASSERT_EQ("w=640:h=480", | 474 ASSERT_EQ("w=640:h=480", |
475 ExecuteJavascriptAndReturnResult(constraints_4_3)); | 475 ExecuteJavascriptAndReturnResult(constraints_4_3)); |
476 } | 476 } |
477 | 477 |
478 // This test calls getUserMedia and checks for aspect ratio behavior. | 478 // This test calls getUserMedia and checks for aspect ratio behavior. |
479 IN_PROC_BROWSER_TEST_P(WebRtcGetUserMediaBrowserTest, | 479 IN_PROC_BROWSER_TEST_P(WebRtcGetUserMediaBrowserTest, |
480 TestGetUserMediaAspectRatio16To9) { | 480 TestGetUserMediaAspectRatio16To9) { |
481 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 481 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
482 | 482 |
483 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); | 483 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); |
484 | 484 |
485 std::string constraints_16_9 = GenerateGetUserMediaCall( | 485 std::string constraints_16_9 = GenerateGetUserMediaCall( |
486 kGetUserMediaAndAnalyseAndStop, 640, 640, 360, 360, 30, 30); | 486 kGetUserMediaAndAnalyseAndStop, 640, 640, 360, 360, 10, 30); |
487 | 487 |
488 NavigateToURL(shell(), url); | 488 NavigateToURL(shell(), url); |
489 ASSERT_EQ("w=640:h=360", | 489 ASSERT_EQ("w=640:h=360", |
490 ExecuteJavascriptAndReturnResult(constraints_16_9)); | 490 ExecuteJavascriptAndReturnResult(constraints_16_9)); |
491 } | 491 } |
492 | 492 |
493 // This test calls getUserMedia and checks for aspect ratio behavior. | 493 // This test calls getUserMedia and checks for aspect ratio behavior. |
494 IN_PROC_BROWSER_TEST_P(WebRtcGetUserMediaBrowserTest, | 494 IN_PROC_BROWSER_TEST_P(WebRtcGetUserMediaBrowserTest, |
495 TestGetUserMediaAspectRatio1To1) { | 495 TestGetUserMediaAspectRatio1To1) { |
496 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 496 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
497 | 497 |
498 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); | 498 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); |
499 | 499 |
500 std::string constraints_1_1 = GenerateGetUserMediaCall( | 500 std::string constraints_1_1 = GenerateGetUserMediaCall( |
501 kGetUserMediaAndAnalyseAndStop, 320, 320, 320, 320, 30, 30); | 501 kGetUserMediaAndAnalyseAndStop, 320, 320, 320, 320, 10, 30); |
502 | 502 |
503 NavigateToURL(shell(), url); | 503 NavigateToURL(shell(), url); |
504 ASSERT_EQ("w=320:h=320", | 504 ASSERT_EQ("w=320:h=320", |
505 ExecuteJavascriptAndReturnResult(constraints_1_1)); | 505 ExecuteJavascriptAndReturnResult(constraints_1_1)); |
506 } | 506 } |
507 | 507 |
508 namespace { | 508 namespace { |
509 | 509 |
510 struct UserMediaSizes { | 510 struct UserMediaSizes { |
511 int min_width; | 511 int min_width; |
(...skipping 29 matching lines...) Expand all Loading... |
541 user_media().min_height, | 541 user_media().min_height, |
542 user_media().max_height, | 542 user_media().max_height, |
543 user_media().min_frame_rate, | 543 user_media().min_frame_rate, |
544 user_media().max_frame_rate); | 544 user_media().max_frame_rate); |
545 DVLOG(1) << "Calling getUserMedia: " << call; | 545 DVLOG(1) << "Calling getUserMedia: " << call; |
546 NavigateToURL(shell(), url); | 546 NavigateToURL(shell(), url); |
547 ExecuteJavascriptAndWaitForOk(call); | 547 ExecuteJavascriptAndWaitForOk(call); |
548 } | 548 } |
549 | 549 |
550 static const UserMediaSizes kAllUserMediaSizes[] = { | 550 static const UserMediaSizes kAllUserMediaSizes[] = { |
551 {320, 320, 180, 180, 30, 30}, | 551 {320, 320, 180, 180, 10, 30}, |
552 {320, 320, 240, 240, 30, 30}, | 552 {320, 320, 240, 240, 10, 30}, |
553 {640, 640, 360, 360, 30, 30}, | 553 {640, 640, 360, 360, 10, 30}, |
554 {640, 640, 480, 480, 30, 30}, | 554 {640, 640, 480, 480, 10, 30}, |
555 {960, 960, 720, 720, 30, 30}, | 555 {960, 960, 720, 720, 10, 30}, |
556 {1280, 1280, 720, 720, 30, 30}, | 556 {1280, 1280, 720, 720, 10, 30}}; |
557 {1920, 1920, 1080, 1080, 30, 30}}; | |
558 | 557 |
559 INSTANTIATE_TEST_CASE_P(UserMedia, | 558 INSTANTIATE_TEST_CASE_P(UserMedia, |
560 WebRtcConstraintsBrowserTest, | 559 WebRtcConstraintsBrowserTest, |
561 testing::ValuesIn(kAllUserMediaSizes)); | 560 testing::ValuesIn(kAllUserMediaSizes)); |
562 | 561 |
563 } // namespace content | 562 } // namespace content |
OLD | NEW |