| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/memory/ref_counted_memory.h" | 9 #include "base/memory/ref_counted_memory.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 GetUserMediaWithInvalidMandatorySourceID) { | 407 GetUserMediaWithInvalidMandatorySourceID) { |
| 408 ASSERT_TRUE(embedded_test_server()->Start()); | 408 ASSERT_TRUE(embedded_test_server()->Start()); |
| 409 | 409 |
| 410 std::vector<std::string> audio_ids; | 410 std::vector<std::string> audio_ids; |
| 411 std::vector<std::string> video_ids; | 411 std::vector<std::string> video_ids; |
| 412 GetInputDevices(&audio_ids, &video_ids); | 412 GetInputDevices(&audio_ids, &video_ids); |
| 413 | 413 |
| 414 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); | 414 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); |
| 415 | 415 |
| 416 // Test with invalid mandatory audio sourceID. | 416 // Test with invalid mandatory audio sourceID. |
| 417 // TODO(guidou): Update error string when spec-compliant constraint resolution |
| 418 // for audio is implemented. See http://crbug.com/657733. |
| 417 NavigateToURL(shell(), url); | 419 NavigateToURL(shell(), url); |
| 418 EXPECT_EQ("DevicesNotFoundError", ExecuteJavascriptAndReturnResult( | 420 EXPECT_EQ("DevicesNotFoundError", ExecuteJavascriptAndReturnResult( |
| 419 GenerateGetUserMediaWithMandatorySourceID( | 421 GenerateGetUserMediaWithMandatorySourceID( |
| 420 kGetUserMediaAndExpectFailure, | 422 kGetUserMediaAndExpectFailure, |
| 421 "something invalid", | 423 "something invalid", |
| 422 video_ids[0]))); | 424 video_ids[0]))); |
| 423 | 425 |
| 424 // Test with invalid mandatory video sourceID. | 426 // Test with invalid mandatory video sourceID. |
| 427 EXPECT_EQ("ConstraintNotSatisfiedError", |
| 428 ExecuteJavascriptAndReturnResult( |
| 429 GenerateGetUserMediaWithMandatorySourceID( |
| 430 kGetUserMediaAndExpectFailure, audio_ids[0], |
| 431 "something invalid"))); |
| 432 |
| 433 // Test with empty mandatory audio sourceID. |
| 434 // TODO(guidou): Update error string when spec-compliant constraint resolution |
| 435 // for audio is implemented. See http://crbug.com/657733. |
| 425 EXPECT_EQ("DevicesNotFoundError", ExecuteJavascriptAndReturnResult( | 436 EXPECT_EQ("DevicesNotFoundError", ExecuteJavascriptAndReturnResult( |
| 426 GenerateGetUserMediaWithMandatorySourceID( | 437 GenerateGetUserMediaWithMandatorySourceID( |
| 427 kGetUserMediaAndExpectFailure, | 438 kGetUserMediaAndExpectFailure, |
| 428 audio_ids[0], | |
| 429 "something invalid"))); | |
| 430 | |
| 431 // Test with empty mandatory audio sourceID. | |
| 432 EXPECT_EQ("DevicesNotFoundError", ExecuteJavascriptAndReturnResult( | |
| 433 GenerateGetUserMediaWithMandatorySourceID( | |
| 434 kGetUserMediaAndExpectFailure, | |
| 435 "", | 439 "", |
| 436 video_ids[0]))); | 440 video_ids[0]))); |
| 437 } | 441 } |
| 438 | 442 |
| 439 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, | 443 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, |
| 440 GetUserMediaWithInvalidOptionalSourceID) { | 444 GetUserMediaWithInvalidOptionalSourceID) { |
| 441 ASSERT_TRUE(embedded_test_server()->Start()); | 445 ASSERT_TRUE(embedded_test_server()->Start()); |
| 442 | 446 |
| 443 std::vector<std::string> audio_ids; | 447 std::vector<std::string> audio_ids; |
| 444 std::vector<std::string> video_ids; | 448 std::vector<std::string> video_ids; |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 base::Bind(&VerifyDisableLocalEcho, true)); | 779 base::Bind(&VerifyDisableLocalEcho, true)); |
| 776 call = GenerateGetUserMediaWithDisableLocalEcho( | 780 call = GenerateGetUserMediaWithDisableLocalEcho( |
| 777 "getUserMediaAndExpectSuccess", "true"); | 781 "getUserMediaAndExpectSuccess", "true"); |
| 778 ExecuteJavascriptAndWaitForOk(call); | 782 ExecuteJavascriptAndWaitForOk(call); |
| 779 | 783 |
| 780 manager->SetGenerateStreamCallbackForTesting( | 784 manager->SetGenerateStreamCallbackForTesting( |
| 781 MediaStreamManager::GenerateStreamTestCallback()); | 785 MediaStreamManager::GenerateStreamTestCallback()); |
| 782 } | 786 } |
| 783 | 787 |
| 784 } // namespace content | 788 } // namespace content |
| OLD | NEW |