OLD | NEW |
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 "chrome/test/base/chrome_test_launcher.h" | 5 #include "chrome/test/base/chrome_test_launcher.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/leak_annotations.h" | 8 #include "base/debug/leak_annotations.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 #endif | 45 #endif |
46 | 46 |
47 namespace { | 47 namespace { |
48 | 48 |
49 class ChromeTestLauncherDelegate : public content::TestLauncherDelegate { | 49 class ChromeTestLauncherDelegate : public content::TestLauncherDelegate { |
50 public: | 50 public: |
51 explicit ChromeTestLauncherDelegate(ChromeTestSuiteRunner* runner) | 51 explicit ChromeTestLauncherDelegate(ChromeTestSuiteRunner* runner) |
52 : runner_(runner) {} | 52 : runner_(runner) {} |
53 virtual ~ChromeTestLauncherDelegate() {} | 53 virtual ~ChromeTestLauncherDelegate() {} |
54 | 54 |
55 virtual int RunTestSuite(int argc, char** argv) OVERRIDE { | 55 virtual int RunTestSuite(int argc, char** argv) override { |
56 return runner_->RunTestSuite(argc, argv); | 56 return runner_->RunTestSuite(argc, argv); |
57 } | 57 } |
58 | 58 |
59 virtual bool AdjustChildProcessCommandLine( | 59 virtual bool AdjustChildProcessCommandLine( |
60 CommandLine* command_line, const base::FilePath& temp_data_dir) OVERRIDE { | 60 CommandLine* command_line, const base::FilePath& temp_data_dir) override { |
61 CommandLine new_command_line(command_line->GetProgram()); | 61 CommandLine new_command_line(command_line->GetProgram()); |
62 CommandLine::SwitchMap switches = command_line->GetSwitches(); | 62 CommandLine::SwitchMap switches = command_line->GetSwitches(); |
63 | 63 |
64 // Strip out user-data-dir if present. We will add it back in again later. | 64 // Strip out user-data-dir if present. We will add it back in again later. |
65 switches.erase(switches::kUserDataDir); | 65 switches.erase(switches::kUserDataDir); |
66 | 66 |
67 for (CommandLine::SwitchMap::const_iterator iter = switches.begin(); | 67 for (CommandLine::SwitchMap::const_iterator iter = switches.begin(); |
68 iter != switches.end(); ++iter) { | 68 iter != switches.end(); ++iter) { |
69 new_command_line.AppendSwitchNative((*iter).first, (*iter).second); | 69 new_command_line.AppendSwitchNative((*iter).first, (*iter).second); |
70 } | 70 } |
71 | 71 |
72 new_command_line.AppendSwitchPath(switches::kUserDataDir, temp_data_dir); | 72 new_command_line.AppendSwitchPath(switches::kUserDataDir, temp_data_dir); |
73 | 73 |
74 // file:// access for ChromeOS. | 74 // file:// access for ChromeOS. |
75 new_command_line.AppendSwitch(switches::kAllowFileAccess); | 75 new_command_line.AppendSwitch(switches::kAllowFileAccess); |
76 | 76 |
77 *command_line = new_command_line; | 77 *command_line = new_command_line; |
78 return true; | 78 return true; |
79 } | 79 } |
80 | 80 |
81 protected: | 81 protected: |
82 virtual content::ContentMainDelegate* CreateContentMainDelegate() OVERRIDE { | 82 virtual content::ContentMainDelegate* CreateContentMainDelegate() override { |
83 return new ChromeMainDelegate(); | 83 return new ChromeMainDelegate(); |
84 } | 84 } |
85 | 85 |
86 virtual void AdjustDefaultParallelJobs(int* default_jobs) OVERRIDE { | 86 virtual void AdjustDefaultParallelJobs(int* default_jobs) override { |
87 #if defined(OS_WIN) | 87 #if defined(OS_WIN) |
88 if (CommandLine::ForCurrentProcess()->HasSwitch( | 88 if (CommandLine::ForCurrentProcess()->HasSwitch( |
89 switches::kAshBrowserTests)) { | 89 switches::kAshBrowserTests)) { |
90 *default_jobs = 1; | 90 *default_jobs = 1; |
91 fprintf(stdout, | 91 fprintf(stdout, |
92 "Disabling test parallelization for --ash-browsertests.\n"); | 92 "Disabling test parallelization for --ash-browsertests.\n"); |
93 fflush(stdout); | 93 fflush(stdout); |
94 } | 94 } |
95 #endif // defined(OS_WIN) | 95 #endif // defined(OS_WIN) |
96 } | 96 } |
(...skipping 19 matching lines...) Expand all Loading... |
116 // all other code. | 116 // all other code. |
117 chrome::ChromeCrashReporterClient* crash_client = | 117 chrome::ChromeCrashReporterClient* crash_client = |
118 new chrome::ChromeCrashReporterClient(); | 118 new chrome::ChromeCrashReporterClient(); |
119 ANNOTATE_LEAKING_OBJECT_PTR(crash_client); | 119 ANNOTATE_LEAKING_OBJECT_PTR(crash_client); |
120 crash_reporter::SetCrashReporterClient(crash_client); | 120 crash_reporter::SetCrashReporterClient(crash_client); |
121 #endif | 121 #endif |
122 | 122 |
123 ChromeTestLauncherDelegate launcher_delegate(runner); | 123 ChromeTestLauncherDelegate launcher_delegate(runner); |
124 return content::LaunchTests(&launcher_delegate, default_jobs, argc, argv); | 124 return content::LaunchTests(&launcher_delegate, default_jobs, argc, argv); |
125 } | 125 } |
OLD | NEW |