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