This source file includes following definitions.
- SetUpCommandLine
- MakeTypicalPeerConnectionCall
- DisableOpusIfOnAndroid
- IN_PROC_BROWSER_TEST_P
- IN_PROC_BROWSER_TEST_P
- IN_PROC_BROWSER_TEST_P
- IN_PROC_BROWSER_TEST_P
- IN_PROC_BROWSER_TEST_P
- IN_PROC_BROWSER_TEST_P
- IN_PROC_BROWSER_TEST_P
- IN_PROC_BROWSER_TEST_P
- IN_PROC_BROWSER_TEST_P
- IN_PROC_BROWSER_TEST_P
- IN_PROC_BROWSER_TEST_P
- IN_PROC_BROWSER_TEST_P
- IN_PROC_BROWSER_TEST_P
- IN_PROC_BROWSER_TEST_P
- IN_PROC_BROWSER_TEST_P
- IN_PROC_BROWSER_TEST_P
- IN_PROC_BROWSER_TEST_P
- IN_PROC_BROWSER_TEST_P
- IN_PROC_BROWSER_TEST_P
- IN_PROC_BROWSER_TEST_P
- IN_PROC_BROWSER_TEST_P
- IN_PROC_BROWSER_TEST_P
- IN_PROC_BROWSER_TEST_P
- IN_PROC_BROWSER_TEST_P
- IN_PROC_BROWSER_TEST_P
- IN_PROC_BROWSER_TEST_P
#include "base/command_line.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "content/browser/media/webrtc_internals.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test_utils.h"
#include "content/public/test/test_utils.h"
#include "content/shell/browser/shell.h"
#include "content/test/webrtc_content_browsertest_base.h"
#include "media/audio/audio_manager.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#if defined(OS_WIN)
#include "base/win/windows_version.h"
#endif
namespace content {
class WebRtcBrowserTest : public WebRtcContentBrowserTest,
public testing::WithParamInterface<bool> {
public:
WebRtcBrowserTest() {}
virtual ~WebRtcBrowserTest() {}
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
WebRtcContentBrowserTest::SetUpCommandLine(command_line);
bool enable_audio_track_processing = GetParam();
if (enable_audio_track_processing)
command_line->AppendSwitch(switches::kEnableAudioTrackProcessing);
}
void MakeTypicalPeerConnectionCall(const std::string& javascript) {
ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html"));
NavigateToURL(shell(), url);
DisableOpusIfOnAndroid();
ExecuteJavascriptAndWaitForOk(javascript);
}
void DisableOpusIfOnAndroid() {
#if defined (OS_ANDROID)
EXPECT_EQ("isac-forced",
ExecuteJavascriptAndReturnResult("forceIsac16KInSdp();"));
#endif
}
};
static const bool kRunTestsWithFlag[] = { false, true };
INSTANTIATE_TEST_CASE_P(WebRtcBrowserTests,
WebRtcBrowserTest,
testing::ValuesIn(kRunTestsWithFlag));
#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
#define MAYBE_CanSetupDefaultVideoCall DISABLED_CanSetupDefaultVideoCall
#else
#define MAYBE_CanSetupDefaultVideoCall CanSetupDefaultVideoCall
#endif
IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, MAYBE_CanSetupDefaultVideoCall) {
MakeTypicalPeerConnectionCall(
"callAndExpectResolution({video: true}, 640, 480);");
}
IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, CanSetupVideoCallWith1To1AspecRatio) {
const std::string javascript =
"callAndExpectResolution({video: {mandatory: {minWidth: 320,"
" maxWidth: 320, minHeight: 320, maxHeight: 320}}}, 320, 320);";
MakeTypicalPeerConnectionCall(javascript);
}
#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
#define MAYBE_CanSetupAudioAndVideoCall DISABLED_CanSetupAudioAndVideoCall
#else
#define MAYBE_CanSetupAudioAndVideoCall CanSetupAudioAndVideoCall
#endif
IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, MAYBE_CanSetupAudioAndVideoCall) {
MakeTypicalPeerConnectionCall("call({video: true, audio: true});");
}
IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, MANUAL_CanSetupCallAndSendDtmf) {
MakeTypicalPeerConnectionCall("callAndSendDtmf(\'123,abc\');");
}
IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest,
DISABLED_CanMakeEmptyCallThenAddStreamsAndRenegotiate) {
const char* kJavascript =
"callEmptyThenAddOneStreamAndRenegotiate({video: true, audio: true});";
MakeTypicalPeerConnectionCall(kJavascript);
}
#if defined(OS_WIN)
#define MAYBE_CanForwardRemoteStream DISABLED_CanForwardRemoteStream
#define MAYBE_CanForwardRemoteStream720p DISABLED_CanForwardRemoteStream720p
#else
#define MAYBE_CanForwardRemoteStream CanForwardRemoteStream
#define MAYBE_CanForwardRemoteStream720p CanForwardRemoteStream720p
#endif
IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, MAYBE_CanForwardRemoteStream) {
MakeTypicalPeerConnectionCall(
"callAndForwardRemoteStream({video: true, audio: false});");
}
IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, MAYBE_CanForwardRemoteStream720p) {
const std::string javascript = GenerateGetUserMediaCall(
"callAndForwardRemoteStream", 1280, 1280, 720, 720, 10, 30);
MakeTypicalPeerConnectionCall(javascript);
}
#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
#define MAYBE_CanSetupAudioAndVideoCallWithoutMsidAndBundle\
DISABLED_CanSetupAudioAndVideoCallWithoutMsidAndBundle
#else
#define MAYBE_CanSetupAudioAndVideoCallWithoutMsidAndBundle\
CanSetupAudioAndVideoCallWithoutMsidAndBundle
#endif
IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest,
MAYBE_CanSetupAudioAndVideoCallWithoutMsidAndBundle) {
MakeTypicalPeerConnectionCall("callWithoutMsidAndBundle();");
}
#if defined(USE_OZONE)
#define MAYBE_NegotiateUnsupportedVideoCodec\
DISABLED_NegotiateUnsupportedVideoCodec
#else
#define MAYBE_NegotiateUnsupportedVideoCodec NegotiateUnsupportedVideoCodec
#endif
IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest,
MAYBE_NegotiateUnsupportedVideoCodec) {
MakeTypicalPeerConnectionCall("negotiateUnsupportedVideoCodec();");
}
#if defined(USE_OZONE)
#define MAYBE_NegotiateNonCryptoCall DISABLED_NegotiateNonCryptoCall
#else
#define MAYBE_NegotiateNonCryptoCall NegotiateNonCryptoCall
#endif
IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, MAYBE_NegotiateNonCryptoCall) {
MakeTypicalPeerConnectionCall("negotiateNonCryptoCall();");
}
IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, NegotiateOfferWithBLine) {
MakeTypicalPeerConnectionCall("negotiateOfferWithBLine();");
}
#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
#define MAYBE_CanSetupLegacyCall DISABLED_CanSetupLegacyCall
#else
#define MAYBE_CanSetupLegacyCall CanSetupLegacyCall
#endif
IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, MAYBE_CanSetupLegacyCall) {
MakeTypicalPeerConnectionCall("callWithLegacySdp();");
}
IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, CallWithDataOnly) {
MakeTypicalPeerConnectionCall("callWithDataOnly();");
}
IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, CallWithSctpDataOnly) {
MakeTypicalPeerConnectionCall("callWithSctpDataOnly();");
}
#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
#define MAYBE_CallWithDataAndMedia DISABLED_CallWithDataAndMedia
#else
#define MAYBE_CallWithDataAndMedia CallWithDataAndMedia
#endif
IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, MAYBE_CallWithDataAndMedia) {
MakeTypicalPeerConnectionCall("callWithDataAndMedia();");
}
#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
#define MAYBE_CallWithSctpDataAndMedia DISABLED_CallWithSctpDataAndMedia
#else
#define MAYBE_CallWithSctpDataAndMedia CallWithSctpDataAndMedia
#endif
IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest,
MAYBE_CallWithSctpDataAndMedia) {
MakeTypicalPeerConnectionCall("callWithSctpDataAndMedia();");
}
#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
#define MAYBE_CallWithDataAndLaterAddMedia DISABLED_CallWithDataAndLaterAddMedia
#else
#define MAYBE_CallWithDataAndLaterAddMedia DISABLED_CallWithDataAndLaterAddMedia
#endif
IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, MAYBE_CallWithDataAndLaterAddMedia) {
MakeTypicalPeerConnectionCall("callWithDataAndLaterAddMedia();");
}
#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
#define MAYBE_CallWithNewVideoMediaStream DISABLED_CallWithNewVideoMediaStream
#else
#define MAYBE_CallWithNewVideoMediaStream CallWithNewVideoMediaStream
#endif
IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, MAYBE_CallWithNewVideoMediaStream) {
MakeTypicalPeerConnectionCall("callWithNewVideoMediaStream();");
}
IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, MANUAL_CallAndModifyStream) {
MakeTypicalPeerConnectionCall(
"callWithNewVideoMediaStreamLaterSwitchToAudio();");
}
IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, AddTwoMediaStreamsToOnePC) {
MakeTypicalPeerConnectionCall("addTwoMediaStreamsToOneConnection();");
}
IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest,
EstablishAudioVideoCallAndMeasureOutputLevel) {
if (!media::AudioManager::Get()->HasAudioOutputDevices()) {
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("callAndEnsureAudioIsPlaying();");
}
IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest,
EstablishAudioVideoCallAndVerifyMutingWorks) {
if (!media::AudioManager::Get()->HasAudioOutputDevices()) {
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("callAndEnsureAudioTrackMutingWorks();");
}
IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest,
EstablishAudioVideoCallAndVerifyUnmutingWorks) {
if (!media::AudioManager::Get()->HasAudioOutputDevices()) {
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("callAndEnsureAudioTrackUnmutingWorks();");
}
IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, CallAndVerifyVideoMutingWorks) {
MakeTypicalPeerConnectionCall("callAndEnsureVideoTrackMutingWorks();");
}
#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
#define MAYBE_CallWithAecDump DISABLED_CallWithAecDump
#else
#define MAYBE_CallWithAecDump CallWithAecDump
#endif
IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, MAYBE_CallWithAecDump) {
ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
NavigateToURL(shell(), GURL(""));
base::FilePath dump_file;
ASSERT_TRUE(CreateTemporaryFile(&dump_file));
WebRTCInternals::GetInstance()->FileSelected(dump_file, -1, NULL);
GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html"));
NavigateToURL(shell(), url);
DisableOpusIfOnAndroid();
ExecuteJavascriptAndWaitForOk("call({video: true, audio: true});");
EXPECT_TRUE(base::PathExists(dump_file));
int64 file_size = 0;
EXPECT_TRUE(base::GetFileSize(dump_file, &file_size));
EXPECT_GT(file_size, 0);
base::DeleteFile(dump_file, false);
}
#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
#define MAYBE_CallWithAecDumpEnabledThenDisabled DISABLED_CallWithAecDumpEnabledThenDisabled
#else
#define MAYBE_CallWithAecDumpEnabledThenDisabled CallWithAecDumpEnabledThenDisabled
#endif
IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest,
MAYBE_CallWithAecDumpEnabledThenDisabled) {
ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
NavigateToURL(shell(), GURL(""));
base::FilePath dump_file;
ASSERT_TRUE(CreateTemporaryFile(&dump_file));
WebRTCInternals::GetInstance()->FileSelected(dump_file, -1, NULL);
WebRTCInternals::GetInstance()->DisableAecDump();
GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html"));
NavigateToURL(shell(), url);
DisableOpusIfOnAndroid();
ExecuteJavascriptAndWaitForOk("call({video: true, audio: true});");
EXPECT_TRUE(base::PathExists(dump_file));
int64 file_size = 0;
EXPECT_TRUE(base::GetFileSize(dump_file, &file_size));
EXPECT_EQ(0, file_size);
base::DeleteFile(dump_file, false);
}
}