Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "base/command_line.h" | |
| 6 #include "base/file_util.h" | |
| 7 #include "base/platform_file.h" | |
| 8 #include "base/strings/utf_string_conversions.h" | |
| 9 #include "content/public/common/content_switches.h" | |
| 10 #include "content/public/test/browser_test_utils.h" | |
| 11 #include "content/shell/browser/shell.h" | |
| 12 #include "content/test/content_browser_test.h" | |
| 13 #include "content/test/content_browser_test_utils.h" | |
| 14 #include "net/test/embedded_test_server/embedded_test_server.h" | |
| 15 | |
| 16 namespace content { | |
| 17 | |
| 18 // This tests AEC dump enabled using the command line flag. It does not test AEC | |
| 19 // dump enabled using webrtc-internals (that's tested in webrtc_browsertest.cc). | |
| 20 class WebrtcAecDumpBrowserTest : public ContentBrowserTest { | |
| 21 public: | |
| 22 WebrtcAecDumpBrowserTest() {} | |
| 23 virtual ~WebrtcAecDumpBrowserTest() {} | |
| 24 | |
| 25 virtual void SetUp() OVERRIDE { | |
| 26 // Set up file name. | |
|
phoglund_chromium
2013/12/18 14:20:46
You should be able to use https://code.google.com/
Henrik Grunell
2013/12/19 08:43:14
I suppose you mean delete it here; when test is do
phoglund_chromium
2013/12/19 11:57:04
Right, I mean you don't have to delete it here jus
| |
| 27 ASSERT_TRUE(base::GetTempDir(&dump_file_)); | |
| 28 dump_file_ = dump_file_.Append( | |
| 29 base::FilePath(FILE_PATH_LITERAL("audio.aecdump"))); | |
| 30 ASSERT_TRUE(base::DeleteFile(dump_file_, false)); | |
| 31 | |
| 32 ContentBrowserTest::SetUp(); | |
| 33 } | |
| 34 | |
| 35 virtual void TearDown() OVERRIDE { | |
| 36 EXPECT_TRUE(base::DeleteFile(dump_file_, false)); | |
| 37 | |
| 38 ContentBrowserTest::TearDown(); | |
| 39 } | |
| 40 | |
| 41 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | |
| 42 // We need fake devices in this test since we want to run on naked VMs. We | |
| 43 // assume these switches are set by default in content_browsertests. | |
| 44 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( | |
| 45 switches::kUseFakeDeviceForMediaStream)); | |
| 46 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( | |
| 47 switches::kUseFakeUIForMediaStream)); | |
| 48 | |
| 49 // Enable AEC dump with the command line flag. | |
| 50 command_line->AppendSwitchPath(switches::kEnableWebRtcAecRecordings, | |
| 51 dump_file_); | |
|
phoglund_chromium
2013/12/18 14:20:46
You should have this too:
// The video playba
Henrik Grunell
2013/12/19 08:43:14
Done.
| |
| 52 } | |
| 53 | |
| 54 protected: | |
| 55 bool ExecuteJavascript(const std::string& javascript) { | |
| 56 return ExecuteScript(shell()->web_contents(), javascript); | |
| 57 } | |
| 58 | |
| 59 void ExpectTitle(const std::string& expected_title) const { | |
| 60 base::string16 expected_title16(ASCIIToUTF16(expected_title)); | |
| 61 TitleWatcher title_watcher(shell()->web_contents(), expected_title16); | |
| 62 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle()); | |
| 63 } | |
| 64 | |
| 65 base::FilePath dump_file_; | |
| 66 }; | |
| 67 | |
| 68 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) | |
| 69 // Timing out on ARM linux bot: http://crbug.com/238490 | |
| 70 #define MAYBE_CallWithAecDump DISABLED_CallWithAecDump | |
| 71 #else | |
| 72 #define MAYBE_CallWithAecDump CallWithAecDump | |
| 73 #endif | |
| 74 | |
| 75 // This tests will make a complete PeerConnection-based call, verify that | |
| 76 // video is playing for the call, and verify that a non-empty AEC dump file | |
| 77 // exists. | |
| 78 IN_PROC_BROWSER_TEST_F(WebrtcAecDumpBrowserTest, MAYBE_CallWithAecDump) { | |
| 79 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | |
| 80 | |
| 81 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html")); | |
| 82 NavigateToURL(shell(), url); | |
| 83 | |
| 84 EXPECT_TRUE(ExecuteJavascript("call({video: true, audio: true});")); | |
| 85 ExpectTitle("OK"); | |
| 86 | |
| 87 EXPECT_TRUE(base::PathExists(dump_file_)); | |
| 88 int64 file_size = 0; | |
| 89 EXPECT_TRUE(base::GetFileSize(dump_file_, &file_size)); | |
| 90 EXPECT_GT(file_size, 0); | |
| 91 } | |
| 92 | |
| 93 } // namespace content | |
| OLD | NEW |