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

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

Issue 2790823002: Spec compliant video constraints for getUserMedia behind flag. (Closed)
Patch Set: rebase Created 3 years, 8 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
« no previous file with comments | « no previous file | content/public/common/content_features.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/feature_list.h"
8 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
9 #include "base/memory/ref_counted_memory.h" 10 #include "base/memory/ref_counted_memory.h"
10 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 #include "base/test/scoped_feature_list.h"
11 #include "base/test/trace_event_analyzer.h" 13 #include "base/test/trace_event_analyzer.h"
12 #include "base/threading/thread_restrictions.h" 14 #include "base/threading/thread_restrictions.h"
13 #include "base/trace_event/trace_event_impl.h" 15 #include "base/trace_event/trace_event_impl.h"
14 #include "base/values.h" 16 #include "base/values.h"
15 #include "build/build_config.h" 17 #include "build/build_config.h"
16 #include "content/browser/browser_main_loop.h" 18 #include "content/browser/browser_main_loop.h"
17 #include "content/browser/renderer_host/media/media_stream_manager.h" 19 #include "content/browser/renderer_host/media/media_stream_manager.h"
18 #include "content/browser/web_contents/web_contents_impl.h" 20 #include "content/browser/web_contents/web_contents_impl.h"
19 #include "content/browser/webrtc/webrtc_content_browsertest_base.h" 21 #include "content/browser/webrtc/webrtc_content_browsertest_base.h"
20 #include "content/browser/webrtc/webrtc_internals.h" 22 #include "content/browser/webrtc/webrtc_internals.h"
23 #include "content/public/common/content_features.h"
21 #include "content/public/common/content_switches.h" 24 #include "content/public/common/content_switches.h"
22 #include "content/public/test/browser_test_utils.h" 25 #include "content/public/test/browser_test_utils.h"
23 #include "content/public/test/content_browser_test_utils.h" 26 #include "content/public/test/content_browser_test_utils.h"
24 #include "content/public/test/test_utils.h" 27 #include "content/public/test/test_utils.h"
25 #include "content/shell/browser/shell.h" 28 #include "content/shell/browser/shell.h"
26 #include "media/audio/audio_manager.h" 29 #include "media/audio/audio_manager.h"
27 #include "net/test/embedded_test_server/embedded_test_server.h" 30 #include "net/test/embedded_test_server/embedded_test_server.h"
28 #include "testing/perf/perf_test.h" 31 #include "testing/perf/perf_test.h"
29 32
30 #if defined(OS_WIN) 33 #if defined(OS_WIN)
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, 490 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest,
488 TwoGetUserMediaWithEqualConstraints) { 491 TwoGetUserMediaWithEqualConstraints) {
489 std::string constraints1 = "{video: true, audio: true}"; 492 std::string constraints1 = "{video: true, audio: true}";
490 const std::string& constraints2 = constraints1; 493 const std::string& constraints2 = constraints1;
491 std::string expected_result = "w=640:h=480-w=640:h=480"; 494 std::string expected_result = "w=640:h=480-w=640:h=480";
492 495
493 RunTwoGetTwoGetUserMediaWithDifferentContraints(constraints1, constraints2, 496 RunTwoGetTwoGetUserMediaWithDifferentContraints(constraints1, constraints2,
494 expected_result); 497 expected_result);
495 } 498 }
496 499
500 // TODO(guidou): Remove this test. http://crbug.com/706408
497 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, 501 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest,
498 TwoGetUserMediaWithSecondVideoCropped) { 502 TwoGetUserMediaWithSecondVideoCroppedOldConstraints) {
503 base::test::ScopedFeatureList scoped_feature_list;
504 scoped_feature_list.InitAndEnableFeature(
505 features::kMediaStreamOldVideoConstraints);
499 std::string constraints1 = "{video: true}"; 506 std::string constraints1 = "{video: true}";
500 std::string constraints2 = "{video: {mandatory: {maxHeight: 360}}}"; 507 std::string constraints2 = "{video: {mandatory: {maxHeight: 360}}}";
501 std::string expected_result = "w=640:h=480-w=640:h=360"; 508 std::string expected_result = "w=640:h=480-w=640:h=360";
502 RunTwoGetTwoGetUserMediaWithDifferentContraints(constraints1, constraints2, 509 RunTwoGetTwoGetUserMediaWithDifferentContraints(constraints1, constraints2,
503 expected_result); 510 expected_result);
504 } 511 }
505 512
513 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest,
514 TwoGetUserMediaWithSecondVideoCropped) {
515 base::test::ScopedFeatureList scoped_feature_list;
516 scoped_feature_list.InitAndDisableFeature(
517 features::kMediaStreamOldVideoConstraints);
518 std::string constraints1 = "{video: true}";
519 std::string constraints2 =
520 "{video: {width: {exact: 640}, height: {exact: 360}}}";
521 std::string expected_result = "w=640:h=480-w=640:h=360";
522 RunTwoGetTwoGetUserMediaWithDifferentContraints(constraints1, constraints2,
523 expected_result);
524 }
525
526 // Test fails under MSan, http://crbug.com/445745
527 // TODO(guidou): Remove this test. http://crbug.com/706408
528 #if defined(MEMORY_SANITIZER)
529 #define MAYBE_TwoGetUserMediaWithFirstHdSecondVgaOldConstraints \
530 DISABLED_TwoGetUserMediaWithFirstHdSecondVgaOldConstraints
531 #else
532 #define MAYBE_TwoGetUserMediaWithFirstHdSecondVgaOldConstraints \
533 TwoGetUserMediaWithFirstHdSecondVgaOldConstraints
534 #endif
535 IN_PROC_BROWSER_TEST_F(
536 WebRtcGetUserMediaBrowserTest,
537 MAYBE_TwoGetUserMediaWithFirstHdSecondVgaOldConstraints) {
538 base::test::ScopedFeatureList scoped_feature_list;
539 scoped_feature_list.InitAndEnableFeature(
540 features::kMediaStreamOldVideoConstraints);
541 std::string constraints1 =
542 "{video: {mandatory: {maxWidth:1280 , minWidth:1280 , maxHeight: 720, "
543 "minHeight: 720}}}";
544 std::string constraints2 =
545 "{video: {mandatory: {maxWidth:640 , maxHeight: 480}}}";
546 std::string expected_result = "w=1280:h=720-w=640:h=480";
547 RunTwoGetTwoGetUserMediaWithDifferentContraints(constraints1, constraints2,
548 expected_result);
549 }
550
506 // Test fails under MSan, http://crbug.com/445745 551 // Test fails under MSan, http://crbug.com/445745
507 #if defined(MEMORY_SANITIZER) 552 #if defined(MEMORY_SANITIZER)
508 #define MAYBE_TwoGetUserMediaWithFirstHdSecondVga \ 553 #define MAYBE_TwoGetUserMediaWithFirstHdSecondVga \
509 DISABLED_TwoGetUserMediaWithFirstHdSecondVga 554 DISABLED_TwoGetUserMediaWithFirstHdSecondVga
510 #else 555 #else
511 #define MAYBE_TwoGetUserMediaWithFirstHdSecondVga \ 556 #define MAYBE_TwoGetUserMediaWithFirstHdSecondVga \
512 TwoGetUserMediaWithFirstHdSecondVga 557 TwoGetUserMediaWithFirstHdSecondVga
513 #endif 558 #endif
514 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, 559 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest,
515 MAYBE_TwoGetUserMediaWithFirstHdSecondVga) { 560 MAYBE_TwoGetUserMediaWithFirstHdSecondVga) {
561 base::test::ScopedFeatureList scoped_feature_list;
562 scoped_feature_list.InitAndDisableFeature(
563 features::kMediaStreamOldVideoConstraints);
516 std::string constraints1 = 564 std::string constraints1 =
517 "{video: {mandatory: {maxWidth:1280 , minWidth:1280 , maxHeight: 720,\ 565 "{video: {width : {exact: 1280}, height: {exact: 720}}}";
518 minHeight: 720}}}";
519 std::string constraints2 = 566 std::string constraints2 =
520 "{video: {mandatory: {maxWidth:640 , maxHeight: 480}}}"; 567 "{video: {width : {exact: 640}, height: {exact: 480}}}";
521 std::string expected_result = "w=1280:h=720-w=640:h=480"; 568 std::string expected_result = "w=1280:h=720-w=640:h=480";
522 RunTwoGetTwoGetUserMediaWithDifferentContraints(constraints1, constraints2, 569 RunTwoGetTwoGetUserMediaWithDifferentContraints(constraints1, constraints2,
523 expected_result); 570 expected_result);
524 } 571 }
525 572
526 // Timing out on Windows 7 bot: http://crbug.com/443294 573 // Timing out on Windows 7 bot: http://crbug.com/443294
527 // Flaky: http://crbug.com/660656; possible the test is too perf sensitive. 574 // Flaky: http://crbug.com/660656; possible the test is too perf sensitive.
528 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, 575 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest,
529 DISABLED_TwoGetUserMediaWithFirst1080pSecondVga) { 576 DISABLED_TwoGetUserMediaWithFirst1080pSecondVga) {
530 std::string constraints1 = 577 std::string constraints1 =
531 "{video: {mandatory: {maxWidth:1920 , minWidth:1920 , maxHeight: 1080,\ 578 "{video: {mandatory: {maxWidth:1920 , minWidth:1920 , maxHeight: 1080, "
532 minHeight: 1080}}}"; 579 "minHeight: 1080}}}";
533 std::string constraints2 = 580 std::string constraints2 =
534 "{video: {mandatory: {maxWidth:640 , maxHeight: 480}}}"; 581 "{video: {mandatory: {maxWidth:640 , maxHeight: 480}}}";
535 std::string expected_result = "w=1920:h=1080-w=640:h=480"; 582 std::string expected_result = "w=1920:h=1080-w=640:h=480";
536 RunTwoGetTwoGetUserMediaWithDifferentContraints(constraints1, constraints2, 583 RunTwoGetTwoGetUserMediaWithDifferentContraints(constraints1, constraints2,
537 expected_result); 584 expected_result);
538 } 585 }
539 586
540 // Test fails under MSan, http://crbug.com/445745 587 // Test fails under MSan, http://crbug.com/445745
541 #if defined(MEMORY_SANITIZER) 588 #if defined(MEMORY_SANITIZER)
542 #define MAYBE_TwoGetUserMediaAndVerifyFrameRate \ 589 #define MAYBE_TwoGetUserMediaAndVerifyFrameRate \
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 base::Bind(&VerifyDisableLocalEcho, true)); 826 base::Bind(&VerifyDisableLocalEcho, true));
780 call = GenerateGetUserMediaWithDisableLocalEcho( 827 call = GenerateGetUserMediaWithDisableLocalEcho(
781 "getUserMediaAndExpectSuccess", "true"); 828 "getUserMediaAndExpectSuccess", "true");
782 ExecuteJavascriptAndWaitForOk(call); 829 ExecuteJavascriptAndWaitForOk(call);
783 830
784 manager->SetGenerateStreamCallbackForTesting( 831 manager->SetGenerateStreamCallbackForTesting(
785 MediaStreamManager::GenerateStreamTestCallback()); 832 MediaStreamManager::GenerateStreamTestCallback());
786 } 833 }
787 834
788 } // namespace content 835 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/public/common/content_features.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698