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 <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 } | 215 } |
216 | 216 |
217 for (size_t i = 0; i < test_names.size(); i++) { | 217 for (size_t i = 0; i < test_names.size(); i++) { |
218 std::string full_name(test_names[i]); | 218 std::string full_name(test_names[i]); |
219 | 219 |
220 // Make sure no PRE_ tests were requested explicitly. | 220 // Make sure no PRE_ tests were requested explicitly. |
221 DCHECK_EQ(full_name, RemoveAnyPrePrefixes(full_name)); | 221 DCHECK_EQ(full_name, RemoveAnyPrePrefixes(full_name)); |
222 | 222 |
223 if (!ContainsKey(user_data_dir_map_, full_name)) { | 223 if (!ContainsKey(user_data_dir_map_, full_name)) { |
224 base::FilePath temp_dir; | 224 base::FilePath temp_dir; |
225 CHECK(file_util::CreateTemporaryDirInDir( | 225 CHECK(base::CreateTemporaryDirInDir(temp_dir_.path(), |
226 temp_dir_.path(), FILE_PATH_LITERAL("d"), &temp_dir)); | 226 FILE_PATH_LITERAL("d"), &temp_dir)); |
227 user_data_dir_map_[full_name] = temp_dir; | 227 user_data_dir_map_[full_name] = temp_dir; |
228 } | 228 } |
229 | 229 |
230 // If the test has any dependencies, get to the root and start with that. | 230 // If the test has any dependencies, get to the root and start with that. |
231 while (ContainsKey(reverse_dependent_test_map_, full_name)) | 231 while (ContainsKey(reverse_dependent_test_map_, full_name)) |
232 full_name = GetPreTestName(full_name); | 232 full_name = GetPreTestName(full_name); |
233 | 233 |
234 DoRunTest(test_launcher, full_name); | 234 DoRunTest(test_launcher, full_name); |
235 } | 235 } |
236 | 236 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 for (std::set<std::string>::const_iterator i = test_names_set.begin(); | 271 for (std::set<std::string>::const_iterator i = test_names_set.begin(); |
272 i != test_names_set.end(); | 272 i != test_names_set.end(); |
273 ++i) { | 273 ++i) { |
274 std::string full_name(*i); | 274 std::string full_name(*i); |
275 | 275 |
276 // Make sure PRE_ tests and tests that depend on them share the same | 276 // Make sure PRE_ tests and tests that depend on them share the same |
277 // data directory - based it on the test name without prefixes. | 277 // data directory - based it on the test name without prefixes. |
278 std::string test_name_no_pre(RemoveAnyPrePrefixes(full_name)); | 278 std::string test_name_no_pre(RemoveAnyPrePrefixes(full_name)); |
279 if (!ContainsKey(user_data_dir_map_, test_name_no_pre)) { | 279 if (!ContainsKey(user_data_dir_map_, test_name_no_pre)) { |
280 base::FilePath temp_dir; | 280 base::FilePath temp_dir; |
281 CHECK(file_util::CreateTemporaryDirInDir( | 281 CHECK(base::CreateTemporaryDirInDir(temp_dir_.path(), |
282 temp_dir_.path(), FILE_PATH_LITERAL("d"), &temp_dir)); | 282 FILE_PATH_LITERAL("d"), &temp_dir)); |
283 user_data_dir_map_[test_name_no_pre] = temp_dir; | 283 user_data_dir_map_[test_name_no_pre] = temp_dir; |
284 } | 284 } |
285 | 285 |
286 size_t dot_pos = full_name.find('.'); | 286 size_t dot_pos = full_name.find('.'); |
287 CHECK_NE(dot_pos, std::string::npos); | 287 CHECK_NE(dot_pos, std::string::npos); |
288 std::string test_case_name = full_name.substr(0, dot_pos); | 288 std::string test_case_name = full_name.substr(0, dot_pos); |
289 std::string test_name = full_name.substr(dot_pos + 1); | 289 std::string test_name = full_name.substr(dot_pos + 1); |
290 std::string pre_test_name( | 290 std::string pre_test_name( |
291 test_case_name + "." + kPreTestPrefix + test_name); | 291 test_case_name + "." + kPreTestPrefix + test_name); |
292 if (!ContainsKey(test_names_set, pre_test_name)) | 292 if (!ContainsKey(test_names_set, pre_test_name)) |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 base::TestLauncher launcher(&delegate, default_jobs); | 495 base::TestLauncher launcher(&delegate, default_jobs); |
496 bool success = launcher.Run(argc, argv); | 496 bool success = launcher.Run(argc, argv); |
497 return (success ? 0 : 1); | 497 return (success ? 0 : 1); |
498 } | 498 } |
499 | 499 |
500 TestLauncherDelegate* GetCurrentTestLauncherDelegate() { | 500 TestLauncherDelegate* GetCurrentTestLauncherDelegate() { |
501 return g_launcher_delegate; | 501 return g_launcher_delegate; |
502 } | 502 } |
503 | 503 |
504 } // namespace content | 504 } // namespace content |
OLD | NEW |