Added localized string for "Manage" button.
[chromium-blink-merge.git] / gpu / config / gpu_test_config.h
blob635a97775bcbfc788a8667655005f6d775dec382
1 // Copyright (c) 2012 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 GPU_CONFIG_GPU_TEST_CONFIG_H_
6 #define GPU_CONFIG_GPU_TEST_CONFIG_H_
8 #include <string>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "gpu/gpu_export.h"
15 namespace gpu {
17 struct GPUInfo;
19 class GPU_EXPORT GPUTestConfig {
20 public:
21 enum OS {
22 kOsUnknown = 0,
23 kOsWinXP = 1 << 0,
24 kOsWinVista = 1 << 1,
25 kOsWin7 = 1 << 2,
26 kOsWin8 = 1 << 3,
27 kOsWin = kOsWinXP | kOsWinVista | kOsWin7 | kOsWin8,
28 kOsMacLeopard = 1 << 4,
29 kOsMacSnowLeopard = 1 << 5,
30 kOsMacLion = 1 << 6,
31 kOsMacMountainLion = 1 << 7,
32 kOsMacMavericks = 1 << 8,
33 kOsMac = kOsMacLeopard | kOsMacSnowLeopard | kOsMacLion |
34 kOsMacMountainLion | kOsMacMavericks,
35 kOsLinux = 1 << 9,
36 kOsChromeOS = 1 << 10,
37 kOsAndroid = 1 << 11,
40 enum BuildType {
41 kBuildTypeUnknown = 0,
42 kBuildTypeRelease = 1 << 0,
43 kBuildTypeDebug = 1 << 1,
46 GPUTestConfig();
47 virtual ~GPUTestConfig();
49 void set_os(int32 os);
50 void set_gpu_device_id(uint32 id);
51 void set_build_type(int32 build_type);
53 virtual void AddGPUVendor(uint32 gpu_vendor);
55 int32 os() const { return os_; }
56 const std::vector<uint32>& gpu_vendor() const { return gpu_vendor_; }
57 uint32 gpu_device_id() const { return gpu_device_id_; }
58 int32 build_type() const { return build_type_; }
60 // Check if the config is valid. For example, if gpu_device_id_ is set, but
61 // gpu_vendor_ is unknown, then it's invalid.
62 virtual bool IsValid() const;
64 // Check if two configs overlap, i.e., if there exists a config that matches
65 // both configs.
66 bool OverlapsWith(const GPUTestConfig& config) const;
68 // Disable validation of GPU vendor and device ids.
69 void DisableGPUInfoValidation();
71 protected:
72 void ClearGPUVendor();
74 // Indicates that the OS has the notion of a numeric GPU vendor and device id
75 // and this data should be validated.
76 bool validate_gpu_info_;
78 private:
79 // operating system.
80 int32 os_;
82 // GPU vendor.
83 std::vector<uint32> gpu_vendor_;
85 // GPU device id (unique to each vendor).
86 uint32 gpu_device_id_;
88 // Release or Debug.
89 int32 build_type_;
92 class GPU_EXPORT GPUTestBotConfig : public GPUTestConfig {
93 public:
94 GPUTestBotConfig() { }
95 virtual ~GPUTestBotConfig();
97 // This should only be called when no gpu_vendor is added.
98 virtual void AddGPUVendor(uint32 gpu_vendor) OVERRIDE;
100 // Return false if gpu_info does not have valid vendor_id and device_id.
101 bool SetGPUInfo(const GPUInfo& gpu_info);
103 // Check if the bot config is valid, i.e., if it is one valid test-bot
104 // environment. For example, if a field is unknown, or if OS is not one
105 // fully defined OS, then it's valid.
106 virtual bool IsValid() const OVERRIDE;
108 // Check if a bot config matches a test config, i.e., the test config is a
109 // superset of the bot config.
110 bool Matches(const GPUTestConfig& config) const;
111 bool Matches(const std::string& config_data) const;
113 // Setup the config with the current gpu testing environment.
114 // If gpu_info is NULL, collect GPUInfo first.
115 bool LoadCurrentConfig(const GPUInfo* gpu_info);
117 // Check if this bot's config matches |config_data| or any of the |configs|.
118 static bool CurrentConfigMatches(const std::string& config_data);
119 static bool CurrentConfigMatches(const std::vector<std::string>& configs);
121 // Check if the bot has blacklisted all GPU features.
122 static bool GpuBlacklistedOnBot();
125 } // namespace gpu
127 #endif // GPU_CONFIG_GPU_TEST_CONFIG_H_