summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorzmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-04 02:50:38 +0000
committerzmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-04 02:50:38 +0000
commit916b977f67e39c36aa9503319c99af486644e9e4 (patch)
treec90b0514b974ae1db15a8573805bfda7c44a821a /content
parent2f449fb2d5b90fe263e7d80c9aa81845982ddbdb (diff)
downloadchromium_src-916b977f67e39c36aa9503319c99af486644e9e4.zip
chromium_src-916b977f67e39c36aa9503319c99af486644e9e4.tar.gz
chromium_src-916b977f67e39c36aa9503319c99af486644e9e4.tar.bz2
Add channel and gl_vendor to GpuBlacklist.
BUG=91874 TEST=unittest Review URL: http://codereview.chromium.org/7826019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99589 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/gpu/gpu_blacklist.cc104
-rw-r--r--content/browser/gpu/gpu_blacklist.h37
-rw-r--r--content/browser/gpu/gpu_blacklist_unittest.cc168
3 files changed, 277 insertions, 32 deletions
diff --git a/content/browser/gpu/gpu_blacklist.cc b/content/browser/gpu/gpu_blacklist.cc
index b63626f..1c5f61f 100644
--- a/content/browser/gpu/gpu_blacklist.cc
+++ b/content/browser/gpu/gpu_blacklist.cc
@@ -349,6 +349,19 @@ GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue(
dictionary_entry_count++;
}
+ DictionaryValue* gl_vendor_value = NULL;
+ if (value->GetDictionary("gl_vendor", &gl_vendor_value)) {
+ std::string vendor_op;
+ std::string vendor_value;
+ gl_vendor_value->GetString("op", &vendor_op);
+ gl_vendor_value->GetString("value", &vendor_value);
+ if (!entry->SetGLVendorInfo(vendor_op, vendor_value)) {
+ LOG(WARNING) << "Malformed gl_vendor entry " << entry->id();
+ return NULL;
+ }
+ dictionary_entry_count++;
+ }
+
DictionaryValue* gl_renderer_value = NULL;
if (value->GetDictionary("gl_renderer", &gl_renderer_value)) {
std::string renderer_op;
@@ -416,6 +429,24 @@ GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue(
dictionary_entry_count++;
}
+ ListValue* channel_list_value = NULL;
+ if (value->GetList("browser_channels", &channel_list_value)) {
+ for (size_t i = 0; i < channel_list_value->GetSize(); ++i) {
+ std::string channel_value;
+ if (!channel_list_value->GetString(i, &channel_value)) {
+ LOG(WARNING) << "Malformed browser_channels entry " << entry->id();
+ return NULL;
+ }
+ BrowserChannel channel = StringToBrowserChannel(channel_value);
+ if (channel == kUnknown) {
+ LOG(WARNING) << "Malformed browser_channels entry " << entry->id();
+ return NULL;
+ }
+ entry->AddBrowserChannel(channel);
+ }
+ dictionary_entry_count++;
+ }
+
if (value->size() != dictionary_entry_count) {
LOG(WARNING) << "Entry with unknown fields " << entry->id();
entry->contains_unknown_fields_ = true;
@@ -491,6 +522,14 @@ bool GpuBlacklist::GpuBlacklistEntry::SetDriverDateInfo(
return driver_date_info_->IsValid();
}
+bool GpuBlacklist::GpuBlacklistEntry::SetGLVendorInfo(
+ const std::string& vendor_op,
+ const std::string& vendor_value) {
+ gl_vendor_info_.reset(
+ new StringInfo(vendor_op, vendor_value));
+ return gl_vendor_info_->IsValid();
+}
+
bool GpuBlacklist::GpuBlacklistEntry::SetGLRendererInfo(
const std::string& renderer_op,
const std::string& renderer_value) {
@@ -531,8 +570,15 @@ void GpuBlacklist::GpuBlacklistEntry::AddException(
exceptions_.push_back(exception);
}
+void GpuBlacklist::GpuBlacklistEntry::AddBrowserChannel(
+ BrowserChannel channel) {
+ DCHECK(channel != kUnknown);
+ browser_channels_.push_back(channel);
+}
+
bool GpuBlacklist::GpuBlacklistEntry::Contains(
- OsType os_type, const Version& os_version, const GPUInfo& gpu_info) const {
+ OsType os_type, const Version& os_version, BrowserChannel channel,
+ const GPUInfo& gpu_info) const {
DCHECK(os_type != kOsAny);
if (os_info_.get() != NULL && !os_info_->Contains(os_type, os_version))
return false;
@@ -565,14 +611,27 @@ bool GpuBlacklist::GpuBlacklistEntry::Contains(
!driver_date_info_->Contains(*driver_date))
return false;
}
+ if (gl_vendor_info_.get() != NULL &&
+ !gl_vendor_info_->Contains(gpu_info.gl_vendor))
+ return false;
if (gl_renderer_info_.get() != NULL &&
!gl_renderer_info_->Contains(gpu_info.gl_renderer))
return false;
for (size_t i = 0; i < exceptions_.size(); ++i) {
- if (exceptions_[i]->Contains(os_type, os_version, gpu_info))
- return false;
+ if (exceptions_[i]->Contains(os_type, os_version, channel, gpu_info))
+ return false;
}
- return true;
+ bool rt = true;
+ if (browser_channels_.size() > 0) {
+ rt = false;
+ for (size_t i = 0; i < browser_channels_.size(); ++i) {
+ if (browser_channels_[i] == channel) {
+ rt = true;
+ break;
+ }
+ }
+ }
+ return rt;
}
GpuBlacklist::OsType GpuBlacklist::GpuBlacklistEntry::GetOsType() const {
@@ -589,11 +648,10 @@ GpuFeatureFlags GpuBlacklist::GpuBlacklistEntry::GetGpuFeatureFlags() const {
return *feature_flags_;
}
-GpuBlacklist::GpuBlacklist(const std::string& browser_version_string)
+GpuBlacklist::GpuBlacklist(const std::string& browser_info_string)
: max_entry_id_(0),
contains_unknown_fields_(false) {
- browser_version_.reset(Version::GetVersionFromString(browser_version_string));
- DCHECK(browser_version_.get() != NULL);
+ SetBrowserInfo(browser_info_string);
}
GpuBlacklist::~GpuBlacklist() {
@@ -693,7 +751,7 @@ GpuFeatureFlags GpuBlacklist::DetermineGpuFeatureFlags(
DCHECK(os_version != NULL);
for (size_t i = 0; i < blacklist_.size(); ++i) {
- if (blacklist_[i]->Contains(os, *os_version, gpu_info)) {
+ if (blacklist_[i]->Contains(os, *os_version, browser_channel_, gpu_info)) {
flags.Combine(blacklist_[i]->GetGpuFeatureFlags());
active_entries_.push_back(blacklist_[i]);
}
@@ -973,3 +1031,33 @@ GpuBlacklist::IsEntrySupportedByCurrentBrowserVersion(
}
return kSupported;
}
+
+void GpuBlacklist::SetBrowserInfo(const std::string& browser_info_string) {
+ std::vector<std::string> pieces;
+ base::SplitString(browser_info_string, ' ', &pieces);
+ if (pieces.size() != 2) {
+ pieces.resize(2);
+ pieces[0] = "0";
+ pieces[1] = "unknown";
+ }
+
+ browser_version_.reset(Version::GetVersionFromString(pieces[0]));
+ DCHECK(browser_version_.get() != NULL);
+
+ browser_channel_ = StringToBrowserChannel(pieces[1]);
+}
+
+// static
+GpuBlacklist::BrowserChannel GpuBlacklist::StringToBrowserChannel(
+ const std::string& value) {
+ if (value == "stable")
+ return kStable;
+ if (value == "beta")
+ return kBeta;
+ if (value == "dev")
+ return kDev;
+ if (value == "canary")
+ return kCanary;
+ return kUnknown;
+}
+
diff --git a/content/browser/gpu/gpu_blacklist.h b/content/browser/gpu/gpu_blacklist.h
index a740308..8020163 100644
--- a/content/browser/gpu/gpu_blacklist.h
+++ b/content/browser/gpu/gpu_blacklist.h
@@ -41,7 +41,7 @@ class GpuBlacklist {
kAllOs
};
- explicit GpuBlacklist(const std::string& browser_version_string);
+ explicit GpuBlacklist(const std::string& browser_info_string);
~GpuBlacklist();
// Loads blacklist information from a json file.
@@ -118,6 +118,20 @@ class GpuBlacklist {
FRIEND_TEST_ALL_PREFIXES(GpuBlacklistTest, UnknownExceptionField);
FRIEND_TEST_ALL_PREFIXES(GpuBlacklistTest, UnknownFeature);
+ enum BrowserVersionSupport {
+ kSupported,
+ kUnsupported,
+ kMalformed
+ };
+
+ enum BrowserChannel {
+ kStable,
+ kBeta,
+ kDev,
+ kCanary,
+ kUnknown
+ };
+
class VersionInfo {
public:
VersionInfo(const std::string& version_op,
@@ -214,6 +228,7 @@ class GpuBlacklist {
// Determines if a given os/gc/driver is included in the Entry set.
bool Contains(OsType os_type,
const Version& os_version,
+ BrowserChannel channel,
const GPUInfo& gpu_info) const;
// Returns the OsType.
@@ -269,6 +284,9 @@ class GpuBlacklist {
const std::string& date_string,
const std::string& date_string2);
+ bool SetGLVendorInfo(const std::string& vendor_op,
+ const std::string& vendor_value);
+
bool SetGLRendererInfo(const std::string& renderer_op,
const std::string& renderer_value);
@@ -277,6 +295,8 @@ class GpuBlacklist {
void AddException(ScopedGpuBlacklistEntry exception);
+ void AddBrowserChannel(BrowserChannel channel);
+
uint32 id_;
std::string description_;
std::vector<int> cr_bugs_;
@@ -287,19 +307,15 @@ class GpuBlacklist {
scoped_ptr<StringInfo> driver_vendor_info_;
scoped_ptr<VersionInfo> driver_version_info_;
scoped_ptr<VersionInfo> driver_date_info_;
+ scoped_ptr<StringInfo> gl_vendor_info_;
scoped_ptr<StringInfo> gl_renderer_info_;
scoped_ptr<GpuFeatureFlags> feature_flags_;
std::vector<ScopedGpuBlacklistEntry> exceptions_;
+ std::vector<BrowserChannel> browser_channels_;
bool contains_unknown_fields_;
bool contains_unknown_features_;
};
- enum BrowserVersionSupport {
- kSupported,
- kUnsupported,
- kMalformed
- };
-
// Gets the current OS type.
static OsType GetOsType();
@@ -319,10 +335,17 @@ class GpuBlacklist {
// Check if any entries contain unknown fields. This is only for tests.
bool contains_unknown_fields() const { return contains_unknown_fields_; }
+ // The browser_info_string's format is "version channel".
+ // For example, "13.0.123.4 canary".
+ void SetBrowserInfo(const std::string& browser_info_string);
+
+ static BrowserChannel StringToBrowserChannel(const std::string& value);
+
scoped_ptr<Version> version_;
std::vector<ScopedGpuBlacklistEntry> blacklist_;
scoped_ptr<Version> browser_version_;
+ BrowserChannel browser_channel_;
// This records all the blacklist entries that are appliable to the current
// user machine. It is updated everytime DetermineGpuFeatureFlags() is
diff --git a/content/browser/gpu/gpu_blacklist_unittest.cc b/content/browser/gpu/gpu_blacklist_unittest.cc
index 55e8de1..c1f4fbb 100644
--- a/content/browser/gpu/gpu_blacklist_unittest.cc
+++ b/content/browser/gpu/gpu_blacklist_unittest.cc
@@ -31,6 +31,8 @@ class GpuBlacklistTest : public testing::Test {
gpu_info_.driver_vendor = "NVIDIA";
gpu_info_.driver_version = "1.6.18";
gpu_info_.driver_date = "7-14-2009";
+ gpu_info_.gl_vendor = "NVIDIA Corporation";
+ gpu_info_.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine";
}
void TearDown() {
@@ -56,14 +58,14 @@ TEST_F(GpuBlacklistTest, CurrentBlacklistValidation) {
ASSERT_EQ(file_util::ReadFile(data_file, data.get(), data_file_size),
data_file_size);
std::string json_string(data.get(), data_file_size);
- GpuBlacklist blacklist("1.0");
+ GpuBlacklist blacklist("1.0 unknown");
EXPECT_TRUE(blacklist.LoadGpuBlacklist(json_string, GpuBlacklist::kAllOs));
EXPECT_FALSE(blacklist.contains_unknown_fields());
}
TEST_F(GpuBlacklistTest, DefaultBlacklistSettings) {
scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
- GpuBlacklist blacklist("1.0");
+ GpuBlacklist blacklist("1.0 unknown");
// Default blacklist settings: all feature are allowed.
GpuFeatureFlags flags = blacklist.DetermineGpuFeatureFlags(
GpuBlacklist::kOsMacosx, os_version.get(), gpu_info());
@@ -80,7 +82,7 @@ TEST_F(GpuBlacklistTest, EmptyBlacklist) {
" ]\n"
"}";
scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
- GpuBlacklist blacklist("1.0");
+ GpuBlacklist blacklist("1.0 unknown");
EXPECT_TRUE(
blacklist.LoadGpuBlacklist(empty_list_json, GpuBlacklist::kAllOs));
@@ -122,7 +124,7 @@ TEST_F(GpuBlacklistTest, DetailedEntryAndInvalidJson) {
" ]\n"
"}";
scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
- GpuBlacklist blacklist("1.0");
+ GpuBlacklist blacklist("1.0 unknown");
EXPECT_TRUE(
blacklist.LoadGpuBlacklist(exact_list_json, GpuBlacklist::kAllOs));
@@ -170,7 +172,7 @@ TEST_F(GpuBlacklistTest, VendorOnAllOsEntry) {
" ]\n"
"}";
scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
- GpuBlacklist blacklist("1.0");
+ GpuBlacklist blacklist("1.0 unknown");
// Blacklist entries won't be filtered to the current OS only upon loading.
EXPECT_TRUE(blacklist.LoadGpuBlacklist(vendor_json, GpuBlacklist::kAllOs));
@@ -225,7 +227,7 @@ TEST_F(GpuBlacklistTest, VendorOnLinuxEntry) {
" ]\n"
"}";
scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
- GpuBlacklist blacklist("1.0");
+ GpuBlacklist blacklist("1.0 unknown");
EXPECT_TRUE(
blacklist.LoadGpuBlacklist(vendor_linux_json, GpuBlacklist::kAllOs));
@@ -266,7 +268,7 @@ TEST_F(GpuBlacklistTest, AllExceptNVidiaOnLinuxEntry) {
" ]\n"
"}";
scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
- GpuBlacklist blacklist("1.0");
+ GpuBlacklist blacklist("1.0 unknown");
EXPECT_TRUE(blacklist.LoadGpuBlacklist(linux_except_nvidia_json,
GpuBlacklist::kAllOs));
@@ -305,7 +307,7 @@ TEST_F(GpuBlacklistTest, AllExceptIntelOnLinuxEntry) {
" ]\n"
"}";
scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
- GpuBlacklist blacklist("1.0");
+ GpuBlacklist blacklist("1.0 unknown");
EXPECT_TRUE(blacklist.LoadGpuBlacklist(linux_except_intel_json,
GpuBlacklist::kAllOs));
@@ -345,7 +347,7 @@ TEST_F(GpuBlacklistTest, DateOnWindowsEntry) {
" ]\n"
"}";
scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
- GpuBlacklist blacklist("1.0");
+ GpuBlacklist blacklist("1.0 unknown");
EXPECT_TRUE(
blacklist.LoadGpuBlacklist(date_windows_json, GpuBlacklist::kAllOs));
@@ -379,7 +381,7 @@ TEST_F(GpuBlacklistTest, MultipleDevicesEntry) {
" ]\n"
"}";
scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
- GpuBlacklist blacklist("1.0");
+ GpuBlacklist blacklist("1.0 unknown");
EXPECT_TRUE(blacklist.LoadGpuBlacklist(devices_json, GpuBlacklist::kAllOs));
GpuFeatureFlags flags = blacklist.DetermineGpuFeatureFlags(
@@ -414,7 +416,7 @@ TEST_F(GpuBlacklistTest, ChromeOSEntry) {
" ]\n"
"}";
scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
- GpuBlacklist blacklist("1.0");
+ GpuBlacklist blacklist("1.0 unknown");
EXPECT_TRUE(blacklist.LoadGpuBlacklist(devices_json, GpuBlacklist::kAllOs));
GpuFeatureFlags flags = blacklist.DetermineGpuFeatureFlags(
@@ -446,14 +448,14 @@ TEST_F(GpuBlacklistTest, ChromeVersionEntry) {
"}";
scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
- GpuBlacklist blacklist9("9.0");
+ GpuBlacklist blacklist9("9.0 unknown");
EXPECT_TRUE(
blacklist9.LoadGpuBlacklist(browser_version_json, GpuBlacklist::kAllOs));
GpuFeatureFlags flags = blacklist9.DetermineGpuFeatureFlags(
GpuBlacklist::kOsWin, os_version.get(), gpu_info());
EXPECT_EQ(flags.flags(), 0u);
- GpuBlacklist blacklist10("10.0");
+ GpuBlacklist blacklist10("10.0 unknown");
EXPECT_TRUE(
blacklist10.LoadGpuBlacklist(browser_version_json, GpuBlacklist::kAllOs));
flags = blacklist10.DetermineGpuFeatureFlags(
@@ -478,7 +480,7 @@ TEST_F(GpuBlacklistTest, MalformedVendor) {
" }\n"
" ]\n"
"}";
- GpuBlacklist blacklist("1.0");
+ GpuBlacklist blacklist("1.0 unknown");
EXPECT_FALSE(
blacklist.LoadGpuBlacklist(malformed_vendor_json, GpuBlacklist::kAllOs));
@@ -506,7 +508,7 @@ TEST_F(GpuBlacklistTest, UnknownField) {
" ]\n"
"}";
scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
- GpuBlacklist blacklist("1.0");
+ GpuBlacklist blacklist("1.0 unknown");
EXPECT_TRUE(
blacklist.LoadGpuBlacklist(unknown_field_json, GpuBlacklist::kAllOs));
@@ -551,7 +553,7 @@ TEST_F(GpuBlacklistTest, UnknownExceptionField) {
" ]\n"
"}";
scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
- GpuBlacklist blacklist("1.0");
+ GpuBlacklist blacklist("1.0 unknown");
EXPECT_TRUE(blacklist.LoadGpuBlacklist(unknown_exception_field_json,
GpuBlacklist::kAllOs));
@@ -579,7 +581,7 @@ TEST_F(GpuBlacklistTest, UnknownFeature) {
" ]\n"
"}";
scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
- GpuBlacklist blacklist("1.0");
+ GpuBlacklist blacklist("1.0 unknown");
EXPECT_TRUE(
blacklist.LoadGpuBlacklist(unknown_feature_json, GpuBlacklist::kAllOs));
@@ -591,3 +593,135 @@ TEST_F(GpuBlacklistTest, UnknownFeature) {
static_cast<uint32>(GpuFeatureFlags::kGpuFeatureWebgl));
}
+TEST_F(GpuBlacklistTest, BrowserChannels) {
+ const std::string browser_channels_json =
+ "{\n"
+ " \"name\": \"gpu blacklist\",\n"
+ " \"version\": \"0.1\",\n"
+ " \"entries\": [\n"
+ " {\n"
+ " \"id\": 1,\n"
+ " \"browser_channels\": [\n"
+ " \"canary\""
+ " ],\n"
+ " \"blacklist\": [\n"
+ " \"webgl\"\n"
+ " ]\n"
+ " }\n"
+ " ]\n"
+ "}";
+ scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+
+ GpuBlacklist blacklist_canary("1.0 canary");
+ EXPECT_TRUE(blacklist_canary.LoadGpuBlacklist(browser_channels_json,
+ GpuBlacklist::kAllOs));
+ GpuFeatureFlags flags_canary = blacklist_canary.DetermineGpuFeatureFlags(
+ GpuBlacklist::kOsWin, os_version.get(), gpu_info());
+ EXPECT_EQ(flags_canary.flags(),
+ static_cast<uint32>(GpuFeatureFlags::kGpuFeatureWebgl));
+
+ GpuBlacklist blacklist_dev("1.0 dev");
+ EXPECT_TRUE(blacklist_dev.LoadGpuBlacklist(browser_channels_json,
+ GpuBlacklist::kAllOs));
+ GpuFeatureFlags flags_dev = blacklist_dev.DetermineGpuFeatureFlags(
+ GpuBlacklist::kOsWin, os_version.get(), gpu_info());
+ EXPECT_EQ(flags_dev.flags(), 0u);
+}
+
+TEST_F(GpuBlacklistTest, BrowserChannelsInException) {
+ const std::string browser_channels_json =
+ "{\n"
+ " \"name\": \"gpu blacklist\",\n"
+ " \"version\": \"0.1\",\n"
+ " \"entries\": [\n"
+ " {\n"
+ " \"id\": 1,\n"
+ " \"exceptions\": [\n"
+ " {\n"
+ " \"browser_channels\": [\n"
+ " \"canary\""
+ " ]\n"
+ " }\n"
+ " ],\n"
+ " \"blacklist\": [\n"
+ " \"webgl\"\n"
+ " ]\n"
+ " }\n"
+ " ]\n"
+ "}";
+ scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+
+ GpuBlacklist blacklist_canary("1.0 canary");
+ EXPECT_TRUE(blacklist_canary.LoadGpuBlacklist(browser_channels_json,
+ GpuBlacklist::kAllOs));
+ GpuFeatureFlags flags_canary = blacklist_canary.DetermineGpuFeatureFlags(
+ GpuBlacklist::kOsWin, os_version.get(), gpu_info());
+ EXPECT_EQ(flags_canary.flags(), 0u);
+
+ GpuBlacklist blacklist_dev("1.0 dev");
+ EXPECT_TRUE(blacklist_dev.LoadGpuBlacklist(browser_channels_json,
+ GpuBlacklist::kAllOs));
+ GpuFeatureFlags flags_dev = blacklist_dev.DetermineGpuFeatureFlags(
+ GpuBlacklist::kOsWin, os_version.get(), gpu_info());
+ EXPECT_EQ(flags_dev.flags(),
+ static_cast<uint32>(GpuFeatureFlags::kGpuFeatureWebgl));
+}
+
+TEST_F(GpuBlacklistTest, GlVendor) {
+ const std::string gl_vendor_json =
+ "{\n"
+ " \"name\": \"gpu blacklist\",\n"
+ " \"version\": \"0.1\",\n"
+ " \"entries\": [\n"
+ " {\n"
+ " \"id\": 1,\n"
+ " \"gl_vendor\": {\n"
+ " \"op\": \"beginwith\",\n"
+ " \"value\": \"NVIDIA\"\n"
+ " },\n"
+ " \"blacklist\": [\n"
+ " \"webgl\"\n"
+ " ]\n"
+ " }\n"
+ " ]\n"
+ "}";
+ scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+
+ GpuBlacklist blacklist("1.0 unknown");
+ EXPECT_TRUE(
+ blacklist.LoadGpuBlacklist(gl_vendor_json, GpuBlacklist::kAllOs));
+ GpuFeatureFlags flags = blacklist.DetermineGpuFeatureFlags(
+ GpuBlacklist::kOsWin, os_version.get(), gpu_info());
+ EXPECT_EQ(flags.flags(),
+ static_cast<uint32>(GpuFeatureFlags::kGpuFeatureWebgl));
+}
+
+TEST_F(GpuBlacklistTest, GlRenderer) {
+ const std::string gl_renderer_json =
+ "{\n"
+ " \"name\": \"gpu blacklist\",\n"
+ " \"version\": \"0.1\",\n"
+ " \"entries\": [\n"
+ " {\n"
+ " \"id\": 1,\n"
+ " \"gl_renderer\": {\n"
+ " \"op\": \"contains\",\n"
+ " \"value\": \"GeForce\"\n"
+ " },\n"
+ " \"blacklist\": [\n"
+ " \"webgl\"\n"
+ " ]\n"
+ " }\n"
+ " ]\n"
+ "}";
+ scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+
+ GpuBlacklist blacklist("1.0 unknown");
+ EXPECT_TRUE(
+ blacklist.LoadGpuBlacklist(gl_renderer_json, GpuBlacklist::kAllOs));
+ GpuFeatureFlags flags = blacklist.DetermineGpuFeatureFlags(
+ GpuBlacklist::kOsWin, os_version.get(), gpu_info());
+ EXPECT_EQ(flags.flags(),
+ static_cast<uint32>(GpuFeatureFlags::kGpuFeatureWebgl));
+}
+