Commit f7c7b305 authored by Max Morin's avatar Max Morin Committed by Commit Bot

Parametrize WebRtcAudioBrowserTest.

This allows us to test both "out of process audio service" and the
current code on the waterfall.

Bug: 843961
Change-Id: I2b20ffb821c6f1dc01ddbc45365f82e12a87a987
Reviewed-on: https://chromium-review.googlesource.com/1063753Reviewed-by: default avatarOlga Sharonova <olka@chromium.org>
Reviewed-by: default avatarPatrik Höglund <phoglund@chromium.org>
Commit-Queue: Olga Sharonova <olka@chromium.org>
Commit-Queue: Max Morin <maxmorin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#559497}
parent c9bd8304
......@@ -4,10 +4,12 @@
#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/test/scoped_feature_list.h"
#include "base/threading/platform_thread.h"
#include "build/build_config.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/browser/webrtc/webrtc_content_browsertest_base.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/webrtc_ip_handling_policy.h"
#include "content/public/test/browser_test_utils.h"
......@@ -15,22 +17,28 @@
#include "content/public/test/test_utils.h"
#include "media/base/media_switches.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "testing/gtest/include/gtest/gtest-param-test.h"
namespace content {
#if defined(OS_ANDROID) && defined(ADDRESS_SANITIZER)
// Renderer crashes under Android ASAN: https://crbug.com/408496.
#define MAYBE_WebRtcAudioBrowserTest DISABLED_WebRtcAudioBrowserTest
#else
#define MAYBE_WebRtcAudioBrowserTest WebRtcAudioBrowserTest
#endif
// This class tests the scenario when permission to access mic or camera is
// granted.
class MAYBE_WebRtcAudioBrowserTest : public WebRtcContentBrowserTestBase {
class WebRtcAudioBrowserTest : public WebRtcContentBrowserTestBase,
public testing::WithParamInterface<bool> {
public:
MAYBE_WebRtcAudioBrowserTest() {}
~MAYBE_WebRtcAudioBrowserTest() override {}
WebRtcAudioBrowserTest() {
std::vector<base::Feature> audio_service_oop_features = {
features::kAudioServiceAudioStreams,
features::kAudioServiceOutOfProcess};
if (GetParam()) {
// Force audio service out of process to enabled.
audio_service_features_.InitWithFeatures(audio_service_oop_features, {});
} else {
// Force audio service out of process to disabled.
audio_service_features_.InitWithFeatures({}, audio_service_oop_features);
}
}
~WebRtcAudioBrowserTest() override {}
void SetUpCommandLine(base::CommandLine* command_line) override {
WebRtcContentBrowserTestBase::SetUpCommandLine(command_line);
......@@ -59,60 +67,76 @@ class MAYBE_WebRtcAudioBrowserTest : public WebRtcContentBrowserTestBase {
MakeTypicalCall(javascript, "/media/peerconnection-call-audio.html");
}
private:
base::test::ScopedFeatureList audio_service_features_;
};
IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioBrowserTest,
IN_PROC_BROWSER_TEST_P(WebRtcAudioBrowserTest,
CanMakeVideoCallAndThenRenegotiateToAudio) {
MakeAudioDetectingPeerConnectionCall(
"callAndRenegotiateToAudio({audio: true, video:true}, {audio: true});");
}
IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioBrowserTest,
IN_PROC_BROWSER_TEST_P(WebRtcAudioBrowserTest,
EstablishAudioVideoCallAndEnsureAudioIsPlaying) {
MakeAudioDetectingPeerConnectionCall(
"callAndEnsureAudioIsPlaying({audio:true, video:true});");
}
IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioBrowserTest,
IN_PROC_BROWSER_TEST_P(WebRtcAudioBrowserTest,
EstablishAudioOnlyCallAndEnsureAudioIsPlaying) {
MakeAudioDetectingPeerConnectionCall(
"callAndEnsureAudioIsPlaying({audio:true});");
}
IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioBrowserTest,
IN_PROC_BROWSER_TEST_P(WebRtcAudioBrowserTest,
EstablishIsac16KCallAndEnsureAudioIsPlaying) {
MakeAudioDetectingPeerConnectionCall(
"callWithIsac16KAndEnsureAudioIsPlaying({audio:true});");
}
IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioBrowserTest,
IN_PROC_BROWSER_TEST_P(WebRtcAudioBrowserTest,
EstablishAudioVideoCallAndVerifyRemoteMutingWorks) {
MakeAudioDetectingPeerConnectionCall(
"callAndEnsureRemoteAudioTrackMutingWorks();");
}
IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioBrowserTest,
IN_PROC_BROWSER_TEST_P(WebRtcAudioBrowserTest,
EstablishAudioVideoCallAndVerifyLocalMutingWorks) {
MakeAudioDetectingPeerConnectionCall(
"callAndEnsureLocalAudioTrackMutingWorks();");
}
IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioBrowserTest,
IN_PROC_BROWSER_TEST_P(WebRtcAudioBrowserTest,
EnsureLocalVideoMuteDoesntMuteAudio) {
MakeAudioDetectingPeerConnectionCall(
"callAndEnsureLocalVideoMutingDoesntMuteAudio();");
}
IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioBrowserTest,
IN_PROC_BROWSER_TEST_P(WebRtcAudioBrowserTest,
EnsureRemoteVideoMuteDoesntMuteAudio) {
MakeAudioDetectingPeerConnectionCall(
"callAndEnsureRemoteVideoMutingDoesntMuteAudio();");
}
IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioBrowserTest,
IN_PROC_BROWSER_TEST_P(WebRtcAudioBrowserTest,
EstablishAudioVideoCallAndVerifyUnmutingWorks) {
MakeAudioDetectingPeerConnectionCall(
"callAndEnsureAudioTrackUnmutingWorks();");
}
// We run these tests with the audio service both in and out of the the browser
// process to have waterfall coverage while the feature rolls out. It should be
// removed after launch.
#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_WIN)
// Supported platforms.
INSTANTIATE_TEST_CASE_P(, WebRtcAudioBrowserTest, ::testing::Bool());
#elif defined(OS_ANDROID) && defined(ADDRESS_SANITIZER)
// Renderer crashes under Android ASAN: https://crbug.com/408496.
#else
// Platforms where the out of process audio service isn't supported
INSTANTIATE_TEST_CASE_P(, WebRtcAudioBrowserTest, ::testing::Values(false));
#endif
} // namespace content
......@@ -76,6 +76,7 @@ base::SingleThreadTaskRunner* MainThread::GetWorkerTaskRunner() {
OwningAudioManagerAccessor::OwningAudioManagerAccessor(
AudioManagerFactoryCallback audio_manager_factory_cb)
: audio_manager_factory_cb_(std::move(audio_manager_factory_cb)) {
DLOG(WARNING) << "Out of process audio service initializing.";
DCHECK(audio_manager_factory_cb_);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment