| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/test/test_launcher.h" | 5 #include "base/test/test_launcher.h" |
| 6 | 6 |
| 7 #if defined(OS_POSIX) | 7 #if defined(OS_POSIX) |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 // Adds |result| to the stored test results. | 212 // Adds |result| to the stored test results. |
| 213 void AddTestResult(const TestResult& result); | 213 void AddTestResult(const TestResult& result); |
| 214 | 214 |
| 215 WeakPtr<ResultsPrinter> GetWeakPtr(); | 215 WeakPtr<ResultsPrinter> GetWeakPtr(); |
| 216 | 216 |
| 217 private: | 217 private: |
| 218 // Prints a list of tests that finished with |status|. | 218 // Prints a list of tests that finished with |status|. |
| 219 void PrintTestsByStatus(TestResult::Status status, | 219 void PrintTestsByStatus(TestResult::Status status, |
| 220 const std::string& description); | 220 const std::string& description); |
| 221 | 221 |
| 222 ThreadChecker thread_checker_; |
| 223 |
| 222 // Test results grouped by test case name. | 224 // Test results grouped by test case name. |
| 223 typedef std::map<std::string, std::vector<TestResult> > ResultsMap; | 225 typedef std::map<std::string, std::vector<TestResult> > ResultsMap; |
| 224 ResultsMap results_; | 226 ResultsMap results_; |
| 225 | 227 |
| 226 // List of full names of failed tests. | 228 // List of full names of failed tests. |
| 227 typedef std::map<TestResult::Status, std::vector<std::string> > StatusMap; | 229 typedef std::map<TestResult::Status, std::vector<std::string> > StatusMap; |
| 228 StatusMap tests_by_status_; | 230 StatusMap tests_by_status_; |
| 229 | 231 |
| 230 size_t test_started_count_; | 232 size_t test_started_count_; |
| 231 | 233 |
| 232 // Total number of tests run. | 234 // Total number of tests run. |
| 233 size_t test_run_count_; | 235 size_t test_run_count_; |
| 234 | 236 |
| 235 // File handle of output file (can be NULL if no file). | 237 // File handle of output file (can be NULL if no file). |
| 236 FILE* out_; | 238 FILE* out_; |
| 237 | 239 |
| 238 RunTestsCallback callback_; | 240 RunTestsCallback callback_; |
| 239 | 241 |
| 240 ThreadChecker thread_checker_; | |
| 241 | |
| 242 WeakPtrFactory<ResultsPrinter> weak_ptr_; | 242 WeakPtrFactory<ResultsPrinter> weak_ptr_; |
| 243 | 243 |
| 244 DISALLOW_COPY_AND_ASSIGN(ResultsPrinter); | 244 DISALLOW_COPY_AND_ASSIGN(ResultsPrinter); |
| 245 }; | 245 }; |
| 246 | 246 |
| 247 ResultsPrinter::ResultsPrinter(const CommandLine& command_line, | 247 ResultsPrinter::ResultsPrinter(const CommandLine& command_line, |
| 248 const RunTestsCallback& callback) | 248 const RunTestsCallback& callback) |
| 249 : test_started_count_(0), | 249 : test_started_count_(0), |
| 250 test_run_count_(0), | 250 test_run_count_(0), |
| 251 out_(NULL), | 251 out_(NULL), |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 cycles, | 778 cycles, |
| 779 &exit_code, | 779 &exit_code, |
| 780 true)); | 780 true)); |
| 781 | 781 |
| 782 MessageLoop::current()->Run(); | 782 MessageLoop::current()->Run(); |
| 783 | 783 |
| 784 return exit_code; | 784 return exit_code; |
| 785 } | 785 } |
| 786 | 786 |
| 787 } // namespace base | 787 } // namespace base |
| OLD | NEW |