This source file includes following definitions.
- SetUp
- SetUpCommandLine
- IN_PROC_BROWSER_TEST_P
#include "base/command_line.h"
#include "base/file_util.h"
#include "base/json/json_reader.h"
#include "base/platform_file.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/trace_event_analyzer.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/shell/browser/shell.h"
#include "content/test/webrtc_content_browsertest_base.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
namespace content {
class WebRtcAecDumpBrowserTest : public WebRtcContentBrowserTest,
public testing::WithParamInterface<bool> {
public:
WebRtcAecDumpBrowserTest() {}
virtual ~WebRtcAecDumpBrowserTest() {}
virtual void SetUp() OVERRIDE {
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
ASSERT_TRUE(CreateTemporaryFileInDir(temp_dir_.path(), &dump_file_));
EnablePixelOutput();
ContentBrowserTest::SetUp();
}
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
WebRtcContentBrowserTest::SetUpCommandLine(command_line);
command_line->AppendSwitchPath(switches::kEnableWebRtcAecRecordings,
dump_file_);
bool enable_audio_track_processing = GetParam();
if (enable_audio_track_processing)
command_line->AppendSwitch(switches::kEnableAudioTrackProcessing);
}
protected:
base::ScopedTempDir temp_dir_;
base::FilePath dump_file_;
private:
DISALLOW_COPY_AND_ASSIGN(WebRtcAecDumpBrowserTest);
};
static const bool kRunTestsWithFlag[] = { false, true };
INSTANTIATE_TEST_CASE_P(WebRtcAecDumpBrowserTests,
WebRtcAecDumpBrowserTest,
testing::ValuesIn(kRunTestsWithFlag));
#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(WebRtcAecDumpBrowserTest, MAYBE_CallWithAecDump) {
ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html"));
NavigateToURL(shell(), url);
#if defined (OS_ANDROID)
EXPECT_EQ("isac-forced",
ExecuteJavascriptAndReturnResult("forceIsac16KInSdp();"));
#endif
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);
}
}