| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 // Automatically grant device permission. | 38 // Automatically grant device permission. |
| 39 AppendUseFakeUIForMediaStreamFlag(); | 39 AppendUseFakeUIForMediaStreamFlag(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 protected: | 42 protected: |
| 43 // Convenience function since most peerconnection-call.html tests just load | 43 // Convenience function since most peerconnection-call.html tests just load |
| 44 // the page, kick off some javascript and wait for the title to change to OK. | 44 // the page, kick off some javascript and wait for the title to change to OK. |
| 45 void MakeTypicalPeerConnectionCall(const std::string& javascript) { | 45 void MakeTypicalPeerConnectionCall(const std::string& javascript) { |
| 46 MakeTypicalCall(javascript, "/media/peerconnection-call.html"); | 46 MakeTypicalCall(javascript, "/media/peerconnection-call.html"); |
| 47 } | 47 } |
| 48 | |
| 49 // Convenience method for making calls that detect if audio os playing (which | |
| 50 // has some special prerequisites, such that there needs to be an audio output | |
| 51 // device on the executing machine). | |
| 52 void MakeAudioDetectingPeerConnectionCall(const std::string& javascript) { | |
| 53 if (!media::AudioManager::Get()->HasAudioOutputDevices()) { | |
| 54 // Bots with no output devices will force the audio code into a state | |
| 55 // where it doesn't manage to set either the low or high latency path. | |
| 56 // This test will compute useless values in that case, so skip running on | |
| 57 // such bots (see crbug.com/326338). | |
| 58 LOG(INFO) << "Missing output devices: skipping test..."; | |
| 59 return; | |
| 60 } | |
| 61 | |
| 62 ASSERT_TRUE(base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 63 switches::kUseFakeDeviceForMediaStream)) | |
| 64 << "Must run with fake devices since the test will explicitly look " | |
| 65 << "for the fake device signal."; | |
| 66 | |
| 67 MakeTypicalPeerConnectionCall(javascript); | |
| 68 } | |
| 69 }; | 48 }; |
| 70 | 49 |
| 71 // These tests will make a complete PeerConnection-based call and verify that | 50 // These tests will make a complete PeerConnection-based call and verify that |
| 72 // video is playing for the call. | 51 // video is playing for the call. |
| 73 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, | 52 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, |
| 74 CanSetupDefaultVideoCall) { | 53 CanSetupDefaultVideoCall) { |
| 75 MakeTypicalPeerConnectionCall( | 54 MakeTypicalPeerConnectionCall( |
| 76 "callAndExpectResolution({video: true}, 640, 480);"); | 55 "callAndExpectResolution({video: true}, 640, 480);"); |
| 77 } | 56 } |
| 78 | 57 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 } | 114 } |
| 136 | 115 |
| 137 // Causes asserts in libjingle: http://crbug.com/484826. | 116 // Causes asserts in libjingle: http://crbug.com/484826. |
| 138 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, | 117 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, |
| 139 DISABLED_CanMakeAudioCallAndThenRenegotiateToVideo) { | 118 DISABLED_CanMakeAudioCallAndThenRenegotiateToVideo) { |
| 140 const char* kJavascript = | 119 const char* kJavascript = |
| 141 "callAndRenegotiateToVideo({audio: true}, {audio: true, video:true});"; | 120 "callAndRenegotiateToVideo({audio: true}, {audio: true, video:true});"; |
| 142 MakeTypicalPeerConnectionCall(kJavascript); | 121 MakeTypicalPeerConnectionCall(kJavascript); |
| 143 } | 122 } |
| 144 | 123 |
| 145 // Causes asserts in libjingle: http://crbug.com/484826. | |
| 146 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, | |
| 147 DISABLED_CanMakeVideoCallAndThenRenegotiateToAudio) { | |
| 148 MakeAudioDetectingPeerConnectionCall( | |
| 149 "callAndRenegotiateToAudio({audio: true, video:true}, {audio: true});"); | |
| 150 } | |
| 151 | |
| 152 // This test makes a call between pc1 and pc2 where a video only stream is sent | 124 // This test makes a call between pc1 and pc2 where a video only stream is sent |
| 153 // from pc1 to pc2. The stream sent from pc1 to pc2 is cloned from the stream | 125 // from pc1 to pc2. The stream sent from pc1 to pc2 is cloned from the stream |
| 154 // received on pc2 to test that cloning of remote video and audio tracks works | 126 // received on pc2 to test that cloning of remote video and audio tracks works |
| 155 // as intended and is sent back to pc1. | 127 // as intended and is sent back to pc1. |
| 156 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, CanForwardRemoteStream) { | 128 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, CanForwardRemoteStream) { |
| 157 #if defined (OS_ANDROID) | 129 #if defined (OS_ANDROID) |
| 158 // This test fails on Nexus 5 devices. | 130 // This test fails on Nexus 5 devices. |
| 159 // TODO(henrika): see http://crbug.com/362437 and http://crbug.com/359389 | 131 // TODO(henrika): see http://crbug.com/362437 and http://crbug.com/359389 |
| 160 // for details. | 132 // for details. |
| 161 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 133 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 // AudioTrack is added instead. | 184 // AudioTrack is added instead. |
| 213 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, CallAndModifyStream) { | 185 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, CallAndModifyStream) { |
| 214 MakeTypicalPeerConnectionCall( | 186 MakeTypicalPeerConnectionCall( |
| 215 "callWithNewVideoMediaStreamLaterSwitchToAudio();"); | 187 "callWithNewVideoMediaStreamLaterSwitchToAudio();"); |
| 216 } | 188 } |
| 217 | 189 |
| 218 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, AddTwoMediaStreamsToOnePC) { | 190 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, AddTwoMediaStreamsToOnePC) { |
| 219 MakeTypicalPeerConnectionCall("addTwoMediaStreamsToOneConnection();"); | 191 MakeTypicalPeerConnectionCall("addTwoMediaStreamsToOneConnection();"); |
| 220 } | 192 } |
| 221 | 193 |
| 222 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, | |
| 223 EstablishAudioVideoCallAndEnsureAudioIsPlaying) { | |
| 224 MakeAudioDetectingPeerConnectionCall( | |
| 225 "callAndEnsureAudioIsPlaying({audio:true, video:true});"); | |
| 226 } | |
| 227 | |
| 228 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, | |
| 229 EstablishAudioOnlyCallAndEnsureAudioIsPlaying) { | |
| 230 MakeAudioDetectingPeerConnectionCall( | |
| 231 "callAndEnsureAudioIsPlaying({audio:true});"); | |
| 232 } | |
| 233 | |
| 234 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, | |
| 235 EstablishIsac16KCallAndEnsureAudioIsPlaying) { | |
| 236 MakeAudioDetectingPeerConnectionCall( | |
| 237 "callWithIsac16KAndEnsureAudioIsPlaying({audio:true});"); | |
| 238 } | |
| 239 | |
| 240 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, | |
| 241 EstablishAudioVideoCallAndVerifyRemoteMutingWorks) { | |
| 242 MakeAudioDetectingPeerConnectionCall( | |
| 243 "callAndEnsureRemoteAudioTrackMutingWorks();"); | |
| 244 } | |
| 245 | |
| 246 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, | |
| 247 EstablishAudioVideoCallAndVerifyLocalMutingWorks) { | |
| 248 MakeAudioDetectingPeerConnectionCall( | |
| 249 "callAndEnsureLocalAudioTrackMutingWorks();"); | |
| 250 } | |
| 251 | |
| 252 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, | |
| 253 EnsureLocalVideoMuteDoesntMuteAudio) { | |
| 254 MakeAudioDetectingPeerConnectionCall( | |
| 255 "callAndEnsureLocalVideoMutingDoesntMuteAudio();"); | |
| 256 } | |
| 257 | |
| 258 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, | |
| 259 EnsureRemoteVideoMuteDoesntMuteAudio) { | |
| 260 MakeAudioDetectingPeerConnectionCall( | |
| 261 "callAndEnsureRemoteVideoMutingDoesntMuteAudio();"); | |
| 262 } | |
| 263 | |
| 264 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, | |
| 265 EstablishAudioVideoCallAndVerifyUnmutingWorks) { | |
| 266 MakeAudioDetectingPeerConnectionCall( | |
| 267 "callAndEnsureAudioTrackUnmutingWorks();"); | |
| 268 } | |
| 269 | |
| 270 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, CallAndVerifyVideoMutingWorks) { | 194 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, CallAndVerifyVideoMutingWorks) { |
| 271 MakeTypicalPeerConnectionCall("callAndEnsureVideoTrackMutingWorks();"); | 195 MakeTypicalPeerConnectionCall("callAndEnsureVideoTrackMutingWorks();"); |
| 272 } | 196 } |
| 273 | 197 |
| 274 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, CreateOfferWithOfferOptions) { | 198 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, CreateOfferWithOfferOptions) { |
| 275 MakeTypicalPeerConnectionCall("testCreateOfferOptions();"); | 199 MakeTypicalPeerConnectionCall("testCreateOfferOptions();"); |
| 276 } | 200 } |
| 277 | 201 |
| 278 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, CallInsideIframe) { | 202 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, CallInsideIframe) { |
| 279 MakeTypicalPeerConnectionCall("callInsideIframe({video: true, audio:true});"); | 203 MakeTypicalPeerConnectionCall("callInsideIframe({video: true, audio:true});"); |
| 280 } | 204 } |
| 281 | 205 |
| 282 } // namespace content | 206 } // namespace content |
| OLD | NEW |