- add sources.
[platform/framework/web/crosswalk.git] / src / base / test / launcher / test_result.h
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
3 // found in the LICENSE file.
4
5 #ifndef BASE_TEST_LAUNCHER_TEST_RESULT_H_
6 #define BASE_TEST_LAUNCHER_TEST_RESULT_H_
7
8 #include <string>
9
10 #include "base/time/time.h"
11
12 namespace base {
13
14 // Structure containing result of a single test.
15 struct TestResult {
16   enum Status {
17     TEST_UNKNOWN,  // Status not set.
18     TEST_SUCCESS,  // Test passed.
19     TEST_FAILURE,  // Assertion failure (think EXPECT_TRUE, not DCHECK).
20     TEST_TIMEOUT,  // Test timed out and was killed.
21     TEST_CRASH,    // Test crashed (includes CHECK/DCHECK failures).
22     TEST_SKIPPED,  // Test skipped (not run at all).
23   };
24
25   TestResult();
26   ~TestResult();
27
28   // Returns the test status as string (e.g. for display).
29   std::string StatusAsString() const;
30
31   // Returns the test name (e.g. "B" for "A.B").
32   std::string GetTestName() const;
33
34   // Returns the test case name (e.g. "A" for "A.B").
35   std::string GetTestCaseName() const;
36
37   // 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   // or time out in the middle of the test).
40   bool completed() const {
41     return status == TEST_SUCCESS || status == TEST_FAILURE;
42   }
43
44   // Full name of the test (e.g. "A.B").
45   std::string full_name;
46
47   Status status;
48
49   // Time it took to run the test.
50   base::TimeDelta elapsed_time;
51
52   // Output of just this test (optional).
53   std::string output_snippet;
54 };
55
56 }  // namespace base
57
58 #endif  // BASE_TEST_LAUNCHER_TEST_RESULT_H_