| 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" |
| 11 #include "base/test/trace_event_analyzer.h" | 11 #include "base/test/trace_event_analyzer.h" |
| 12 #include "base/threading/thread_restrictions.h" | 12 #include "base/threading/thread_restrictions.h" |
| 13 #include "base/trace_event/trace_event_impl.h" | 13 #include "base/trace_event/trace_event_impl.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 16 #include "content/browser/browser_main_loop.h" | 16 #include "content/browser/browser_main_loop.h" |
| 17 #include "content/browser/renderer_host/media/media_stream_manager.h" | 17 #include "content/browser/renderer_host/media/media_stream_manager.h" |
| 18 #include "content/browser/web_contents/web_contents_impl.h" | 18 #include "content/browser/web_contents/web_contents_impl.h" |
| 19 #include "content/browser/webrtc/webrtc_content_browsertest_base.h" | 19 #include "content/browser/webrtc/webrtc_content_browsertest_base.h" |
| 20 #include "content/browser/webrtc/webrtc_internals.h" | 20 #include "content/browser/webrtc/webrtc_internals.h" |
| 21 #include "content/public/common/content_switches.h" | 21 #include "content/public/common/content_switches.h" |
| 22 #include "content/public/test/browser_test_utils.h" | 22 #include "content/public/test/browser_test_utils.h" |
| 23 #include "content/public/test/content_browser_test_utils.h" | 23 #include "content/public/test/content_browser_test_utils.h" |
| 24 #include "content/public/test/test_utils.h" | 24 #include "content/public/test/test_utils.h" |
| 25 #include "content/shell/browser/shell.h" | 25 #include "content/shell/browser/shell.h" |
| 26 #include "media/audio/audio_manager.h" |
| 26 #include "net/test/embedded_test_server/embedded_test_server.h" | 27 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 27 #include "testing/perf/perf_test.h" | 28 #include "testing/perf/perf_test.h" |
| 28 | 29 |
| 29 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
| 30 #include "base/win/windows_version.h" | 31 #include "base/win/windows_version.h" |
| 31 #endif | 32 #endif |
| 32 | 33 |
| 33 using trace_analyzer::TraceAnalyzer; | 34 using trace_analyzer::TraceAnalyzer; |
| 34 using trace_analyzer::Query; | 35 using trace_analyzer::Query; |
| 35 using trace_analyzer::TraceEventVector; | 36 using trace_analyzer::TraceEventVector; |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 large_value, | 573 large_value, |
| 573 large_value, | 574 large_value, |
| 574 large_value, | 575 large_value, |
| 575 large_value); | 576 large_value); |
| 576 NavigateToURL(shell(), url); | 577 NavigateToURL(shell(), url); |
| 577 | 578 |
| 578 EXPECT_EQ("ConstraintNotSatisfiedError", | 579 EXPECT_EQ("ConstraintNotSatisfiedError", |
| 579 ExecuteJavascriptAndReturnResult(call)); | 580 ExecuteJavascriptAndReturnResult(call)); |
| 580 } | 581 } |
| 581 | 582 |
| 583 #if defined(OS_ANDROID) |
| 584 // Disabled until http://crbug.com/679302 is fixed. |
| 585 #define MAYBE_GetUserMediaFailToAccessAudioDevice \ |
| 586 DISABLED_GetUserMediaFailToAccessAudioDevice |
| 587 #else |
| 588 #define MAYBE_GetUserMediaFailToAccessAudioDevice \ |
| 589 GetUserMediaFailToAccessAudioDevice |
| 590 #endif |
| 591 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, |
| 592 MAYBE_GetUserMediaFailToAccessAudioDevice) { |
| 593 ASSERT_TRUE(embedded_test_server()->Start()); |
| 594 |
| 595 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); |
| 596 NavigateToURL(shell(), url); |
| 597 |
| 598 // Set the maximum allowed input and output streams to 0 |
| 599 // so that the call to create a new audio input stream will fail. |
| 600 media::AudioManager::Get()->SetMaxStreamCountForTesting(0, 0); |
| 601 |
| 602 const std::string call = base::StringPrintf( |
| 603 "%s({video: false, audio: true});", kGetUserMediaAndExpectFailure); |
| 604 EXPECT_EQ("TrackStartError", |
| 605 ExecuteJavascriptAndReturnResult(call)); |
| 606 } |
| 607 |
| 582 // This test makes two getUserMedia requests, one with impossible constraints | 608 // This test makes two getUserMedia requests, one with impossible constraints |
| 583 // that should trigger an error, and one with valid constraints. The test | 609 // that should trigger an error, and one with valid constraints. The test |
| 584 // verifies getUserMedia can succeed after being given impossible constraints. | 610 // verifies getUserMedia can succeed after being given impossible constraints. |
| 585 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, | 611 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, |
| 586 TwoGetUserMediaAndCheckCallbackAfterFailure) { | 612 TwoGetUserMediaAndCheckCallbackAfterFailure) { |
| 587 ASSERT_TRUE(embedded_test_server()->Start()); | 613 ASSERT_TRUE(embedded_test_server()->Start()); |
| 588 | 614 |
| 589 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); | 615 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); |
| 590 NavigateToURL(shell(), url); | 616 NavigateToURL(shell(), url); |
| 591 | 617 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 base::Bind(&VerifyDisableLocalEcho, true)); | 783 base::Bind(&VerifyDisableLocalEcho, true)); |
| 758 call = GenerateGetUserMediaWithDisableLocalEcho( | 784 call = GenerateGetUserMediaWithDisableLocalEcho( |
| 759 "getUserMediaAndExpectSuccess", "true"); | 785 "getUserMediaAndExpectSuccess", "true"); |
| 760 ExecuteJavascriptAndWaitForOk(call); | 786 ExecuteJavascriptAndWaitForOk(call); |
| 761 | 787 |
| 762 manager->SetGenerateStreamCallbackForTesting( | 788 manager->SetGenerateStreamCallbackForTesting( |
| 763 MediaStreamManager::GenerateStreamTestCallback()); | 789 MediaStreamManager::GenerateStreamTestCallback()); |
| 764 } | 790 } |
| 765 | 791 |
| 766 } // namespace content | 792 } // namespace content |
| OLD | NEW |