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

Unified Diff: trunk/src/gpu/config/gpu_control_list_entry_unittest.cc

Issue 465163002: Revert 289067 "Use RE string pattern matching for blacklist stri..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « trunk/src/gpu/config/gpu_control_list.cc ('k') | trunk/src/gpu/config/gpu_control_list_format.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/gpu/config/gpu_control_list_entry_unittest.cc
===================================================================
--- trunk/src/gpu/config/gpu_control_list_entry_unittest.cc (revision 289153)
+++ trunk/src/gpu/config/gpu_control_list_entry_unittest.cc (working copy)
@@ -470,11 +470,14 @@
EXPECT_FALSE(entry->Contains(GpuControlList::kOsWin, "6.1", gpu_info));
}
-TEST_F(GpuControlListEntryTest, GlVendorEqual) {
+TEST_F(GpuControlListEntryTest, GlVendorEntry) {
const std::string json = LONG_STRING_CONST(
{
"id": 1,
- "gl_vendor": "NVIDIA",
+ "gl_vendor": {
+ "op": "beginwith",
+ "value": "NVIDIA"
+ },
"features": [
"test_feature_0"
]
@@ -483,26 +486,25 @@
ScopedEntry entry(GetEntryFromString(json));
EXPECT_TRUE(entry.get() != NULL);
- GPUInfo gpu_info;
- gpu_info.gl_vendor = "NVIDIA";
- EXPECT_TRUE(entry->Contains(
- GpuControlList::kOsMacosx, "10.9", gpu_info));
-
- // Case sensitive.
- gpu_info.gl_vendor = "NVidia";
- EXPECT_FALSE(entry->Contains(
- GpuControlList::kOsMacosx, "10.9", gpu_info));
-
- gpu_info.gl_vendor = "NVIDIA-x";
- EXPECT_FALSE(entry->Contains(
- GpuControlList::kOsMacosx, "10.9", gpu_info));
+ const GpuControlList::OsType os_type[] = {
+ GpuControlList::kOsMacosx,
+ GpuControlList::kOsWin,
+ GpuControlList::kOsLinux,
+ GpuControlList::kOsChromeOS,
+ GpuControlList::kOsAndroid
+ };
+ for (size_t i = 0; i < arraysize(os_type); ++i)
+ EXPECT_TRUE(entry->Contains(os_type[i], "10.6", gpu_info()));
}
-TEST_F(GpuControlListEntryTest, GlVendorWithDot) {
+TEST_F(GpuControlListEntryTest, GlRendererEntry) {
const std::string json = LONG_STRING_CONST(
{
"id": 1,
- "gl_vendor": "X\\.Org.*",
+ "gl_renderer": {
+ "op": "contains",
+ "value": "GeForce"
+ },
"features": [
"test_feature_0"
]
@@ -511,102 +513,17 @@
ScopedEntry entry(GetEntryFromString(json));
EXPECT_TRUE(entry.get() != NULL);
- GPUInfo gpu_info;
- gpu_info.gl_vendor = "X.Org R300 Project";
- EXPECT_TRUE(entry->Contains(
- GpuControlList::kOsLinux, "", gpu_info));
-
- gpu_info.gl_vendor = "X.Org";
- EXPECT_TRUE(entry->Contains(
- GpuControlList::kOsLinux, "", gpu_info));
+ const GpuControlList::OsType os_type[] = {
+ GpuControlList::kOsMacosx,
+ GpuControlList::kOsWin,
+ GpuControlList::kOsLinux,
+ GpuControlList::kOsChromeOS,
+ GpuControlList::kOsAndroid
+ };
+ for (size_t i = 0; i < arraysize(os_type); ++i)
+ EXPECT_TRUE(entry->Contains(os_type[i], "10.6", gpu_info()));
}
-TEST_F(GpuControlListEntryTest, GlRendererContains) {
- const std::string json = LONG_STRING_CONST(
- {
- "id": 1,
- "gl_renderer": ".*GeForce.*",
- "features": [
- "test_feature_0"
- ]
- }
- );
- ScopedEntry entry(GetEntryFromString(json));
- EXPECT_TRUE(entry.get() != NULL);
-
- GPUInfo gpu_info;
- gpu_info.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine";
- EXPECT_TRUE(entry->Contains(
- GpuControlList::kOsMacosx, "10.9", gpu_info));
-
- // Case sensitive.
- gpu_info.gl_renderer = "NVIDIA GEFORCE GT 120 OpenGL Engine";
- EXPECT_FALSE(entry->Contains(
- GpuControlList::kOsMacosx, "10.9", gpu_info));
-
- gpu_info.gl_renderer = "GeForce GT 120 OpenGL Engine";
- EXPECT_TRUE(entry->Contains(
- GpuControlList::kOsMacosx, "10.9", gpu_info));
-
- gpu_info.gl_renderer = "NVIDIA GeForce";
- EXPECT_TRUE(entry->Contains(
- GpuControlList::kOsMacosx, "10.9", gpu_info));
-
- gpu_info.gl_renderer = "NVIDIA Ge Force";
- EXPECT_FALSE(entry->Contains(
- GpuControlList::kOsMacosx, "10.9", gpu_info));
-}
-
-TEST_F(GpuControlListEntryTest, GlRendererCaseInsensitive) {
- const std::string json = LONG_STRING_CONST(
- {
- "id": 1,
- "gl_renderer": "(?i).*software.*",
- "features": [
- "test_feature_0"
- ]
- }
- );
- ScopedEntry entry(GetEntryFromString(json));
- EXPECT_TRUE(entry.get() != NULL);
-
- GPUInfo gpu_info;
- gpu_info.gl_renderer = "software rasterizer";
- EXPECT_TRUE(entry->Contains(
- GpuControlList::kOsMacosx, "10.9", gpu_info));
-
- gpu_info.gl_renderer = "Software Rasterizer";
- EXPECT_TRUE(entry->Contains(
- GpuControlList::kOsMacosx, "10.9", gpu_info));
-}
-
-TEST_F(GpuControlListEntryTest, GlExtensionsEndWith) {
- const std::string json = LONG_STRING_CONST(
- {
- "id": 1,
- "gl_extensions": ".*GL_SUN_slice_accum",
- "features": [
- "test_feature_0"
- ]
- }
- );
- ScopedEntry entry(GetEntryFromString(json));
- EXPECT_TRUE(entry.get() != NULL);
-
- GPUInfo gpu_info;
- gpu_info.gl_extensions = "GL_SGIS_generate_mipmap "
- "GL_SGIX_shadow "
- "GL_SUN_slice_accum";
- EXPECT_TRUE(entry->Contains(
- GpuControlList::kOsMacosx, "10.9", gpu_info));
-
- gpu_info.gl_extensions = "GL_SGIS_generate_mipmap "
- "GL_SUN_slice_accum "
- "GL_SGIX_shadow";
- EXPECT_FALSE(entry->Contains(
- GpuControlList::kOsMacosx, "10.9", gpu_info));
-}
-
TEST_F(GpuControlListEntryTest, PerfGraphicsEntry) {
const std::string json = LONG_STRING_CONST(
{
@@ -723,38 +640,6 @@
GpuControlList::kOsMacosx, "10.6", gpu_info));
}
-TEST_F(GpuControlListEntryTest, DriverVendorBeginWith) {
- const std::string json = LONG_STRING_CONST(
- {
- "id": 1,
- "driver_vendor": "NVIDIA.*",
- "features": [
- "test_feature_0"
- ]
- }
- );
- ScopedEntry entry(GetEntryFromString(json));
- EXPECT_TRUE(entry.get() != NULL);
-
- GPUInfo gpu_info;
- gpu_info.driver_vendor = "NVIDIA Corporation";
- EXPECT_TRUE(entry->Contains(
- GpuControlList::kOsMacosx, "10.9", gpu_info));
-
- // Case sensitive.
- gpu_info.driver_vendor = "NVidia Corporation";
- EXPECT_FALSE(entry->Contains(
- GpuControlList::kOsMacosx, "10.9", gpu_info));
-
- gpu_info.driver_vendor = "NVIDIA";
- EXPECT_TRUE(entry->Contains(
- GpuControlList::kOsMacosx, "10.9", gpu_info));
-
- gpu_info.driver_vendor = "USA NVIDIA";
- EXPECT_FALSE(entry->Contains(
- GpuControlList::kOsMacosx, "10.9", gpu_info));
-}
-
TEST_F(GpuControlListEntryTest, LexicalDriverVersionEntry) {
const std::string json = LONG_STRING_CONST(
{
@@ -825,7 +710,10 @@
"vendor_id": "0x8086",
"exceptions": [
{
- "gl_renderer": ".*mesa.*"
+ "gl_renderer": {
+ "op": "contains",
+ "value": "mesa"
+ }
}
],
"features": [
@@ -919,9 +807,7 @@
"os": {
"type": "android"
},
- "machine_model_name": [
- "Nexus 4", "XT1032", "GT-.*", "SCH-.*"
- ],
+ "machine_model_name": ["Nexus 4", "XT1032"],
"features": [
"test_feature_0"
]
@@ -955,18 +841,6 @@
gpu_info.machine_model_name = "";
EXPECT_FALSE(entry->Contains(
GpuControlList::kOsAndroid, "4.1", gpu_info));
-
- gpu_info.machine_model_name = "GT-N7100";
- EXPECT_TRUE(entry->Contains(
- GpuControlList::kOsAndroid, "4.1", gpu_info));
-
- gpu_info.machine_model_name = "GT-I9300";
- EXPECT_TRUE(entry->Contains(
- GpuControlList::kOsAndroid, "4.1", gpu_info));
-
- gpu_info.machine_model_name = "SCH-I545";
- EXPECT_TRUE(entry->Contains(
- GpuControlList::kOsAndroid, "4.1", gpu_info));
}
TEST_F(GpuControlListEntryTest, MachineModelNameException) {
@@ -978,7 +852,7 @@
"os": {
"type": "android"
},
- "machine_model_name": ["Nexus.*"]
+ "machine_model_name": ["Nexus 4"]
}
],
"features": [
@@ -997,12 +871,6 @@
EXPECT_TRUE(entry->Contains(
GpuControlList::kOsLinux, "4.1", gpu_info));
- gpu_info.machine_model_name = "Nexus 7";
- EXPECT_FALSE(entry->Contains(
- GpuControlList::kOsAndroid, "4.1", gpu_info));
- EXPECT_TRUE(entry->Contains(
- GpuControlList::kOsLinux, "4.1", gpu_info));
-
gpu_info.machine_model_name = "";
EXPECT_TRUE(entry->Contains(
GpuControlList::kOsAndroid, "4.1", gpu_info));
« no previous file with comments | « trunk/src/gpu/config/gpu_control_list.cc ('k') | trunk/src/gpu/config/gpu_control_list_format.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698