Chromium Code Reviews| 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 media::AudioManager::Get()->SetMaxStreamCountForTesting(0, 0); | |
|
henrika (OOO until Aug 14)
2017/01/16 09:13:27
Perhaps a comment explaining why we know the test
tommi (sloooow) - chröme
2017/01/16 12:37:01
Done.
| |
| 599 | |
| 600 const std::string call = base::StringPrintf( | |
| 601 "%s({video: false, audio: true});", kGetUserMediaAndExpectFailure); | |
| 602 EXPECT_EQ("TrackStartError", | |
| 603 ExecuteJavascriptAndReturnResult(call)); | |
| 604 } | |
| 605 | |
| 582 // This test makes two getUserMedia requests, one with impossible constraints | 606 // This test makes two getUserMedia requests, one with impossible constraints |
| 583 // that should trigger an error, and one with valid constraints. The test | 607 // that should trigger an error, and one with valid constraints. The test |
| 584 // verifies getUserMedia can succeed after being given impossible constraints. | 608 // verifies getUserMedia can succeed after being given impossible constraints. |
| 585 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, | 609 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, |
| 586 TwoGetUserMediaAndCheckCallbackAfterFailure) { | 610 TwoGetUserMediaAndCheckCallbackAfterFailure) { |
| 587 ASSERT_TRUE(embedded_test_server()->Start()); | 611 ASSERT_TRUE(embedded_test_server()->Start()); |
| 588 | 612 |
| 589 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); | 613 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); |
| 590 NavigateToURL(shell(), url); | 614 NavigateToURL(shell(), url); |
| 591 | 615 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 757 base::Bind(&VerifyDisableLocalEcho, true)); | 781 base::Bind(&VerifyDisableLocalEcho, true)); |
| 758 call = GenerateGetUserMediaWithDisableLocalEcho( | 782 call = GenerateGetUserMediaWithDisableLocalEcho( |
| 759 "getUserMediaAndExpectSuccess", "true"); | 783 "getUserMediaAndExpectSuccess", "true"); |
| 760 ExecuteJavascriptAndWaitForOk(call); | 784 ExecuteJavascriptAndWaitForOk(call); |
| 761 | 785 |
| 762 manager->SetGenerateStreamCallbackForTesting( | 786 manager->SetGenerateStreamCallbackForTesting( |
| 763 MediaStreamManager::GenerateStreamTestCallback()); | 787 MediaStreamManager::GenerateStreamTestCallback()); |
| 764 } | 788 } |
| 765 | 789 |
| 766 } // namespace content | 790 } // namespace content |
| OLD | NEW |