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 #ifndef BASE_TEST_LAUNCHER_TEST_RESULT_H_ | 5 #ifndef BASE_TEST_LAUNCHER_TEST_RESULT_H_ |
6 #define BASE_TEST_LAUNCHER_TEST_RESULT_H_ | 6 #define BASE_TEST_LAUNCHER_TEST_RESULT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 | 11 |
12 namespace base { | 12 namespace base { |
13 | 13 |
14 // Structure containing result of a single test. | 14 // Structure containing result of a single test. |
15 struct TestResult { | 15 struct TestResult { |
16 enum Status { | 16 enum Status { |
17 TEST_UNKNOWN, // Status not set. | 17 TEST_UNKNOWN, // Status not set. |
18 TEST_SUCCESS, // Test passed. | 18 TEST_SUCCESS, // Test passed. |
19 TEST_FAILURE, // Assertion failure (think EXPECT_TRUE, not DCHECK). | 19 TEST_FAILURE, // Assertion failure (think EXPECT_TRUE, not DCHECK). |
20 TEST_TIMEOUT, // Test timed out and was killed. | 20 TEST_FAILURE_ON_EXIT, // Test passed but executable exit code was non-zero. |
21 TEST_CRASH, // Test crashed (includes CHECK/DCHECK failures). | 21 TEST_TIMEOUT, // Test timed out and was killed. |
22 TEST_SKIPPED, // Test skipped (not run at all). | 22 TEST_CRASH, // Test crashed (includes CHECK/DCHECK failures). |
| 23 TEST_SKIPPED, // Test skipped (not run at all). |
23 }; | 24 }; |
24 | 25 |
25 TestResult(); | 26 TestResult(); |
26 ~TestResult(); | 27 ~TestResult(); |
27 | 28 |
28 // Returns the test status as string (e.g. for display). | 29 // Returns the test status as string (e.g. for display). |
29 std::string StatusAsString() const; | 30 std::string StatusAsString() const; |
30 | 31 |
31 // Returns the test name (e.g. "B" for "A.B"). | 32 // Returns the test name (e.g. "B" for "A.B"). |
32 std::string GetTestName() const; | 33 std::string GetTestName() const; |
33 | 34 |
34 // Returns the test case name (e.g. "A" for "A.B"). | 35 // Returns the test case name (e.g. "A" for "A.B"). |
35 std::string GetTestCaseName() const; | 36 std::string GetTestCaseName() const; |
36 | 37 |
37 // Returns true if the test has completed (i.e. the test binary exited | 38 // Returns true if the test has completed (i.e. the test binary exited |
38 // normally, possibly with an exit code indicating failure, but didn't crash | 39 // normally, possibly with an exit code indicating failure, but didn't crash |
39 // or time out in the middle of the test). | 40 // or time out in the middle of the test). |
40 bool completed() const { | 41 bool completed() const { |
41 return status == TEST_SUCCESS || status == TEST_FAILURE; | 42 return status == TEST_SUCCESS || |
| 43 status == TEST_FAILURE || |
| 44 status == TEST_FAILURE_ON_EXIT; |
42 } | 45 } |
43 | 46 |
44 // Full name of the test (e.g. "A.B"). | 47 // Full name of the test (e.g. "A.B"). |
45 std::string full_name; | 48 std::string full_name; |
46 | 49 |
47 Status status; | 50 Status status; |
48 | 51 |
49 // Time it took to run the test. | 52 // Time it took to run the test. |
50 base::TimeDelta elapsed_time; | 53 base::TimeDelta elapsed_time; |
51 | 54 |
52 // Output of just this test (optional). | 55 // Output of just this test (optional). |
53 std::string output_snippet; | 56 std::string output_snippet; |
54 }; | 57 }; |
55 | 58 |
56 } // namespace base | 59 } // namespace base |
57 | 60 |
58 #endif // BASE_TEST_LAUNCHER_TEST_RESULT_H_ | 61 #endif // BASE_TEST_LAUNCHER_TEST_RESULT_H_ |
OLD | NEW |