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/platform_file.h" | 7 #include "base/platform_file.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "content/public/common/content_switches.h" | 9 #include "content/public/common/content_switches.h" |
10 #include "content/public/test/browser_test_utils.h" | 10 #include "content/public/test/browser_test_utils.h" |
11 #include "content/shell/browser/shell.h" | 11 #include "content/shell/browser/shell.h" |
12 #include "content/test/content_browser_test.h" | 12 #include "content/test/content_browser_test.h" |
13 #include "content/test/content_browser_test_utils.h" | 13 #include "content/test/content_browser_test_utils.h" |
14 #include "net/test/embedded_test_server/embedded_test_server.h" | 14 #include "net/test/embedded_test_server/embedded_test_server.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
18 // This tests AEC dump enabled using the command line flag. It does not test AEC | 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). | 19 // dump enabled using webrtc-internals (that's tested in webrtc_browsertest.cc). |
20 class WebrtcAecDumpBrowserTest : public ContentBrowserTest { | 20 class WebrtcAecDumpBrowserTest : public ContentBrowserTest { |
21 public: | 21 public: |
22 WebrtcAecDumpBrowserTest() {} | 22 WebrtcAecDumpBrowserTest() {} |
23 virtual ~WebrtcAecDumpBrowserTest() {} | 23 virtual ~WebrtcAecDumpBrowserTest() {} |
24 | 24 |
25 virtual void SetUp() OVERRIDE { | 25 virtual void SetUp() OVERRIDE { |
26 // Find a safe place to write the dump to. | 26 // Find a safe place to write the dump to. |
27 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 27 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
28 ASSERT_TRUE(CreateTemporaryFileInDir(temp_dir_.path(), &dump_file_)); | 28 ASSERT_TRUE(CreateTemporaryFileInDir(temp_dir_.path(), &dump_file_)); |
29 | 29 |
30 // These tests expect pixel output. | |
31 UseRealGLContexts(); | |
32 | |
33 ContentBrowserTest::SetUp(); | 30 ContentBrowserTest::SetUp(); |
34 } | 31 } |
35 | 32 |
36 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 33 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
37 // We need fake devices in this test since we want to run on naked VMs. We | 34 // We need fake devices in this test since we want to run on naked VMs. We |
38 // assume these switches are set by default in content_browsertests. | 35 // assume these switches are set by default in content_browsertests. |
39 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( | 36 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( |
40 switches::kUseFakeDeviceForMediaStream)); | 37 switches::kUseFakeDeviceForMediaStream)); |
41 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( | 38 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( |
42 switches::kUseFakeUIForMediaStream)); | 39 switches::kUseFakeUIForMediaStream)); |
43 | 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 |
44 // Enable AEC dump with the command line flag. | 45 // Enable AEC dump with the command line flag. |
45 command_line->AppendSwitchPath(switches::kEnableWebRtcAecRecordings, | 46 command_line->AppendSwitchPath(switches::kEnableWebRtcAecRecordings, |
46 dump_file_); | 47 dump_file_); |
47 } | 48 } |
48 | 49 |
49 protected: | 50 protected: |
50 bool ExecuteJavascript(const std::string& javascript) { | 51 bool ExecuteJavascript(const std::string& javascript) { |
51 return ExecuteScript(shell()->web_contents(), javascript); | 52 return ExecuteScript(shell()->web_contents(), javascript); |
52 } | 53 } |
53 | 54 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 EXPECT_TRUE(ExecuteJavascript("call({video: true, audio: true});")); | 90 EXPECT_TRUE(ExecuteJavascript("call({video: true, audio: true});")); |
90 ExpectTitle("OK"); | 91 ExpectTitle("OK"); |
91 | 92 |
92 EXPECT_TRUE(base::PathExists(dump_file_)); | 93 EXPECT_TRUE(base::PathExists(dump_file_)); |
93 int64 file_size = 0; | 94 int64 file_size = 0; |
94 EXPECT_TRUE(base::GetFileSize(dump_file_, &file_size)); | 95 EXPECT_TRUE(base::GetFileSize(dump_file_, &file_size)); |
95 EXPECT_GT(file_size, 0); | 96 EXPECT_GT(file_size, 0); |
96 } | 97 } |
97 | 98 |
98 } // namespace content | 99 } // namespace content |
OLD | NEW |