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

Side by Side Diff: content/public/test/test_launcher.cc

Issue 190853004: Convert ContentMain to take a struct instead of parameters that vary depending on the platform. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 9 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 <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 CommandLine* command_line = CommandLine::ForCurrentProcess(); 432 CommandLine* command_line = CommandLine::ForCurrentProcess();
433 return command_line->HasSwitch(switches::kProcessType) || 433 return command_line->HasSwitch(switches::kProcessType) ||
434 command_line->HasSwitch(kLaunchAsBrowser); 434 command_line->HasSwitch(kLaunchAsBrowser);
435 #else 435 #else
436 return false; 436 return false;
437 #endif // defined(OS_WIN) || defined(OS_LINUX) 437 #endif // defined(OS_WIN) || defined(OS_LINUX)
438 } 438 }
439 439
440 int RunContentMain(int argc, char** argv, 440 int RunContentMain(int argc, char** argv,
441 TestLauncherDelegate* launcher_delegate) { 441 TestLauncherDelegate* launcher_delegate) {
442 scoped_ptr<ContentMainDelegate> chrome_main_delegate(
443 launcher_delegate->CreateContentMainDelegate());
444 ContentMainParams params(chrome_main_delegate.get());
445
442 #if defined(OS_WIN) 446 #if defined(OS_WIN)
443 sandbox::SandboxInterfaceInfo sandbox_info = {0}; 447 sandbox::SandboxInterfaceInfo sandbox_info = {0};
444 InitializeSandboxInfo(&sandbox_info); 448 InitializeSandboxInfo(&sandbox_info);
445 scoped_ptr<ContentMainDelegate> chrome_main_delegate( 449
446 launcher_delegate->CreateContentMainDelegate()); 450 params.instance = GetModuleHandle(NULL);
447 return ContentMain(GetModuleHandle(NULL), 451 params.sandbox_info = &sandbox_info;
448 &sandbox_info,
449 chrome_main_delegate.get());
450 #elif defined(OS_LINUX) 452 #elif defined(OS_LINUX)
451 scoped_ptr<ContentMainDelegate> chrome_main_delegate( 453 params.argc = argc;
452 launcher_delegate->CreateContentMainDelegate()); 454 params.argv = const_cast<const char**>(argv);
453 return ContentMain(argc, const_cast<const char**>(argv),
454 chrome_main_delegate.get());
455 #endif // defined(OS_WIN) 455 #endif // defined(OS_WIN)
456 NOTREACHED(); 456
457 return 0; 457 return ContentMain(&params);
458 } 458 }
459 459
460 int LaunchTests(TestLauncherDelegate* launcher_delegate, 460 int LaunchTests(TestLauncherDelegate* launcher_delegate,
461 int default_jobs, 461 int default_jobs,
462 int argc, 462 int argc,
463 char** argv) { 463 char** argv) {
464 DCHECK(!g_launcher_delegate); 464 DCHECK(!g_launcher_delegate);
465 g_launcher_delegate = launcher_delegate; 465 g_launcher_delegate = launcher_delegate;
466 466
467 CommandLine::Init(argc, argv); 467 CommandLine::Init(argc, argv);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 base::TestLauncher launcher(&delegate, default_jobs); 511 base::TestLauncher launcher(&delegate, default_jobs);
512 bool success = launcher.Run(argc, argv); 512 bool success = launcher.Run(argc, argv);
513 return (success ? 0 : 1); 513 return (success ? 0 : 1);
514 } 514 }
515 515
516 TestLauncherDelegate* GetCurrentTestLauncherDelegate() { 516 TestLauncherDelegate* GetCurrentTestLauncherDelegate() {
517 return g_launcher_delegate; 517 return g_launcher_delegate;
518 } 518 }
519 519
520 } // namespace content 520 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698