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

Side by Side Diff: content/test/content_test_launcher.cc

Issue 10912070: Makes it possible to run content_browsertests with --as-browser and fake WebRTC devices. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/public/test/test_launcher.h" 5 #include "content/public/test/test_launcher.h"
6 6
7 #include "base/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/test/test_suite.h" 11 #include "base/test/test_suite.h"
12 #include "content/public/app/content_main.h" 12 #include "content/browser/browser_main_loop.h"
13 #include "content/browser/renderer_host/media/media_stream_manager.h"
13 #include "content/public/common/content_switches.h" 14 #include "content/public/common/content_switches.h"
14 #include "content/public/test/content_test_suite_base.h" 15 #include "content/public/test/content_test_suite_base.h"
15 #include "content/shell/shell_content_browser_client.h" 16 #include "content/shell/shell_content_browser_client.h"
16 #include "content/shell/shell_content_client.h" 17 #include "content/shell/shell_content_client.h"
17 #include "content/shell/shell_main_delegate.h" 18 #include "content/shell/shell_main_delegate.h"
18 #include "content/shell/shell_switches.h" 19 #include "content/shell/shell_switches.h"
19 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
20 21
21 #if defined(OS_WIN) 22 #if defined(OS_WIN)
22 #include "content/public/app/startup_helper_win.h" 23 #include "content/public/app/startup_helper_win.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 88
88 class ContentTestLauncherDelegate : public test_launcher::TestLauncherDelegate { 89 class ContentTestLauncherDelegate : public test_launcher::TestLauncherDelegate {
89 public: 90 public:
90 ContentTestLauncherDelegate() {} 91 ContentTestLauncherDelegate() {}
91 virtual ~ContentTestLauncherDelegate() {} 92 virtual ~ContentTestLauncherDelegate() {}
92 93
93 virtual std::string GetEmptyTestName() OVERRIDE { 94 virtual std::string GetEmptyTestName() OVERRIDE {
94 return std::string(); 95 return std::string();
95 } 96 }
96 97
97 virtual bool Run(int argc, char** argv, int* return_code) OVERRIDE {
98 #if defined(OS_WIN) || defined(OS_LINUX)
99 CommandLine* command_line = CommandLine::ForCurrentProcess();
100 if (command_line->HasSwitch(switches::kProcessType)) {
101 ShellMainDelegate delegate;
102 #if defined(OS_WIN)
103 sandbox::SandboxInterfaceInfo sandbox_info = {0};
104 InitializeSandboxInfo(&sandbox_info);
105 *return_code =
106 ContentMain(GetModuleHandle(NULL), &sandbox_info, &delegate);
107 #elif defined(OS_LINUX)
108 *return_code = ContentMain(argc,
109 const_cast<const char**>(argv),
110 &delegate);
111 #endif // defined(OS_WIN)
112 return true;
113 }
114 #endif // defined(OS_WIN) || defined(OS_LINUX)
115
116 return false;
117 }
118
119 virtual int RunTestSuite(int argc, char** argv) OVERRIDE { 98 virtual int RunTestSuite(int argc, char** argv) OVERRIDE {
120 return ContentBrowserTestSuite(argc, argv).Run(); 99 return ContentBrowserTestSuite(argc, argv).Run();
121 } 100 }
122 101
123 virtual bool AdjustChildProcessCommandLine( 102 virtual bool AdjustChildProcessCommandLine(
124 CommandLine* command_line, const FilePath& temp_data_dir) OVERRIDE { 103 CommandLine* command_line, const FilePath& temp_data_dir) OVERRIDE {
125 command_line->AppendSwitchPath(switches::kContentShellDataPath, 104 command_line->AppendSwitchPath(switches::kContentShellDataPath,
126 temp_data_dir); 105 temp_data_dir);
127 return true; 106 return true;
128 } 107 }
129 108
109 protected:
110 virtual content::ContentMainDelegate* CreateContentMainDelegate() OVERRIDE {
111 return new ShellMainDelegate();
112 }
113
130 private: 114 private:
131 DISALLOW_COPY_AND_ASSIGN(ContentTestLauncherDelegate); 115 DISALLOW_COPY_AND_ASSIGN(ContentTestLauncherDelegate);
132 }; 116 };
133 117
134 } // namespace content 118 } // namespace content
135 119
136 int main(int argc, char** argv) { 120 int main(int argc, char** argv) {
137 content::ContentTestLauncherDelegate launcher_delegate; 121 content::ContentTestLauncherDelegate launcher_delegate;
122 content::BrowserMainLoop::UseFakeMediaStreamDevice();
138 return test_launcher::LaunchTests(&launcher_delegate, argc, argv); 123 return test_launcher::LaunchTests(&launcher_delegate, argc, argv);
139 } 124 }
OLDNEW
« content/public/test/test_launcher.cc ('K') | « content/public/test/test_launcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698