Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2804)

Unified Diff: content/browser/media/webrtc_browsertest.cc

Issue 252703003: Wrote a test which exercises audio-only WebRTC calls. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/test/data/media/peerconnection-call.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/media/webrtc_browsertest.cc
diff --git a/content/browser/media/webrtc_browsertest.cc b/content/browser/media/webrtc_browsertest.cc
index 9a003a4814cb400fd9eb2b85fabe6e73166cb8d0..24417a9b9d1187f6a033f4a264115f541591ead3 100644
--- a/content/browser/media/webrtc_browsertest.cc
+++ b/content/browser/media/webrtc_browsertest.cc
@@ -59,7 +59,7 @@ class WebRtcBrowserTest : public WebRtcContentBrowserTest,
#endif
}
- // 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());
@@ -71,6 +71,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).
@@ -327,39 +348,22 @@ 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.";
+ EstablishAudioVideoCallAndEnsureAudioIsPlaying) {
+ MakeAudioDetectingPeerConnectionCall(base::StringPrintf(
+ "callAndEnsureAudioIsPlaying(%s, {audio:true, video:true});",
+ kUseLenientAudioChecking));
+}
- MakeTypicalPeerConnectionCall(base::StringPrintf(
- "callAndEnsureAudioIsPlaying(%s);", kUseLenientAudioChecking));
+IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest,
+ EstablishAudioOnlyCallAndEnsureAudioIsPlaying) {
+ 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));
}
@@ -373,18 +377,7 @@ IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest,
#endif
IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest,
MAYBE_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));
}
« no previous file with comments | « no previous file | content/test/data/media/peerconnection-call.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698