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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 large_value, | 494 large_value, |
495 large_value, | 495 large_value, |
496 large_value, | 496 large_value, |
497 large_value); | 497 large_value); |
498 NavigateToURL(shell(), url); | 498 NavigateToURL(shell(), url); |
499 | 499 |
500 EXPECT_EQ("ConstraintNotSatisfiedError", | 500 EXPECT_EQ("ConstraintNotSatisfiedError", |
501 ExecuteJavascriptAndReturnResult(call)); | 501 ExecuteJavascriptAndReturnResult(call)); |
502 } | 502 } |
503 | 503 |
| 504 // This test makes two getUserMedia requests, one with impossible constraints |
| 505 // that should trigger an error, and one with valid constraints. The test |
| 506 // verifies getUserMedia can succeed after being given impossible constraints. |
| 507 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, |
| 508 TwoGetUserMediaAndCheckCallbackAfterFailure) { |
| 509 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 510 |
| 511 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); |
| 512 NavigateToURL(shell(), url); |
| 513 |
| 514 int large_value = 99999; |
| 515 const std::string gum_with_impossible_constraints = |
| 516 GenerateGetUserMediaCall(kGetUserMediaAndExpectFailure, |
| 517 large_value, |
| 518 large_value, |
| 519 large_value, |
| 520 large_value, |
| 521 large_value, |
| 522 large_value); |
| 523 const std::string gum_with_vga_constraints = |
| 524 GenerateGetUserMediaCall(kGetUserMediaAndAnalyseAndStop, |
| 525 640, 640, 480, 480, 10, 30); |
| 526 |
| 527 ASSERT_EQ("ConstraintNotSatisfiedError", |
| 528 ExecuteJavascriptAndReturnResult(gum_with_impossible_constraints)); |
| 529 |
| 530 ASSERT_EQ("w=640:h=480", |
| 531 ExecuteJavascriptAndReturnResult(gum_with_vga_constraints)); |
| 532 } |
| 533 |
504 // This test will make a simple getUserMedia page, verify that video is playing | 534 // This test will make a simple getUserMedia page, verify that video is playing |
505 // in a simple local <video>, and for a couple of seconds, collect some | 535 // in a simple local <video>, and for a couple of seconds, collect some |
506 // performance traces from VideoCaptureController colorspace conversion and | 536 // performance traces from VideoCaptureController colorspace conversion and |
507 // potential resizing. | 537 // potential resizing. |
508 IN_PROC_BROWSER_TEST_F( | 538 IN_PROC_BROWSER_TEST_F( |
509 WebRtcGetUserMediaBrowserTest, | 539 WebRtcGetUserMediaBrowserTest, |
510 TraceVideoCaptureControllerPerformanceDuringGetUserMedia) { | 540 TraceVideoCaptureControllerPerformanceDuringGetUserMedia) { |
511 RunGetUserMediaAndCollectMeasures( | 541 RunGetUserMediaAndCollectMeasures( |
512 10, | 542 10, |
513 "VideoCaptureController::OnIncomingCapturedData", | 543 "VideoCaptureController::OnIncomingCapturedData", |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 {640, 640, 360, 360, 10, 30}, | 637 {640, 640, 360, 360, 10, 30}, |
608 {640, 640, 480, 480, 10, 30}, | 638 {640, 640, 480, 480, 10, 30}, |
609 {960, 960, 720, 720, 10, 30}, | 639 {960, 960, 720, 720, 10, 30}, |
610 {1280, 1280, 720, 720, 10, 30}}; | 640 {1280, 1280, 720, 720, 10, 30}}; |
611 | 641 |
612 INSTANTIATE_TEST_CASE_P(UserMedia, | 642 INSTANTIATE_TEST_CASE_P(UserMedia, |
613 WebRtcConstraintsBrowserTest, | 643 WebRtcConstraintsBrowserTest, |
614 testing::ValuesIn(kAllUserMediaSizes)); | 644 testing::ValuesIn(kAllUserMediaSizes)); |
615 | 645 |
616 } // namespace content | 646 } // namespace content |
OLD | NEW |