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/launcher/test_result.h" | 5 #include "base/test/launcher/test_result.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace base { | 9 namespace base { |
10 | 10 |
11 TestResult::TestResult() : status(TEST_UNKNOWN) { | 11 TestResult::TestResult() : status(TEST_UNKNOWN) { |
12 } | 12 } |
13 | 13 |
14 TestResult::~TestResult() { | 14 TestResult::~TestResult() { |
15 } | 15 } |
16 | 16 |
17 std::string TestResult::StatusAsString() const { | 17 std::string TestResult::StatusAsString() const { |
18 switch (status) { | 18 switch (status) { |
19 case TEST_UNKNOWN: | 19 case TEST_UNKNOWN: |
20 return "UNKNOWN"; | 20 return "UNKNOWN"; |
21 case TEST_SUCCESS: | 21 case TEST_SUCCESS: |
22 return "SUCCESS"; | 22 return "SUCCESS"; |
23 case TEST_FAILURE: | 23 case TEST_FAILURE: |
24 return "FAILURE"; | 24 return "FAILURE"; |
| 25 case TEST_FAILURE_ON_EXIT: |
| 26 return "FAILURE_ON_EXIT"; |
25 case TEST_CRASH: | 27 case TEST_CRASH: |
26 return "CRASH"; | 28 return "CRASH"; |
27 case TEST_TIMEOUT: | 29 case TEST_TIMEOUT: |
28 return "TIMEOUT"; | 30 return "TIMEOUT"; |
29 case TEST_SKIPPED: | 31 case TEST_SKIPPED: |
30 return "SKIPPED"; | 32 return "SKIPPED"; |
31 // Rely on compiler warnings to ensure all possible values are handled. | 33 // Rely on compiler warnings to ensure all possible values are handled. |
32 } | 34 } |
33 | 35 |
34 NOTREACHED(); | 36 NOTREACHED(); |
35 return std::string(); | 37 return std::string(); |
36 } | 38 } |
37 | 39 |
38 std::string TestResult::GetTestName() const { | 40 std::string TestResult::GetTestName() const { |
39 size_t dot_pos = full_name.find('.'); | 41 size_t dot_pos = full_name.find('.'); |
40 CHECK_NE(dot_pos, std::string::npos); | 42 CHECK_NE(dot_pos, std::string::npos); |
41 return full_name.substr(dot_pos + 1); | 43 return full_name.substr(dot_pos + 1); |
42 } | 44 } |
43 | 45 |
44 std::string TestResult::GetTestCaseName() const { | 46 std::string TestResult::GetTestCaseName() const { |
45 size_t dot_pos = full_name.find('.'); | 47 size_t dot_pos = full_name.find('.'); |
46 CHECK_NE(dot_pos, std::string::npos); | 48 CHECK_NE(dot_pos, std::string::npos); |
47 return full_name.substr(0, dot_pos); | 49 return full_name.substr(0, dot_pos); |
48 } | 50 } |
49 | 51 |
50 } // namespace base | 52 } // namespace base |
OLD | NEW |