Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: content/test/gpu/gpu_test_config.cc

Issue 15745014: Move GPU device/driver info related code from content to gpu. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: rebase Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/test/gpu/gpu_test_config.h ('k') | content/test/gpu/gpu_test_config_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/test/gpu/gpu_test_config.h" 5 #include "content/test/gpu/gpu_test_config.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/sys_info.h" 8 #include "base/sys_info.h"
9 #include "content/gpu/gpu_info_collector.h"
10 #include "content/public/common/gpu_info.h"
11 #include "content/test/gpu/gpu_test_expectations_parser.h" 9 #include "content/test/gpu/gpu_test_expectations_parser.h"
10 #include "gpu/config/gpu_info.h"
11 #include "gpu/config/gpu_info_collector.h"
12 12
13 namespace { 13 namespace {
14 14
15 GPUTestConfig::OS GetCurrentOS() { 15 GPUTestConfig::OS GetCurrentOS() {
16 #if defined(OS_CHROMEOS) 16 #if defined(OS_CHROMEOS)
17 return GPUTestConfig::kOsChromeOS; 17 return GPUTestConfig::kOsChromeOS;
18 #elif defined(OS_LINUX) || defined(OS_OPENBSD) 18 #elif defined(OS_LINUX) || defined(OS_OPENBSD)
19 return GPUTestConfig::kOsLinux; 19 return GPUTestConfig::kOsLinux;
20 #elif defined(OS_WIN) 20 #elif defined(OS_WIN)
21 int32 major_version = 0; 21 int32 major_version = 0;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 134 }
135 135
136 GPUTestBotConfig::~GPUTestBotConfig() { 136 GPUTestBotConfig::~GPUTestBotConfig() {
137 } 137 }
138 138
139 void GPUTestBotConfig::AddGPUVendor(uint32 gpu_vendor) { 139 void GPUTestBotConfig::AddGPUVendor(uint32 gpu_vendor) {
140 DCHECK_EQ(0u, GPUTestConfig::gpu_vendor().size()); 140 DCHECK_EQ(0u, GPUTestConfig::gpu_vendor().size());
141 GPUTestConfig::AddGPUVendor(gpu_vendor); 141 GPUTestConfig::AddGPUVendor(gpu_vendor);
142 } 142 }
143 143
144 bool GPUTestBotConfig::SetGPUInfo(const content::GPUInfo& gpu_info) { 144 bool GPUTestBotConfig::SetGPUInfo(const gpu::GPUInfo& gpu_info) {
145 DCHECK(validate_gpu_info_); 145 DCHECK(validate_gpu_info_);
146 if (gpu_info.gpu.device_id == 0 || gpu_info.gpu.vendor_id == 0) 146 if (gpu_info.gpu.device_id == 0 || gpu_info.gpu.vendor_id == 0)
147 return false; 147 return false;
148 ClearGPUVendor(); 148 ClearGPUVendor();
149 AddGPUVendor(gpu_info.gpu.vendor_id); 149 AddGPUVendor(gpu_info.gpu.vendor_id);
150 set_gpu_device_id(gpu_info.gpu.device_id); 150 set_gpu_device_id(gpu_info.gpu.device_id);
151 return true; 151 return true;
152 } 152 }
153 153
154 bool GPUTestBotConfig::IsValid() const { 154 bool GPUTestBotConfig::IsValid() const {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 211
212 bool GPUTestBotConfig::Matches(const std::string& config_data) const { 212 bool GPUTestBotConfig::Matches(const std::string& config_data) const {
213 GPUTestExpectationsParser parser; 213 GPUTestExpectationsParser parser;
214 GPUTestConfig config; 214 GPUTestConfig config;
215 215
216 if (!parser.ParseConfig(config_data, &config)) 216 if (!parser.ParseConfig(config_data, &config))
217 return false; 217 return false;
218 return Matches(config); 218 return Matches(config);
219 } 219 }
220 220
221 bool GPUTestBotConfig::LoadCurrentConfig(const content::GPUInfo* gpu_info) { 221 bool GPUTestBotConfig::LoadCurrentConfig(const gpu::GPUInfo* gpu_info) {
222 bool rt; 222 bool rt;
223 if (gpu_info == NULL) { 223 if (gpu_info == NULL) {
224 content::GPUInfo my_gpu_info; 224 gpu::GPUInfo my_gpu_info;
225 gpu_info_collector::GpuIDResult result; 225 gpu::GpuIDResult result;
226 result = gpu_info_collector::CollectGpuID(&my_gpu_info.gpu.vendor_id, 226 result = gpu::CollectGpuID(&my_gpu_info.gpu.vendor_id,
227 &my_gpu_info.gpu.device_id); 227 &my_gpu_info.gpu.device_id);
228 if (result == gpu_info_collector::kGpuIDNotSupported) { 228 if (result == gpu::kGpuIDNotSupported) {
229 DisableGPUInfoValidation(); 229 DisableGPUInfoValidation();
230 rt = true; 230 rt = true;
231 } else { 231 } else {
232 rt = SetGPUInfo(my_gpu_info); 232 rt = SetGPUInfo(my_gpu_info);
233 } 233 }
234 } else { 234 } else {
235 rt = SetGPUInfo(*gpu_info); 235 rt = SetGPUInfo(*gpu_info);
236 } 236 }
237 set_os(GetCurrentOS()); 237 set_os(GetCurrentOS());
238 if (os() == kOsUnknown) 238 if (os() == kOsUnknown)
(...skipping 20 matching lines...) Expand all
259 GPUTestBotConfig my_config; 259 GPUTestBotConfig my_config;
260 if (!my_config.LoadCurrentConfig(NULL)) 260 if (!my_config.LoadCurrentConfig(NULL))
261 return false; 261 return false;
262 for (size_t i = 0 ; i < configs.size(); ++i) { 262 for (size_t i = 0 ; i < configs.size(); ++i) {
263 if (my_config.Matches(configs[i])) 263 if (my_config.Matches(configs[i]))
264 return true; 264 return true;
265 } 265 }
266 return false; 266 return false;
267 } 267 }
268 268
OLDNEW
« no previous file with comments | « content/test/gpu/gpu_test_config.h ('k') | content/test/gpu/gpu_test_config_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698