Skip to content

Commit

Permalink
Add GPU info collection to GPUTestConfig.
Browse files Browse the repository at this point in the history
We didn't add it the first place due to a shared build failure. This should be added so the GPUTestConfig can be easier to use.

BUG=101216
TEST=content_unittests
R=kbr

Review URL: http://codereview.chromium.org/9288073

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119553 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
zmo@chromium.org committed Jan 28, 2012
1 parent c7ea77e commit b018639
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
5 changes: 3 additions & 2 deletions content/gpu/gpu_info_collector.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Copyright (c) 2012 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.

Expand All @@ -22,7 +22,8 @@ bool CollectGraphicsInfo(content::GPUInfo* gpu_info);
// Similar to CollectGraphicsInfo, only this collects a subset of variables
// without creating a GL/DirectX context (and without the danger of crashing).
// The subset each platform collects may be different.
bool CollectPreliminaryGraphicsInfo(content::GPUInfo* gpu_info);
CONTENT_EXPORT bool CollectPreliminaryGraphicsInfo(
content::GPUInfo* gpu_info);

#if defined(OS_WIN)
// Windows provides two ways of doing graphics so we need two ways of
Expand Down
12 changes: 10 additions & 2 deletions content/test/gpu/gpu_test_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "base/logging.h"
#include "base/sys_info.h"
#include "content/gpu/gpu_info_collector.h"
#include "content/public/common/gpu_info.h"

namespace {
Expand Down Expand Up @@ -188,8 +189,15 @@ bool GPUTestBotConfig::Matches(const GPUTestConfig& config) const {
return true;
}

bool GPUTestBotConfig::LoadCurrentConfig(const content::GPUInfo& gpu_info) {
bool rt = SetGPUInfo(gpu_info);
bool GPUTestBotConfig::LoadCurrentConfig(const content::GPUInfo* gpu_info) {
bool rt;
if (gpu_info == NULL) {
content::GPUInfo my_gpu_info;
gpu_info_collector::CollectPreliminaryGraphicsInfo(&my_gpu_info);
rt = SetGPUInfo(my_gpu_info);
} else {
rt = SetGPUInfo(*gpu_info);
}
set_os(GetCurrentOS());
if (os() == kOsUnknown)
rt = false;
Expand Down
3 changes: 2 additions & 1 deletion content/test/gpu/gpu_test_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ class GPUTestBotConfig : public GPUTestConfig {
bool Matches(const GPUTestConfig& config) const;

// Setup the config with the current gpu testing environment.
bool LoadCurrentConfig(const content::GPUInfo& gpu_info);
// If gpu_info is NULL, collect GPUInfo first.
bool LoadCurrentConfig(const content::GPUInfo* gpu_info);
};

#endif // CONTENT_TEST_GPU_GPU_TEST_CONFIG_H_
Expand Down
2 changes: 1 addition & 1 deletion content/test/gpu/gpu_test_config_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ TEST_F(GPUTestConfigTest, LoadCurrentConfig) {
content::GPUInfo gpu_info;
gpu_info.vendor_id = 0x10de;
gpu_info.device_id = 0x0640;
EXPECT_TRUE(config.LoadCurrentConfig(gpu_info));
EXPECT_TRUE(config.LoadCurrentConfig(&gpu_info));
EXPECT_TRUE(config.IsValid());
}

0 comments on commit b018639

Please sign in to comment.