Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(516)

Side by Side Diff: content/browser/media/webrtc_aecdump_browsertest.cc

Issue 101063003: Add browser test for AEC dump. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/media/webrtc_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 // Find a safe place to write the dump to.
27 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
28 ASSERT_TRUE(CreateTemporaryFileInDir(temp_dir_.path(), &dump_file_));
29
30 ContentBrowserTest::SetUp();
31 }
32
33 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
34 // We need fake devices in this test since we want to run on naked VMs. We
35 // assume these switches are set by default in content_browsertests.
36 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch(
37 switches::kUseFakeDeviceForMediaStream));
38 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch(
39 switches::kUseFakeUIForMediaStream));
40
41 // The video playback will not work without a GPU, so force its use here.
42 // This may not be available on all VMs though.
43 command_line->AppendSwitch(switches::kUseGpuInTests);
44
45 // Enable AEC dump with the command line flag.
46 command_line->AppendSwitchPath(switches::kEnableWebRtcAecRecordings,
47 dump_file_);
48 }
49
50 protected:
51 bool ExecuteJavascript(const std::string& javascript) {
52 return ExecuteScript(shell()->web_contents(), javascript);
53 }
54
55 void ExpectTitle(const std::string& expected_title) const {
56 base::string16 expected_title16(ASCIIToUTF16(expected_title));
57 TitleWatcher title_watcher(shell()->web_contents(), expected_title16);
58 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle());
59 }
60
61 base::ScopedTempDir temp_dir_;
62 base::FilePath dump_file_;
63
64 private:
65 DISALLOW_COPY_AND_ASSIGN(WebrtcAecDumpBrowserTest);
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
OLDNEW
« no previous file with comments | « no previous file | content/browser/media/webrtc_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698