| 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 |
| 30 ContentBrowserTest::SetUp(); | 33 ContentBrowserTest::SetUp(); |
| 31 } | 34 } |
| 32 | 35 |
| 33 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 36 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 34 // We need fake devices in this test since we want to run on naked VMs. We | 37 // 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. | 38 // assume these switches are set by default in content_browsertests. |
| 36 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( | 39 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( |
| 37 switches::kUseFakeDeviceForMediaStream)); | 40 switches::kUseFakeDeviceForMediaStream)); |
| 38 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( | 41 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( |
| 39 switches::kUseFakeUIForMediaStream)); | 42 switches::kUseFakeUIForMediaStream)); |
| 40 | 43 |
| 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. | 44 // Enable AEC dump with the command line flag. |
| 46 command_line->AppendSwitchPath(switches::kEnableWebRtcAecRecordings, | 45 command_line->AppendSwitchPath(switches::kEnableWebRtcAecRecordings, |
| 47 dump_file_); | 46 dump_file_); |
| 48 } | 47 } |
| 49 | 48 |
| 50 protected: | 49 protected: |
| 51 bool ExecuteJavascript(const std::string& javascript) { | 50 bool ExecuteJavascript(const std::string& javascript) { |
| 52 return ExecuteScript(shell()->web_contents(), javascript); | 51 return ExecuteScript(shell()->web_contents(), javascript); |
| 53 } | 52 } |
| 54 | 53 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 EXPECT_TRUE(ExecuteJavascript("call({video: true, audio: true});")); | 89 EXPECT_TRUE(ExecuteJavascript("call({video: true, audio: true});")); |
| 91 ExpectTitle("OK"); | 90 ExpectTitle("OK"); |
| 92 | 91 |
| 93 EXPECT_TRUE(base::PathExists(dump_file_)); | 92 EXPECT_TRUE(base::PathExists(dump_file_)); |
| 94 int64 file_size = 0; | 93 int64 file_size = 0; |
| 95 EXPECT_TRUE(base::GetFileSize(dump_file_, &file_size)); | 94 EXPECT_TRUE(base::GetFileSize(dump_file_, &file_size)); |
| 96 EXPECT_GT(file_size, 0); | 95 EXPECT_GT(file_size, 0); |
| 97 } | 96 } |
| 98 | 97 |
| 99 } // namespace content | 98 } // namespace content |
| OLD | NEW |