Roll src/third_party/skia 41f88f0:1d24b8d
[chromium-blink-merge.git] / base / test / expectations / expectation.h
blobbe5a9d7ff1836eb5dc2ad65fd58c8c2c74b9d327
1 // Copyright (c) 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.
5 #ifndef BASE_TEST_EXPECTATIONS_EXPECTATION_H_
6 #define BASE_TEST_EXPECTATIONS_EXPECTATION_H_
8 #include <string>
9 #include <vector>
11 #include "base/base_export.h"
12 #include "base/compiler_specific.h"
13 #include "base/strings/string_piece.h"
15 namespace test_expectations {
17 // A Result is the expectation of a test's behavior.
18 enum Result {
19 // The test has a failing assertion.
20 RESULT_FAILURE,
22 // The test does not complete within the test runner's alloted duration.
23 RESULT_TIMEOUT,
25 // The test crashes during the course of its execution.
26 RESULT_CRASH,
28 // The test should not be run ever.
29 RESULT_SKIP,
31 // The test passes, used to override a more general expectation.
32 RESULT_PASS,
35 // Converts a text string form of a |result| to its enum value, written to
36 // |out_result|. Returns true on success and false on error.
37 bool ResultFromString(const base::StringPiece& result,
38 Result* out_result) WARN_UNUSED_RESULT;
40 // A Platform stores information about the OS environment.
41 struct Platform {
42 // The name of the platform. E.g., "Win", or "Mac".
43 std::string name;
45 // The variant of the platform, either an OS version like "XP" or "10.8", or
46 // "Device" or "Simulator" in the case of mobile.
47 std::string variant;
50 // Converts a text string |modifier| to a Platform struct, written to
51 // |out_platform|. Returns true on success and false on failure.
52 bool PlatformFromString(const base::StringPiece& modifier,
53 Platform* out_platform) WARN_UNUSED_RESULT;
55 // Returns the Platform for the currently running binary.
56 Platform GetCurrentPlatform();
58 // The build configuration.
59 enum Configuration {
60 CONFIGURATION_UNSPECIFIED,
61 CONFIGURATION_DEBUG,
62 CONFIGURATION_RELEASE,
65 // Converts the |modifier| to a Configuration constant, writing the value to
66 // |out_configuration|. Returns true on success or false on failure.
67 bool ConfigurationFromString(const base::StringPiece& modifier,
68 Configuration* out_configuration) WARN_UNUSED_RESULT;
70 // Returns the Configuration for the currently running binary.
71 Configuration GetCurrentConfiguration();
73 // An Expectation is records what the result for a given test name should be on
74 // the specified platforms and configuration.
75 struct Expectation {
76 Expectation();
77 ~Expectation();
79 // The name of the test, like FooBarTest.BarIsBaz.
80 std::string test_name;
82 // The set of platforms for which this expectation is applicable.
83 std::vector<Platform> platforms;
85 // The build configuration.
86 Configuration configuration;
88 // The expected result of this test.
89 Result result;
92 } // namespace test_expectations
94 #endif // BASE_TEST_EXPECTATIONS_EXPECTATION_H_