Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/platform_file.h" | 8 #include "base/platform_file.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "base/test/trace_event_analyzer.h" | 11 #include "base/test/trace_event_analyzer.h" |
| 12 #include "content/public/common/content_switches.h" | 12 #include "content/public/common/content_switches.h" |
| 13 #include "content/public/test/browser_test_utils.h" | 13 #include "content/public/test/browser_test_utils.h" |
| 14 #include "content/shell/browser/shell.h" | 14 #include "content/shell/browser/shell.h" |
| 15 #include "content/test/content_browser_test_utils.h" | 15 #include "content/test/content_browser_test_utils.h" |
| 16 #include "content/test/webrtc_content_browsertest_base.h" | 16 #include "content/test/webrtc_content_browsertest_base.h" |
| 17 #include "net/test/embedded_test_server/embedded_test_server.h" | 17 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 | 20 |
| 21 // This tests AEC dump enabled using the command line flag. It does not test AEC | 21 // This tests AEC dump enabled using the command line flag. It does not test AEC |
| 22 // dump enabled using webrtc-internals (that's tested in webrtc_browsertest.cc). | 22 // dump enabled using webrtc-internals (that's tested in webrtc_browsertest.cc). |
| 23 class WebRtcAecDumpBrowserTest : public WebRtcContentBrowserTest { | 23 class WebRtcAecDumpBrowserTest : public WebRtcContentBrowserTest, |
| 24 public testing::WithParamInterface<bool> { | |
| 24 public: | 25 public: |
| 25 WebRtcAecDumpBrowserTest() {} | 26 WebRtcAecDumpBrowserTest() { |
| 27 if (GetParam()) { | |
| 28 CommandLine::ForCurrentProcess()->AppendSwitch( | |
|
phoglund_chromium
2014/03/12 17:27:18
Same here.
no longer working on chromium
2014/03/12 18:06:08
ditto
| |
| 29 switches::kEnableAudioTrackProcessing); | |
| 30 } | |
| 31 } | |
| 26 virtual ~WebRtcAecDumpBrowserTest() {} | 32 virtual ~WebRtcAecDumpBrowserTest() {} |
| 27 | 33 |
| 28 virtual void SetUp() OVERRIDE { | 34 virtual void SetUp() OVERRIDE { |
| 29 // Find a safe place to write the dump to. | 35 // Find a safe place to write the dump to. |
| 30 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 36 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 31 ASSERT_TRUE(CreateTemporaryFileInDir(temp_dir_.path(), &dump_file_)); | 37 ASSERT_TRUE(CreateTemporaryFileInDir(temp_dir_.path(), &dump_file_)); |
| 32 | 38 |
| 33 EnablePixelOutput(); | 39 EnablePixelOutput(); |
| 34 ContentBrowserTest::SetUp(); | 40 ContentBrowserTest::SetUp(); |
| 35 } | 41 } |
| 36 | 42 |
| 37 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 43 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 38 WebRtcContentBrowserTest::SetUpCommandLine(command_line); | 44 WebRtcContentBrowserTest::SetUpCommandLine(command_line); |
| 39 | 45 |
| 40 // Enable AEC dump with the command line flag. | 46 // Enable AEC dump with the command line flag. |
| 41 command_line->AppendSwitchPath(switches::kEnableWebRtcAecRecordings, | 47 command_line->AppendSwitchPath(switches::kEnableWebRtcAecRecordings, |
| 42 dump_file_); | 48 dump_file_); |
| 43 } | 49 } |
| 44 | 50 |
| 45 protected: | 51 protected: |
| 46 base::ScopedTempDir temp_dir_; | 52 base::ScopedTempDir temp_dir_; |
| 47 base::FilePath dump_file_; | 53 base::FilePath dump_file_; |
| 48 | 54 |
| 49 private: | 55 private: |
| 50 DISALLOW_COPY_AND_ASSIGN(WebRtcAecDumpBrowserTest); | 56 DISALLOW_COPY_AND_ASSIGN(WebRtcAecDumpBrowserTest); |
| 51 }; | 57 }; |
| 52 | 58 |
| 59 static const bool kRunTestsWithFlag[] = { false, true }; | |
| 60 INSTANTIATE_TEST_CASE_P(WebRtcAecDumpBrowserTests, | |
| 61 WebRtcAecDumpBrowserTest, | |
| 62 testing::ValuesIn(kRunTestsWithFlag)); | |
| 63 | |
| 53 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) | 64 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) |
| 54 // Timing out on ARM linux bot: http://crbug.com/238490 | 65 // Timing out on ARM linux bot: http://crbug.com/238490 |
| 55 #define MAYBE_CallWithAecDump DISABLED_CallWithAecDump | 66 #define MAYBE_CallWithAecDump DISABLED_CallWithAecDump |
| 56 #else | 67 #else |
| 57 #define MAYBE_CallWithAecDump CallWithAecDump | 68 #define MAYBE_CallWithAecDump CallWithAecDump |
| 58 #endif | 69 #endif |
| 59 | 70 |
| 60 // This tests will make a complete PeerConnection-based call, verify that | 71 // This tests will make a complete PeerConnection-based call, verify that |
| 61 // video is playing for the call, and verify that a non-empty AEC dump file | 72 // video is playing for the call, and verify that a non-empty AEC dump file |
| 62 // exists. | 73 // exists. |
| 63 IN_PROC_BROWSER_TEST_F(WebRtcAecDumpBrowserTest, MAYBE_CallWithAecDump) { | 74 IN_PROC_BROWSER_TEST_P(WebRtcAecDumpBrowserTest, MAYBE_CallWithAecDump) { |
| 64 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 75 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 65 | 76 |
| 66 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html")); | 77 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html")); |
| 67 NavigateToURL(shell(), url); | 78 NavigateToURL(shell(), url); |
| 68 | 79 |
| 69 #if defined (OS_ANDROID) | 80 #if defined (OS_ANDROID) |
| 70 // Always force iSAC 16K on Android for now (Opus is broken). | 81 // Always force iSAC 16K on Android for now (Opus is broken). |
| 71 EXPECT_EQ("isac-forced", | 82 EXPECT_EQ("isac-forced", |
| 72 ExecuteJavascriptAndReturnResult("forceIsac16KInSdp();")); | 83 ExecuteJavascriptAndReturnResult("forceIsac16KInSdp();")); |
| 73 #endif | 84 #endif |
| 74 | 85 |
| 75 ExecuteJavascriptAndWaitForOk("call({video: true, audio: true});"); | 86 ExecuteJavascriptAndWaitForOk("call({video: true, audio: true});"); |
| 76 | 87 |
| 77 EXPECT_TRUE(base::PathExists(dump_file_)); | 88 EXPECT_TRUE(base::PathExists(dump_file_)); |
| 78 int64 file_size = 0; | 89 int64 file_size = 0; |
| 79 EXPECT_TRUE(base::GetFileSize(dump_file_, &file_size)); | 90 EXPECT_TRUE(base::GetFileSize(dump_file_, &file_size)); |
| 80 EXPECT_GT(file_size, 0); | 91 EXPECT_GT(file_size, 0); |
| 81 } | 92 } |
| 82 | 93 |
| 83 } // namespace content | 94 } // namespace content |
| OLD | NEW |