Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | List of all members
CtsEnforcement Class Reference

#include <CtsEnforcement.h>

Public Types

enum  ApiLevel : int32_t {
  kNever = INT32_MAX , kApiLevel_T = 33 , kApiLevel_U = 34 , kApiLevel_V = 35 ,
  kNextRelease = kApiLevel_V
}
 
enum class  RunMode { kSkip = 0 , kRunWithWorkarounds = 1 , kRunStrict = 2 }
 

Public Member Functions

constexpr CtsEnforcement (ApiLevel strictVersion)
 
constexpr CtsEnforcementwithWorkarounds (ApiLevel workaroundVersion)
 
RunMode eval (int apiLevel) const
 

Detailed Description

Determines how unit tests are enforced by CTS. Depending on the ApiLevel, a test will be run in one of 3 states: run without workarounds, run with workarounds or skipped.

Definition at line 20 of file CtsEnforcement.h.

Member Enumeration Documentation

◆ ApiLevel

enum CtsEnforcement::ApiLevel : int32_t
Enumerator
kNever 
kApiLevel_T 
kApiLevel_U 
kApiLevel_V 
kNextRelease 

Definition at line 22 of file CtsEnforcement.h.

22 : int32_t {
23 /* When used as fStrictVersion, always skip this test. It is not relevant to CTS.
24 * When used as fWorkaroundsVersion, there are no api levels that should run the
25 * test with workarounds.
26 */
27 kNever = INT32_MAX,
28 /* The kApiLevel_* values are directly correlated with Android API levels. Every new
29 * CTS/SkQP release has a corresponding Android API level that will be captured by these
30 * enum values.
31 */
32 kApiLevel_T = 33,
33 kApiLevel_U = 34,
34 kApiLevel_V = 35,
35 /* kNextRelease is a placeholder value that all new unit tests should use. It implies that
36 * this test will be enforced in the next Android release. At the time of the release a
37 * new kApiLevel_* value will be added and all current kNextRelease values will be replaced
38 * with that new value.
39 */
41 };

◆ RunMode

enum class CtsEnforcement::RunMode
strong
Enumerator
kSkip 
kRunWithWorkarounds 
kRunStrict 

Definition at line 59 of file CtsEnforcement.h.

59{ kSkip = 0, kRunWithWorkarounds = 1, kRunStrict = 2 };

Constructor & Destructor Documentation

◆ CtsEnforcement()

constexpr CtsEnforcement::CtsEnforcement ( ApiLevel  strictVersion)
inlineconstexpr

Tests will run in strict (no workarounds) mode if the device API level is >= strictVersion

Definition at line 46 of file CtsEnforcement.h.

47 : fStrictVersion(strictVersion), fWorkaroundsVersion(kNever) {}

Member Function Documentation

◆ eval()

CtsEnforcement::RunMode CtsEnforcement::eval ( int  apiLevel) const

Definition at line 10 of file CtsEnforcement.cpp.

10 {
11 if (apiLevel >= fStrictVersion) {
13 } else if (apiLevel >= fWorkaroundsVersion) {
15 }
16 return RunMode::kSkip;
17}

◆ withWorkarounds()

constexpr CtsEnforcement & CtsEnforcement::withWorkarounds ( ApiLevel  workaroundVersion)
inlineconstexpr

Test will run with workarounds if the device API level is >= workaroundVersion and < strictVersion

Definition at line 53 of file CtsEnforcement.h.

53 {
54 SkASSERT(workaroundVersion <= fStrictVersion);
55 fWorkaroundsVersion = workaroundVersion;
56 return *this;
57 }
#define SkASSERT(cond)
Definition: SkAssert.h:116

The documentation for this class was generated from the following files: