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

Unified Diff: content/public/test/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 side-by-side diff with in-line comments
Download patch
Index: content/public/test/test_launcher.cc
diff --git a/content/public/test/test_launcher.cc b/content/public/test/test_launcher.cc
index 12244614a26945a2d2f217b8f961939bf498f0de..51b1730f288c153dda5f3cc64d114735ea259c4a 100644
--- a/content/public/test/test_launcher.cc
+++ b/content/public/test/test_launcher.cc
@@ -22,8 +22,11 @@
#include "base/test/test_timeouts.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
+#include "content/public/app/content_main.h"
+#include "content/public/app/content_main_delegate.h"
#include "content/public/app/startup_helper_win.h"
#include "content/public/common/sandbox_init.h"
+#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test.h"
#include "net/base/escape.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -643,9 +646,43 @@ const char kHelpFlag[] = "help";
const char kWarmupFlag[] = "warmup";
+extern const char kLaunchAsBrowser[] = "as-browser";
jam 2012/09/04 15:18:14 nit: no extern
phoglund_chromium 2012/09/05 09:41:05 Done.
+
TestLauncherDelegate::~TestLauncherDelegate() {
}
+bool TestLauncherDelegate::Run(int argc, char** argv, int* return_code) {
+#if defined(OS_WIN) || defined(OS_LINUX)
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
+ bool launch_chrome =
jam 2012/09/04 15:18:14 nit: now that this code is in content, launch_chro
phoglund_chromium 2012/09/05 09:41:05 I split this method into two instead, so that vari
+ command_line->HasSwitch(switches::kProcessType) ||
+ command_line->HasSwitch(kLaunchAsBrowser);
+#endif
+#if defined(OS_WIN)
+ if (launch_chrome) {
+ sandbox::SandboxInterfaceInfo sandbox_info = {0};
+ content::InitializeSandboxInfo(&sandbox_info);
+ scoped_ptr<content::ContentMainDelegate> chrome_main_delegate(
+ CreateContentMainDelegate());
+ *return_code = content::ContentMain(GetModuleHandle(NULL),
+ &sandbox_info,
+ chrome_main_delegate.get());
+ return true;
+ }
+#elif defined(OS_LINUX)
+ if (launch_chrome) {
+ scoped_ptr<content::ContentMainDelegate> chrome_main_delegate(
+ CreateContentMainDelegate());
+ *return_code = content::ContentMain(argc,
+ const_cast<const char**>(argv),
+ chrome_main_delegate.get());
+ return true;
+ }
+#endif // defined(OS_WIN)
+
+ return false;
+}
+
int LaunchTests(TestLauncherDelegate* launcher_delegate,
int argc,
char** argv) {

Powered by Google App Engine
This is Rietveld 408576698