| Index: content/browser/media/webrtc_browsertest.cc
|
| diff --git a/content/browser/media/webrtc_browsertest.cc b/content/browser/media/webrtc_browsertest.cc
|
| index ce566ae2db5d63510e5144468156f1e520fbf1a9..0d7405e201e8c473b0e5a50a2a61c1a333dc1c18 100644
|
| --- a/content/browser/media/webrtc_browsertest.cc
|
| +++ b/content/browser/media/webrtc_browsertest.cc
|
| @@ -45,7 +45,7 @@ class WebRtcBrowserTest : public WebRtcContentBrowserTest,
|
| command_line->AppendSwitch(switches::kEnableAudioTrackProcessing);
|
| }
|
|
|
| - // Convenience function since most peerconnection-call.html tests just load
|
| + // Convenience method since most peerconnection-call.html tests just load
|
| // the page, kick off some javascript and wait for the title to change to OK.
|
| void MakeTypicalPeerConnectionCall(const std::string& javascript) {
|
| ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
|
| @@ -57,6 +57,27 @@ class WebRtcBrowserTest : public WebRtcContentBrowserTest,
|
| ExecuteJavascriptAndWaitForOk(javascript);
|
| }
|
|
|
| + // Convenience method for making calls that detect if audio os playing (which
|
| + // has some special prerequisites, such that there needs to be an audio output
|
| + // device on the executing machine).
|
| + void MakeAudioDetectingPeerConnectionCall(const std::string& javascript) {
|
| + if (!media::AudioManager::Get()->HasAudioOutputDevices()) {
|
| + // Bots with no output devices will force the audio code into a state
|
| + // where it doesn't manage to set either the low or high latency path.
|
| + // This test will compute useless values in that case, so skip running on
|
| + // such bots (see crbug.com/326338).
|
| + LOG(INFO) << "Missing output devices: skipping test...";
|
| + return;
|
| + }
|
| +
|
| + ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch(
|
| + switches::kUseFakeDeviceForMediaStream))
|
| + << "Must run with fake devices since the test will explicitly look "
|
| + << "for the fake device signal.";
|
| +
|
| + MakeTypicalPeerConnectionCall(javascript);
|
| + }
|
| +
|
| void DisableOpusIfOnAndroid() {
|
| #if defined (OS_ANDROID)
|
| // Always force iSAC 16K on Android for now (Opus is broken).
|
| @@ -299,56 +320,28 @@ IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, AddTwoMediaStreamsToOnePC) {
|
| }
|
|
|
| IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest,
|
| - EstablishAudioVideoCallAndMeasureOutputLevel) {
|
| - if (!media::AudioManager::Get()->HasAudioOutputDevices()) {
|
| - // Bots with no output devices will force the audio code into a different
|
| - // path where it doesn't manage to set either the low or high latency path.
|
| - // This test will compute useless values in that case, so skip running on
|
| - // such bots (see crbug.com/326338).
|
| - LOG(INFO) << "Missing output devices: skipping test...";
|
| - return;
|
| - }
|
| -
|
| - ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch(
|
| - switches::kUseFakeDeviceForMediaStream))
|
| - << "Must run with fake devices since the test will explicitly look "
|
| - << "for the fake device signal.";
|
| + EstablishAudioVideoCallAndEnsureSoundPlays) {
|
| + MakeAudioDetectingPeerConnectionCall(base::StringPrintf(
|
| + "callAndEnsureAudioIsPlaying(%s, {audio: true, video: true});",
|
| + kUseLenientAudioChecking));
|
| +}
|
|
|
| - MakeTypicalPeerConnectionCall(base::StringPrintf(
|
| - "callAndEnsureAudioIsPlaying(%s);", kUseLenientAudioChecking));
|
| +IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest,
|
| + EstablishAudioOnlyCallAndEnsureSoundPlays) {
|
| + MakeAudioDetectingPeerConnectionCall(base::StringPrintf(
|
| + "callAndEnsureAudioIsPlaying(%s, {audio: true});",
|
| + kUseLenientAudioChecking));
|
| }
|
|
|
| IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest,
|
| EstablishAudioVideoCallAndVerifyMutingWorks) {
|
| - if (!media::AudioManager::Get()->HasAudioOutputDevices()) {
|
| - // See comment on EstablishAudioVideoCallAndMeasureOutputLevel.
|
| - LOG(INFO) << "Missing output devices: skipping test...";
|
| - return;
|
| - }
|
| -
|
| - ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch(
|
| - switches::kUseFakeDeviceForMediaStream))
|
| - << "Must run with fake devices since the test will explicitly look "
|
| - << "for the fake device signal.";
|
| -
|
| - MakeTypicalPeerConnectionCall(base::StringPrintf(
|
| + MakeAudioDetectingPeerConnectionCall(base::StringPrintf(
|
| "callAndEnsureAudioTrackMutingWorks(%s);", kUseLenientAudioChecking));
|
| }
|
|
|
| IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest,
|
| EstablishAudioVideoCallAndVerifyUnmutingWorks) {
|
| - if (!media::AudioManager::Get()->HasAudioOutputDevices()) {
|
| - // See comment on EstablishAudioVideoCallAndMeasureOutputLevel.
|
| - LOG(INFO) << "Missing output devices: skipping test...";
|
| - return;
|
| - }
|
| -
|
| - ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch(
|
| - switches::kUseFakeDeviceForMediaStream))
|
| - << "Must run with fake devices since the test will explicitly look "
|
| - << "for the fake device signal.";
|
| -
|
| - MakeTypicalPeerConnectionCall(base::StringPrintf(
|
| + MakeAudioDetectingPeerConnectionCall(base::StringPrintf(
|
| "callAndEnsureAudioTrackUnmutingWorks(%s);", kUseLenientAudioChecking));
|
| }
|
|
|
|
|