1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_TEST_EXPECTATIONS_EXPECTATION_H_
#define BASE_TEST_EXPECTATIONS_EXPECTATION_H_
#include <string>
#include <vector>
#include "base/base_export.h"
#include "base/compiler_specific.h"
#include "base/string_piece.h"
namespace test_expectations {
// A Result is the expectation of a test's behavior.
enum Result {
// The test has a failing assertion.
RESULT_FAILURE,
// The test does not complete within the test runner's alloted duration.
RESULT_TIMEOUT,
// The test crashes during the course of its execution.
RESULT_CRASH,
// The test should not be run ever.
RESULT_SKIP,
// The test passes, used to override a more general expectation.
RESULT_PASS,
};
// Converts a text string form of a |result| to its enum value, written to
// |out_result|. Returns true on success and false on error.
bool ResultFromString(const base::StringPiece& result,
Result* out_result) WARN_UNUSED_RESULT;
// A Platform stores information about the OS environment.
struct Platform {
// The name of the platform. E.g., "Win", or "Mac".
std::string name;
// The variant of the platform, either an OS version like "XP" or "10.8", or
// "Device" or "Simulator" in the case of mobile.
std::string variant;
};
// Converts a text string |modifier| to a Platform struct, written to
// |out_platform|. Returns true on success and false on failure.
bool PlatformFromString(const base::StringPiece& modifier,
Platform* out_platform) WARN_UNUSED_RESULT;
// Returns the Platform for the currently running binary.
Platform GetCurrentPlatform();
// The build configuration.
enum Configuration {
CONFIGURATION_UNSPECIFIED,
CONFIGURATION_DEBUG,
CONFIGURATION_RELEASE,
};
// Converts the |modifier| to a Configuration constant, writing the value to
// |out_configuration|. Returns true on success or false on failure.
bool ConfigurationFromString(const base::StringPiece& modifier,
Configuration* out_configuration) WARN_UNUSED_RESULT;
// Returns the Configuration for the currently running binary.
Configuration GetCurrentConfiguration();
// An Expectation is records what the result for a given test name should be on
// the specified platforms and configuration.
struct Expectation {
Expectation();
~Expectation();
// The name of the test, like FooBarTest.BarIsBaz.
std::string test_name;
// The set of platforms for which this expectation is applicable.
std::vector<Platform> platforms;
// The build configuration.
Configuration configuration;
// The expected result of this test.
Result result;
};
} // namespace test_expectations
#endif // BASE_TEST_EXPECTATIONS_EXPECTATION_H_
|