| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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/files/file_util.h" | 6 #include "base/files/file_util.h" |
| 7 #include "base/threading/platform_thread.h" | 7 #include "base/threading/platform_thread.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "content/browser/web_contents/web_contents_impl.h" | 9 #include "content/browser/web_contents/web_contents_impl.h" |
| 10 #include "content/browser/webrtc/webrtc_content_browsertest_base.h" | 10 #include "content/browser/webrtc/webrtc_content_browsertest_base.h" |
| 11 #include "content/public/common/content_switches.h" | 11 #include "content/public/common/content_switches.h" |
| 12 #include "content/public/common/webrtc_ip_handling_policy.h" | 12 #include "content/public/common/webrtc_ip_handling_policy.h" |
| 13 #include "content/public/test/browser_test_utils.h" | 13 #include "content/public/test/browser_test_utils.h" |
| 14 #include "content/public/test/content_browser_test_utils.h" | 14 #include "content/public/test/content_browser_test_utils.h" |
| 15 #include "content/public/test/test_utils.h" | 15 #include "content/public/test/test_utils.h" |
| 16 #include "media/audio/audio_manager.h" | 16 #include "media/audio/audio_manager.h" |
| 17 #include "media/base/media_switches.h" | 17 #include "media/base/media_switches.h" |
| 18 #include "net/test/embedded_test_server/embedded_test_server.h" | 18 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 19 | 19 |
| 20 namespace content { | 20 namespace content { |
| 21 | 21 |
| 22 #if defined(OS_ANDROID) && defined(ADDRESS_SANITIZER) | 22 #if defined(OS_ANDROID) && defined(ADDRESS_SANITIZER) |
| 23 // Renderer crashes under Android ASAN: https://crbug.com/408496. | 23 // Renderer crashes under Android ASAN: https://crbug.com/408496. |
| 24 #define MAYBE_WebRtcBrowserAudioTest DISABLED_WebRtcBrowserAudioTest | 24 #define MAYBE_WebRtcAudioBrowserTest DISABLED_WebRtcAudioBrowserTest |
| 25 #else | 25 #else |
| 26 #define MAYBE_WebRtcBrowserAudioTest WebRtcBrowserAudioTest | 26 #define MAYBE_WebRtcAudioBrowserTest WebRtcAudioBrowserTest |
| 27 #endif | 27 #endif |
| 28 | 28 |
| 29 // This class tests the scenario when permission to access mic or camera is | 29 // This class tests the scenario when permission to access mic or camera is |
| 30 // granted. | 30 // granted. |
| 31 class MAYBE_WebRtcBrowserAudioTest : public WebRtcContentBrowserTest { | 31 class MAYBE_WebRtcAudioBrowserTest : public WebRtcContentBrowserTest { |
| 32 public: | 32 public: |
| 33 MAYBE_WebRtcBrowserAudioTest() {} | 33 MAYBE_WebRtcAudioBrowserTest() {} |
| 34 ~MAYBE_WebRtcBrowserAudioTest() override {} | 34 ~MAYBE_WebRtcAudioBrowserTest() override {} |
| 35 | 35 |
| 36 void SetUpCommandLine(base::CommandLine* command_line) override { | 36 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 37 WebRtcContentBrowserTest::SetUpCommandLine(command_line); | 37 WebRtcContentBrowserTest::SetUpCommandLine(command_line); |
| 38 // Automatically grant device permission. | 38 // Automatically grant device permission. |
| 39 AppendUseFakeUIForMediaStreamFlag(); | 39 AppendUseFakeUIForMediaStreamFlag(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 protected: | 42 protected: |
| 43 // Convenience method for making calls that detect if audio os playing (which | 43 // Convenience method for making calls that detect if audio os playing (which |
| 44 // has some special prerequisites, such that there needs to be an audio output | 44 // has some special prerequisites, such that there needs to be an audio output |
| (...skipping 10 matching lines...) Expand all Loading... |
| 55 | 55 |
| 56 ASSERT_TRUE(base::CommandLine::ForCurrentProcess()->HasSwitch( | 56 ASSERT_TRUE(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 57 switches::kUseFakeDeviceForMediaStream)) | 57 switches::kUseFakeDeviceForMediaStream)) |
| 58 << "Must run with fake devices since the test will explicitly look " | 58 << "Must run with fake devices since the test will explicitly look " |
| 59 << "for the fake device signal."; | 59 << "for the fake device signal."; |
| 60 | 60 |
| 61 MakeTypicalCall(javascript, "/media/peerconnection-call-audio.html"); | 61 MakeTypicalCall(javascript, "/media/peerconnection-call-audio.html"); |
| 62 } | 62 } |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserAudioTest, | 65 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioBrowserTest, |
| 66 CanMakeVideoCallAndThenRenegotiateToAudio) { | 66 CanMakeVideoCallAndThenRenegotiateToAudio) { |
| 67 MakeAudioDetectingPeerConnectionCall( | 67 MakeAudioDetectingPeerConnectionCall( |
| 68 "callAndRenegotiateToAudio({audio: true, video:true}, {audio: true});"); | 68 "callAndRenegotiateToAudio({audio: true, video:true}, {audio: true});"); |
| 69 } | 69 } |
| 70 | 70 |
| 71 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserAudioTest, | 71 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioBrowserTest, |
| 72 EstablishAudioVideoCallAndEnsureAudioIsPlaying) { | 72 EstablishAudioVideoCallAndEnsureAudioIsPlaying) { |
| 73 MakeAudioDetectingPeerConnectionCall( | 73 MakeAudioDetectingPeerConnectionCall( |
| 74 "callAndEnsureAudioIsPlaying({audio:true, video:true});"); | 74 "callAndEnsureAudioIsPlaying({audio:true, video:true});"); |
| 75 } | 75 } |
| 76 | 76 |
| 77 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserAudioTest, | 77 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioBrowserTest, |
| 78 EstablishAudioOnlyCallAndEnsureAudioIsPlaying) { | 78 EstablishAudioOnlyCallAndEnsureAudioIsPlaying) { |
| 79 MakeAudioDetectingPeerConnectionCall( | 79 MakeAudioDetectingPeerConnectionCall( |
| 80 "callAndEnsureAudioIsPlaying({audio:true});"); | 80 "callAndEnsureAudioIsPlaying({audio:true});"); |
| 81 } | 81 } |
| 82 | 82 |
| 83 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserAudioTest, | 83 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioBrowserTest, |
| 84 EstablishIsac16KCallAndEnsureAudioIsPlaying) { | 84 EstablishIsac16KCallAndEnsureAudioIsPlaying) { |
| 85 MakeAudioDetectingPeerConnectionCall( | 85 MakeAudioDetectingPeerConnectionCall( |
| 86 "callWithIsac16KAndEnsureAudioIsPlaying({audio:true});"); | 86 "callWithIsac16KAndEnsureAudioIsPlaying({audio:true});"); |
| 87 } | 87 } |
| 88 | 88 |
| 89 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserAudioTest, | 89 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioBrowserTest, |
| 90 EstablishAudioVideoCallAndVerifyRemoteMutingWorks) { | 90 EstablishAudioVideoCallAndVerifyRemoteMutingWorks) { |
| 91 MakeAudioDetectingPeerConnectionCall( | 91 MakeAudioDetectingPeerConnectionCall( |
| 92 "callAndEnsureRemoteAudioTrackMutingWorks();"); | 92 "callAndEnsureRemoteAudioTrackMutingWorks();"); |
| 93 } | 93 } |
| 94 | 94 |
| 95 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserAudioTest, | 95 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioBrowserTest, |
| 96 EstablishAudioVideoCallAndVerifyLocalMutingWorks) { | 96 EstablishAudioVideoCallAndVerifyLocalMutingWorks) { |
| 97 MakeAudioDetectingPeerConnectionCall( | 97 MakeAudioDetectingPeerConnectionCall( |
| 98 "callAndEnsureLocalAudioTrackMutingWorks();"); | 98 "callAndEnsureLocalAudioTrackMutingWorks();"); |
| 99 } | 99 } |
| 100 | 100 |
| 101 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserAudioTest, | 101 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioBrowserTest, |
| 102 EnsureLocalVideoMuteDoesntMuteAudio) { | 102 EnsureLocalVideoMuteDoesntMuteAudio) { |
| 103 MakeAudioDetectingPeerConnectionCall( | 103 MakeAudioDetectingPeerConnectionCall( |
| 104 "callAndEnsureLocalVideoMutingDoesntMuteAudio();"); | 104 "callAndEnsureLocalVideoMutingDoesntMuteAudio();"); |
| 105 } | 105 } |
| 106 | 106 |
| 107 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserAudioTest, | 107 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioBrowserTest, |
| 108 EnsureRemoteVideoMuteDoesntMuteAudio) { | 108 EnsureRemoteVideoMuteDoesntMuteAudio) { |
| 109 MakeAudioDetectingPeerConnectionCall( | 109 MakeAudioDetectingPeerConnectionCall( |
| 110 "callAndEnsureRemoteVideoMutingDoesntMuteAudio();"); | 110 "callAndEnsureRemoteVideoMutingDoesntMuteAudio();"); |
| 111 } | 111 } |
| 112 | 112 |
| 113 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserAudioTest, | 113 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioBrowserTest, |
| 114 EstablishAudioVideoCallAndVerifyUnmutingWorks) { | 114 EstablishAudioVideoCallAndVerifyUnmutingWorks) { |
| 115 MakeAudioDetectingPeerConnectionCall( | 115 MakeAudioDetectingPeerConnectionCall( |
| 116 "callAndEnsureAudioTrackUnmutingWorks();"); | 116 "callAndEnsureAudioTrackUnmutingWorks();"); |
| 117 } | 117 } |
| 118 | 118 |
| 119 } // namespace content | 119 } // namespace content |
| OLD | NEW |