[email protected] | bb36d82 | 2011-09-30 20:55:09 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "content/test/test_launcher.h" |
| 6 | |
| 7 | #include "base/command_line.h" |
| 8 | #include "base/logging.h" |
| 9 | #include "base/scoped_temp_dir.h" |
| 10 | #include "content/test/content_test_suite.h" |
| 11 | |
| 12 | class ContentTestLauncherDelegate : public test_launcher::TestLauncherDelegate { |
| 13 | public: |
| 14 | ContentTestLauncherDelegate() { |
| 15 | } |
| 16 | |
| 17 | virtual ~ContentTestLauncherDelegate() { |
| 18 | } |
| 19 | |
| 20 | virtual void EarlyInitialize() OVERRIDE { |
| 21 | } |
| 22 | |
| 23 | virtual bool Run(int argc, char** argv, int* return_code) OVERRIDE { |
| 24 | CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 25 | |
| 26 | // TODO(pkasting): This "single_process vs. single-process" design is |
| 27 | // terrible UI. Instead, there should be some sort of signal flag on the |
| 28 | // command line, with all subsequent arguments passed through to the |
| 29 | // underlying browser. |
| 30 | if (command_line->HasSwitch(test_launcher::kSingleProcessTestsFlag) || |
| 31 | command_line->HasSwitch( |
| 32 | test_launcher::kSingleProcessTestsAndChromeFlag) || |
| 33 | command_line->HasSwitch(test_launcher::kGTestListTestsFlag) || |
| 34 | command_line->HasSwitch(test_launcher::kGTestHelpFlag)) { |
| 35 | *return_code = ContentTestSuite(argc, argv).Run(); |
| 36 | return true; |
| 37 | } |
| 38 | |
| 39 | return false; |
| 40 | } |
| 41 | |
| 42 | virtual bool AdjustChildProcessCommandLine( |
| 43 | CommandLine* command_line) OVERRIDE { |
| 44 | return true; |
| 45 | } |
| 46 | |
| 47 | private: |
| 48 | DISALLOW_COPY_AND_ASSIGN(ContentTestLauncherDelegate); |
| 49 | }; |
| 50 | |
| 51 | int main(int argc, char** argv) { |
| 52 | ContentTestLauncherDelegate launcher_delegate; |
| 53 | return test_launcher::LaunchTests(&launcher_delegate, argc, argv); |
[email protected] | 76df8e36 | 2011-09-30 21:23:58 | [diff] [blame^] | 54 | } |