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 "content/public/test/test_launcher.h" | 5 #include "content/public/test/test_launcher.h" |
6 | 6 |
7 #include <stack> | 7 #include <stack> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/leak_annotations.h" | 10 #include "base/debug/leak_annotations.h" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/linked_ptr.h" | 14 #include "base/memory/linked_ptr.h" |
15 #include "base/process/process_metrics.h" | 15 #include "base/process/process_metrics.h" |
16 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
18 #include "base/test/test_file_util.h" | 18 #include "base/test/test_file_util.h" |
19 #include "chrome/app/chrome_main_delegate.h" | 19 #include "chrome/app/chrome_main_delegate.h" |
20 #include "chrome/common/chrome_constants.h" | 20 #include "chrome/common/chrome_constants.h" |
21 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
22 #include "chrome/test/base/chrome_test_suite.h" | 22 #include "chrome/test/base/chrome_test_suite.h" |
| 23 #include "chrome/test/base/test_switches.h" |
23 #include "content/public/app/content_main.h" | 24 #include "content/public/app/content_main.h" |
24 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
25 #include "content/public/test/test_utils.h" | 26 #include "content/public/test/test_utils.h" |
26 #include "ui/base/test/ui_controls.h" | 27 #include "ui/base/test/ui_controls.h" |
27 | 28 |
28 #if defined(OS_MACOSX) | 29 #if defined(OS_MACOSX) |
29 #include "chrome/browser/chrome_browser_application_mac.h" | 30 #include "chrome/browser/chrome_browser_application_mac.h" |
30 #endif // defined(OS_MACOSX) | 31 #endif // defined(OS_MACOSX) |
31 | 32 |
32 #if defined(OS_WIN) | 33 #if defined(OS_WIN) |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 #if defined(OS_WIN) || defined (OS_LINUX) | 113 #if defined(OS_WIN) || defined (OS_LINUX) |
113 return new ChromeMainDelegate(); | 114 return new ChromeMainDelegate(); |
114 #else | 115 #else |
115 // This delegate is only guaranteed to link on linux and windows, so just | 116 // This delegate is only guaranteed to link on linux and windows, so just |
116 // bail out if we are on any other platform. | 117 // bail out if we are on any other platform. |
117 NOTREACHED(); | 118 NOTREACHED(); |
118 return NULL; | 119 return NULL; |
119 #endif | 120 #endif |
120 } | 121 } |
121 | 122 |
| 123 virtual void AdjustDefaultParallelJobs(int* default_jobs) OVERRIDE { |
| 124 #if defined(OS_WIN) && defined(USE_AURA) |
| 125 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 126 switches::kAshBrowserTests)) { |
| 127 *default_jobs = 1; |
| 128 fprintf(stdout, |
| 129 "Disabling test parallelization for --ash-browsertests.\n"); |
| 130 fflush(stdout); |
| 131 } |
| 132 #endif // defined(OS_WIN) && defined(USE_AURA) |
| 133 } |
| 134 |
122 private: | 135 private: |
123 #if !defined(USE_AURA) && defined(TOOLKIT_VIEWS) | 136 #if !defined(USE_AURA) && defined(TOOLKIT_VIEWS) |
124 std::stack<linked_ptr<views::AcceleratorHandler> > handlers_; | 137 std::stack<linked_ptr<views::AcceleratorHandler> > handlers_; |
125 #endif | 138 #endif |
126 | 139 |
127 DISALLOW_COPY_AND_ASSIGN(ChromeTestLauncherDelegate); | 140 DISALLOW_COPY_AND_ASSIGN(ChromeTestLauncherDelegate); |
128 }; | 141 }; |
129 | 142 |
130 } // namespace | 143 } // namespace |
131 | 144 |
132 int LaunchChromeTests(int default_jobs, int argc, char** argv) { | 145 int LaunchChromeTests(int default_jobs, int argc, char** argv) { |
133 #if defined(OS_MACOSX) | 146 #if defined(OS_MACOSX) |
134 chrome_browser_application_mac::RegisterBrowserCrApp(); | 147 chrome_browser_application_mac::RegisterBrowserCrApp(); |
135 #endif | 148 #endif |
136 | 149 |
137 #if defined(OS_LINUX) || defined(OS_ANDROID) | 150 #if defined(OS_LINUX) || defined(OS_ANDROID) |
138 // We leak this pointer intentionally. The breakpad client needs to outlive | 151 // We leak this pointer intentionally. The breakpad client needs to outlive |
139 // all other code. | 152 // all other code. |
140 chrome::ChromeBreakpadClient* breakpad_client = | 153 chrome::ChromeBreakpadClient* breakpad_client = |
141 new chrome::ChromeBreakpadClient(); | 154 new chrome::ChromeBreakpadClient(); |
142 ANNOTATE_LEAKING_OBJECT_PTR(breakpad_client); | 155 ANNOTATE_LEAKING_OBJECT_PTR(breakpad_client); |
143 breakpad::SetBreakpadClient(breakpad_client); | 156 breakpad::SetBreakpadClient(breakpad_client); |
144 #endif | 157 #endif |
145 | 158 |
146 ChromeTestLauncherDelegate launcher_delegate; | 159 ChromeTestLauncherDelegate launcher_delegate; |
147 return content::LaunchTests(&launcher_delegate, default_jobs, argc, argv); | 160 return content::LaunchTests(&launcher_delegate, default_jobs, argc, argv); |
148 } | 161 } |
OLD | NEW |