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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
421 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 421 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
422 | 422 |
423 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); | 423 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); |
424 NavigateToURL(shell(), url); | 424 NavigateToURL(shell(), url); |
425 | 425 |
426 ExecuteJavascriptAndWaitForOk( | 426 ExecuteJavascriptAndWaitForOk( |
427 "twoGetUserMediaAndStop({video: true, audio: true});"); | 427 "twoGetUserMediaAndStop({video: true, audio: true});"); |
428 } | 428 } |
429 | 429 |
430 IN_PROC_BROWSER_TEST_P(WebRtcGetUserMediaBrowserTest, | 430 IN_PROC_BROWSER_TEST_P(WebRtcGetUserMediaBrowserTest, |
431 TwoGetUserMediaWithEqualConstraints) { | |
432 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | |
433 | |
434 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); | |
435 NavigateToURL(shell(), url); | |
436 | |
437 std::string constraints1 = "{video: true, audio: true}"; | |
tommi (sloooow) - chröme
2014/05/09 11:16:13
nit: why not just |constraints|? (why do you need
perkj_chrome
2014/05/13 11:05:56
Refactored.
| |
438 std::string constraints2 = "{video: true, audio: true}"; | |
439 | |
440 std::string command = "twoGetUserMedia(" + constraints1 + ',' + | |
441 constraints2 + ')'; | |
442 | |
443 EXPECT_EQ("w=640:h=480-w=640:h=480", | |
444 ExecuteJavascriptAndReturnResult(command)); | |
445 } | |
446 | |
447 IN_PROC_BROWSER_TEST_P(WebRtcGetUserMediaBrowserTest, | |
448 TwoGetUserMediaWithSecondVideoCropped) { | |
449 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | |
450 | |
451 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); | |
452 NavigateToURL(shell(), url); | |
453 | |
454 std::string constraints1 = "{video: true}"; | |
455 std::string constraints2 = "{video: {mandatory: {maxHeight: 360}}}"; | |
456 | |
457 std::string command = "twoGetUserMedia(" + constraints1 + ',' + | |
458 constraints2 + ')'; | |
459 | |
460 EXPECT_EQ("w=640:h=480-w=640:h=360", | |
461 ExecuteJavascriptAndReturnResult(command)); | |
462 } | |
463 | |
464 IN_PROC_BROWSER_TEST_P(WebRtcGetUserMediaBrowserTest, | |
465 TwoGetUserMediaWithFirstHdSecondVga) { | |
466 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | |
467 | |
468 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); | |
469 NavigateToURL(shell(), url); | |
470 | |
471 std::string constraints1 = | |
472 "{video: {mandatory: {minWidth:1280 , minHeight: 720}}}"; | |
473 std::string constraints2 = | |
474 "{video: {mandatory: {maxWidth:640 , maxHeight: 480}}}"; | |
475 | |
476 std::string command = "twoGetUserMedia(" + constraints1 + ',' + | |
tommi (sloooow) - chröme
2014/05/09 11:16:13
suggestion: make a method, std::string TwoGetUserM
perkj_chrome
2014/05/13 11:05:56
I went for Miguels request below.
| |
477 constraints2 + ')'; | |
478 | |
479 EXPECT_EQ("w=1280:h=720-w=640:h=480", | |
480 ExecuteJavascriptAndReturnResult(command)); | |
481 } | |
mcasas
2014/05/09 07:46:24
These three tests share code. What about a method
perkj_chrome
2014/05/13 11:05:56
Done.
| |
482 | |
483 IN_PROC_BROWSER_TEST_P(WebRtcGetUserMediaBrowserTest, | |
431 GetUserMediaWithTooHighVideoConstraintsValues) { | 484 GetUserMediaWithTooHighVideoConstraintsValues) { |
432 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 485 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
433 | 486 |
434 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); | 487 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); |
435 | 488 |
436 int large_value = 99999; | 489 int large_value = 99999; |
437 std::string call = GenerateGetUserMediaCall(kGetUserMediaAndExpectFailure, | 490 std::string call = GenerateGetUserMediaCall(kGetUserMediaAndExpectFailure, |
438 large_value, | 491 large_value, |
439 large_value, | 492 large_value, |
440 large_value, | 493 large_value, |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
553 {640, 640, 360, 360, 10, 30}, | 606 {640, 640, 360, 360, 10, 30}, |
554 {640, 640, 480, 480, 10, 30}, | 607 {640, 640, 480, 480, 10, 30}, |
555 {960, 960, 720, 720, 10, 30}, | 608 {960, 960, 720, 720, 10, 30}, |
556 {1280, 1280, 720, 720, 10, 30}}; | 609 {1280, 1280, 720, 720, 10, 30}}; |
557 | 610 |
558 INSTANTIATE_TEST_CASE_P(UserMedia, | 611 INSTANTIATE_TEST_CASE_P(UserMedia, |
559 WebRtcConstraintsBrowserTest, | 612 WebRtcConstraintsBrowserTest, |
560 testing::ValuesIn(kAllUserMediaSizes)); | 613 testing::ValuesIn(kAllUserMediaSizes)); |
561 | 614 |
562 } // namespace content | 615 } // namespace content |
OLD | NEW |