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

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: Don't check return value of DeleteFile. 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
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(CreateTemporaryFile(&dump_file_));
jochen (gone - plz use gerrit) 2013/12/19 12:41:06 why not use a scoped temp directory?
Henrik Grunell 2013/12/19 13:46:10 Didn't know about that class. :) Seems like a good
28
29 ContentBrowserTest::SetUp();
30 }
31
32 virtual void TearDown() OVERRIDE {
33 base::DeleteFile(dump_file_, false);
34
35 ContentBrowserTest::TearDown();
36 }
37
38 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
39 // We need fake devices in this test since we want to run on naked VMs. We
40 // assume these switches are set by default in content_browsertests.
41 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch(
42 switches::kUseFakeDeviceForMediaStream));
43 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch(
44 switches::kUseFakeUIForMediaStream));
45
46 // The video playback will not work without a GPU, so force its use here.
47 // This may not be available on all VMs though.
48 command_line->AppendSwitch(switches::kUseGpuInTests);
49
50 // Enable AEC dump with the command line flag.
51 command_line->AppendSwitchPath(switches::kEnableWebRtcAecRecordings,
52 dump_file_);
53 }
54
55 protected:
56 bool ExecuteJavascript(const std::string& javascript) {
57 return ExecuteScript(shell()->web_contents(), javascript);
58 }
59
60 void ExpectTitle(const std::string& expected_title) const {
61 base::string16 expected_title16(ASCIIToUTF16(expected_title));
62 TitleWatcher title_watcher(shell()->web_contents(), expected_title16);
63 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle());
64 }
65
66 base::FilePath dump_file_;
67 };
jochen (gone - plz use gerrit) 2013/12/19 12:41:06 disallow copy & assign
Henrik Grunell 2013/12/19 13:46:10 Done.
68
69 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
70 // Timing out on ARM linux bot: http://crbug.com/238490
71 #define MAYBE_CallWithAecDump DISABLED_CallWithAecDump
72 #else
73 #define MAYBE_CallWithAecDump CallWithAecDump
74 #endif
75
76 // This tests will make a complete PeerConnection-based call, verify that
77 // video is playing for the call, and verify that a non-empty AEC dump file
78 // exists.
79 IN_PROC_BROWSER_TEST_F(WebrtcAecDumpBrowserTest, MAYBE_CallWithAecDump) {
80 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
81
82 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html"));
83 NavigateToURL(shell(), url);
84
85 EXPECT_TRUE(ExecuteJavascript("call({video: true, audio: true});"));
86 ExpectTitle("OK");
87
88 EXPECT_TRUE(base::PathExists(dump_file_));
89 int64 file_size = 0;
90 EXPECT_TRUE(base::GetFileSize(dump_file_, &file_size));
91 EXPECT_GT(file_size, 0);
92 }
93
94 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/media/webrtc_browsertest.cc » ('j') | content/browser/renderer_host/render_process_host_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698