| 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 private: | 233 private: |
| 234 base::debug::TraceLog* trace_log_; | 234 base::debug::TraceLog* trace_log_; |
| 235 scoped_refptr<base::RefCountedString> recorded_trace_data_; | 235 scoped_refptr<base::RefCountedString> recorded_trace_data_; |
| 236 scoped_refptr<MessageLoopRunner> message_loop_runner_; | 236 scoped_refptr<MessageLoopRunner> message_loop_runner_; |
| 237 }; | 237 }; |
| 238 | 238 |
| 239 // These tests will all make a getUserMedia call with different constraints and | 239 // These tests will all make a getUserMedia call with different constraints and |
| 240 // see that the success callback is called. If the error callback is called or | 240 // see that the success callback is called. If the error callback is called or |
| 241 // none of the callbacks are called the tests will simply time out and fail. | 241 // none of the callbacks are called the tests will simply time out and fail. |
| 242 | 242 |
| 243 // Test fails under MSan, http://crbug.com/448230 | 243 // Test fails under MSan, http://crbug.com/445745 |
| 244 #if defined(MEMORY_SANITIZER) | 244 #if defined(MEMORY_SANITIZER) |
| 245 #define MAYBE_GetVideoStreamAndStop DISABLED_GetVideoStreamAndStop | 245 #define MAYBE_GetVideoStreamAndStop DISABLED_GetVideoStreamAndStop |
| 246 #else | 246 #else |
| 247 #define MAYBE_GetVideoStreamAndStop GetVideoStreamAndStop | 247 #define MAYBE_GetVideoStreamAndStop GetVideoStreamAndStop |
| 248 #endif | 248 #endif |
| 249 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, | 249 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, |
| 250 MAYBE_GetVideoStreamAndStop) { | 250 MAYBE_GetVideoStreamAndStop) { |
| 251 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 251 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 252 | 252 |
| 253 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); | 253 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); |
| 254 NavigateToURL(shell(), url); | 254 NavigateToURL(shell(), url); |
| 255 | 255 |
| 256 ExecuteJavascriptAndWaitForOk( | 256 ExecuteJavascriptAndWaitForOk( |
| 257 base::StringPrintf("%s({video: true});", kGetUserMediaAndStop)); | 257 base::StringPrintf("%s({video: true});", kGetUserMediaAndStop)); |
| 258 } | 258 } |
| 259 | 259 |
| 260 // Test fails under MSan, http://crbug.com/448230 | 260 // Test fails under MSan, http://crbug.com/445745 |
| 261 #if defined(MEMORY_SANITIZER) | 261 #if defined(MEMORY_SANITIZER) |
| 262 #define MAYBE_RenderSameTrackMediastreamAndStop \ | 262 #define MAYBE_RenderSameTrackMediastreamAndStop \ |
| 263 DISABLED_RenderSameTrackMediastreamAndStop | 263 DISABLED_RenderSameTrackMediastreamAndStop |
| 264 #else | 264 #else |
| 265 #define MAYBE_RenderSameTrackMediastreamAndStop \ | 265 #define MAYBE_RenderSameTrackMediastreamAndStop \ |
| 266 RenderSameTrackMediastreamAndStop | 266 RenderSameTrackMediastreamAndStop |
| 267 #endif | 267 #endif |
| 268 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, | 268 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, |
| 269 MAYBE_RenderSameTrackMediastreamAndStop) { | 269 MAYBE_RenderSameTrackMediastreamAndStop) { |
| 270 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 270 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 | 460 |
| 461 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, | 461 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, |
| 462 TwoGetUserMediaWithSecondVideoCropped) { | 462 TwoGetUserMediaWithSecondVideoCropped) { |
| 463 std::string constraints1 = "{video: true}"; | 463 std::string constraints1 = "{video: true}"; |
| 464 std::string constraints2 = "{video: {mandatory: {maxHeight: 360}}}"; | 464 std::string constraints2 = "{video: {mandatory: {maxHeight: 360}}}"; |
| 465 std::string expected_result = "w=640:h=480-w=640:h=360"; | 465 std::string expected_result = "w=640:h=480-w=640:h=360"; |
| 466 RunTwoGetTwoGetUserMediaWithDifferentContraints(constraints1, constraints2, | 466 RunTwoGetTwoGetUserMediaWithDifferentContraints(constraints1, constraints2, |
| 467 expected_result); | 467 expected_result); |
| 468 } | 468 } |
| 469 | 469 |
| 470 // Test fails under MSan, http://crbug.com/445745 |
| 471 #if defined(MEMORY_SANITIZER) |
| 472 #define MAYBE_TwoGetUserMediaWithFirstHdSecondVga \ |
| 473 DISABLED_TwoGetUserMediaWithFirstHdSecondVga |
| 474 #else |
| 475 #define MAYBE_TwoGetUserMediaWithFirstHdSecondVga \ |
| 476 TwoGetUserMediaWithFirstHdSecondVga |
| 477 #endif |
| 470 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, | 478 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, |
| 471 TwoGetUserMediaWithFirstHdSecondVga) { | 479 MAYBE_TwoGetUserMediaWithFirstHdSecondVga) { |
| 472 std::string constraints1 = | 480 std::string constraints1 = |
| 473 "{video: {mandatory: {maxWidth:1280 , minWidth:1280 , maxHeight: 720,\ | 481 "{video: {mandatory: {maxWidth:1280 , minWidth:1280 , maxHeight: 720,\ |
| 474 minHeight: 720}}}"; | 482 minHeight: 720}}}"; |
| 475 std::string constraints2 = | 483 std::string constraints2 = |
| 476 "{video: {mandatory: {maxWidth:640 , maxHeight: 480}}}"; | 484 "{video: {mandatory: {maxWidth:640 , maxHeight: 480}}}"; |
| 477 std::string expected_result = "w=1280:h=720-w=640:h=480"; | 485 std::string expected_result = "w=1280:h=720-w=640:h=480"; |
| 478 RunTwoGetTwoGetUserMediaWithDifferentContraints(constraints1, constraints2, | 486 RunTwoGetTwoGetUserMediaWithDifferentContraints(constraints1, constraints2, |
| 479 expected_result); | 487 expected_result); |
| 480 } | 488 } |
| 481 | 489 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 493 std::string constraints1 = | 501 std::string constraints1 = |
| 494 "{video: {mandatory: {maxWidth:1920 , minWidth:1920 , maxHeight: 1080,\ | 502 "{video: {mandatory: {maxWidth:1920 , minWidth:1920 , maxHeight: 1080,\ |
| 495 minHeight: 1080}}}"; | 503 minHeight: 1080}}}"; |
| 496 std::string constraints2 = | 504 std::string constraints2 = |
| 497 "{video: {mandatory: {maxWidth:640 , maxHeight: 480}}}"; | 505 "{video: {mandatory: {maxWidth:640 , maxHeight: 480}}}"; |
| 498 std::string expected_result = "w=1920:h=1080-w=640:h=480"; | 506 std::string expected_result = "w=1920:h=1080-w=640:h=480"; |
| 499 RunTwoGetTwoGetUserMediaWithDifferentContraints(constraints1, constraints2, | 507 RunTwoGetTwoGetUserMediaWithDifferentContraints(constraints1, constraints2, |
| 500 expected_result); | 508 expected_result); |
| 501 } | 509 } |
| 502 | 510 |
| 503 // Test fails under MSan, http://crbug.com/448230 | 511 // Test fails under MSan, http://crbug.com/445745 |
| 504 #if defined(MEMORY_SANITIZER) | 512 #if defined(MEMORY_SANITIZER) |
| 505 #define MAYBE_TwoGetUserMediaAndVerifyFrameRate \ | 513 #define MAYBE_TwoGetUserMediaAndVerifyFrameRate \ |
| 506 DISABLED_TwoGetUserMediaAndVerifyFrameRate | 514 DISABLED_TwoGetUserMediaAndVerifyFrameRate |
| 507 #else | 515 #else |
| 508 #define MAYBE_TwoGetUserMediaAndVerifyFrameRate \ | 516 #define MAYBE_TwoGetUserMediaAndVerifyFrameRate \ |
| 509 TwoGetUserMediaAndVerifyFrameRate | 517 TwoGetUserMediaAndVerifyFrameRate |
| 510 #endif | 518 #endif |
| 511 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, | 519 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, |
| 512 MAYBE_TwoGetUserMediaAndVerifyFrameRate) { | 520 MAYBE_TwoGetUserMediaAndVerifyFrameRate) { |
| 513 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 521 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 // potential resizing. | 591 // potential resizing. |
| 584 IN_PROC_BROWSER_TEST_F( | 592 IN_PROC_BROWSER_TEST_F( |
| 585 WebRtcGetUserMediaBrowserTest, | 593 WebRtcGetUserMediaBrowserTest, |
| 586 TraceVideoCaptureControllerPerformanceDuringGetUserMedia) { | 594 TraceVideoCaptureControllerPerformanceDuringGetUserMedia) { |
| 587 RunGetUserMediaAndCollectMeasures( | 595 RunGetUserMediaAndCollectMeasures( |
| 588 10, | 596 10, |
| 589 "VideoCaptureController::OnIncomingCapturedData", | 597 "VideoCaptureController::OnIncomingCapturedData", |
| 590 "VideoCaptureController"); | 598 "VideoCaptureController"); |
| 591 } | 599 } |
| 592 | 600 |
| 593 // Test fails under MSan, http://crbug.com/448230 | 601 // Test fails under MSan, http://crbug.com/445745 |
| 594 #if defined(MEMORY_SANITIZER) | 602 #if defined(MEMORY_SANITIZER) |
| 595 #define MAYBE_TestGetUserMediaAspectRatio4To3 \ | 603 #define MAYBE_TestGetUserMediaAspectRatio4To3 \ |
| 596 DISABLED_TestGetUserMediaAspectRatio4To3 | 604 DISABLED_TestGetUserMediaAspectRatio4To3 |
| 597 #else | 605 #else |
| 598 #define MAYBE_TestGetUserMediaAspectRatio4To3 TestGetUserMediaAspectRatio4To3 | 606 #define MAYBE_TestGetUserMediaAspectRatio4To3 TestGetUserMediaAspectRatio4To3 |
| 599 #endif | 607 #endif |
| 600 // This test calls getUserMedia and checks for aspect ratio behavior. | 608 // This test calls getUserMedia and checks for aspect ratio behavior. |
| 601 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, | 609 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, |
| 602 MAYBE_TestGetUserMediaAspectRatio4To3) { | 610 MAYBE_TestGetUserMediaAspectRatio4To3) { |
| 603 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 611 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 604 | 612 |
| 605 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); | 613 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); |
| 606 | 614 |
| 607 std::string constraints_4_3 = GenerateGetUserMediaCall( | 615 std::string constraints_4_3 = GenerateGetUserMediaCall( |
| 608 kGetUserMediaAndAnalyseAndStop, 640, 640, 480, 480, 10, 30); | 616 kGetUserMediaAndAnalyseAndStop, 640, 640, 480, 480, 10, 30); |
| 609 | 617 |
| 610 NavigateToURL(shell(), url); | 618 NavigateToURL(shell(), url); |
| 611 ASSERT_EQ("w=640:h=480", | 619 ASSERT_EQ("w=640:h=480", |
| 612 ExecuteJavascriptAndReturnResult(constraints_4_3)); | 620 ExecuteJavascriptAndReturnResult(constraints_4_3)); |
| 613 } | 621 } |
| 614 | 622 |
| 615 // Test fails under MSan, http://crbug.com/448230 | 623 // Test fails under MSan, http://crbug.com/445745 |
| 616 #if defined(MEMORY_SANITIZER) | 624 #if defined(MEMORY_SANITIZER) |
| 617 #define MAYBE_TestGetUserMediaAspectRatio16To9 \ | 625 #define MAYBE_TestGetUserMediaAspectRatio16To9 \ |
| 618 DISABLED_TestGetUserMediaAspectRatio16To9 | 626 DISABLED_TestGetUserMediaAspectRatio16To9 |
| 619 #else | 627 #else |
| 620 #define MAYBE_TestGetUserMediaAspectRatio16To9 TestGetUserMediaAspectRatio16To9 | 628 #define MAYBE_TestGetUserMediaAspectRatio16To9 TestGetUserMediaAspectRatio16To9 |
| 621 #endif | 629 #endif |
| 622 // This test calls getUserMedia and checks for aspect ratio behavior. | 630 // This test calls getUserMedia and checks for aspect ratio behavior. |
| 623 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, | 631 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, |
| 624 MAYBE_TestGetUserMediaAspectRatio16To9) { | 632 MAYBE_TestGetUserMediaAspectRatio16To9) { |
| 625 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 633 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 626 | 634 |
| 627 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); | 635 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); |
| 628 | 636 |
| 629 std::string constraints_16_9 = GenerateGetUserMediaCall( | 637 std::string constraints_16_9 = GenerateGetUserMediaCall( |
| 630 kGetUserMediaAndAnalyseAndStop, 640, 640, 360, 360, 10, 30); | 638 kGetUserMediaAndAnalyseAndStop, 640, 640, 360, 360, 10, 30); |
| 631 | 639 |
| 632 NavigateToURL(shell(), url); | 640 NavigateToURL(shell(), url); |
| 633 ASSERT_EQ("w=640:h=360", | 641 ASSERT_EQ("w=640:h=360", |
| 634 ExecuteJavascriptAndReturnResult(constraints_16_9)); | 642 ExecuteJavascriptAndReturnResult(constraints_16_9)); |
| 635 } | 643 } |
| 636 | 644 |
| 637 // Test fails under MSan, http://crbug.com/448230 | 645 // Test fails under MSan, http://crbug.com/445745 |
| 638 #if defined(MEMORY_SANITIZER) | 646 #if defined(MEMORY_SANITIZER) |
| 639 #define MAYBE_TestGetUserMediaAspectRatio1To1 \ | 647 #define MAYBE_TestGetUserMediaAspectRatio1To1 \ |
| 640 DISABLED_TestGetUserMediaAspectRatio1To1 | 648 DISABLED_TestGetUserMediaAspectRatio1To1 |
| 641 #else | 649 #else |
| 642 #define MAYBE_TestGetUserMediaAspectRatio1To1 TestGetUserMediaAspectRatio1To1 | 650 #define MAYBE_TestGetUserMediaAspectRatio1To1 TestGetUserMediaAspectRatio1To1 |
| 643 #endif | 651 #endif |
| 644 // This test calls getUserMedia and checks for aspect ratio behavior. | 652 // This test calls getUserMedia and checks for aspect ratio behavior. |
| 645 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, | 653 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, |
| 646 MAYBE_TestGetUserMediaAspectRatio1To1) { | 654 MAYBE_TestGetUserMediaAspectRatio1To1) { |
| 647 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 655 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 673 : public WebRtcContentBrowserTest, | 681 : public WebRtcContentBrowserTest, |
| 674 public testing::WithParamInterface<UserMediaSizes> { | 682 public testing::WithParamInterface<UserMediaSizes> { |
| 675 public: | 683 public: |
| 676 WebRtcConstraintsBrowserTest() : user_media_(GetParam()) {} | 684 WebRtcConstraintsBrowserTest() : user_media_(GetParam()) {} |
| 677 const UserMediaSizes& user_media() const { return user_media_; } | 685 const UserMediaSizes& user_media() const { return user_media_; } |
| 678 | 686 |
| 679 private: | 687 private: |
| 680 UserMediaSizes user_media_; | 688 UserMediaSizes user_media_; |
| 681 }; | 689 }; |
| 682 | 690 |
| 683 // Test fails under MSan, http://crbug.com/448230 | 691 // Test fails under MSan, http://crbug.com/445745 |
| 684 #if defined(MEMORY_SANITIZER) | 692 #if defined(MEMORY_SANITIZER) |
| 685 #define MAYBE_GetUserMediaConstraints DISABLED_GetUserMediaConstraints | 693 #define MAYBE_GetUserMediaConstraints DISABLED_GetUserMediaConstraints |
| 686 #else | 694 #else |
| 687 #define MAYBE_GetUserMediaConstraints GetUserMediaConstraints | 695 #define MAYBE_GetUserMediaConstraints GetUserMediaConstraints |
| 688 #endif | 696 #endif |
| 689 // This test calls getUserMedia in sequence with different constraints. | 697 // This test calls getUserMedia in sequence with different constraints. |
| 690 IN_PROC_BROWSER_TEST_P(WebRtcConstraintsBrowserTest, | 698 IN_PROC_BROWSER_TEST_P(WebRtcConstraintsBrowserTest, |
| 691 MAYBE_GetUserMediaConstraints) { | 699 MAYBE_GetUserMediaConstraints) { |
| 692 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 700 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 693 | 701 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 711 {640, 640, 360, 360, 10, 30}, | 719 {640, 640, 360, 360, 10, 30}, |
| 712 {640, 640, 480, 480, 10, 30}, | 720 {640, 640, 480, 480, 10, 30}, |
| 713 {960, 960, 720, 720, 10, 30}, | 721 {960, 960, 720, 720, 10, 30}, |
| 714 {1280, 1280, 720, 720, 10, 30}}; | 722 {1280, 1280, 720, 720, 10, 30}}; |
| 715 | 723 |
| 716 INSTANTIATE_TEST_CASE_P(UserMedia, | 724 INSTANTIATE_TEST_CASE_P(UserMedia, |
| 717 WebRtcConstraintsBrowserTest, | 725 WebRtcConstraintsBrowserTest, |
| 718 testing::ValuesIn(kAllUserMediaSizes)); | 726 testing::ValuesIn(kAllUserMediaSizes)); |
| 719 | 727 |
| 720 } // namespace content | 728 } // namespace content |
| OLD | NEW |