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

Unified Diff: content/browser/gpu/gpu_data_manager_impl_private_unittest.cc

Issue 1547793004: Make gpu black list work again on Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Execute todo, send IPC directly from gpu_benchmarking_extension.cc and fixes variable names. Created 4 years, 10 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
Index: content/browser/gpu/gpu_data_manager_impl_private_unittest.cc
diff --git a/content/browser/gpu/gpu_data_manager_impl_private_unittest.cc b/content/browser/gpu/gpu_data_manager_impl_private_unittest.cc
index 321359626755e8cd7c6c9ef3a3a6205688608d98..e98046cf2f05b32ef4b96996c298591635cf9da3 100644
--- a/content/browser/gpu/gpu_data_manager_impl_private_unittest.cc
+++ b/content/browser/gpu/gpu_data_manager_impl_private_unittest.cc
@@ -233,6 +233,7 @@ TEST_F(GpuDataManagerImplPrivateTest, GpuSideExceptions) {
TEST_F(GpuDataManagerImplPrivateTest, DisableHardwareAcceleration) {
ScopedGpuDataManagerImplPrivate manager;
+ manager->InitializeForTesting("", gpu::GPUInfo());
EXPECT_EQ(0u, manager->GetBlacklistedFeatureCount());
std::string reason;
EXPECT_TRUE(manager->GpuAccessAllowed(&reason));
@@ -248,6 +249,7 @@ TEST_F(GpuDataManagerImplPrivateTest, DisableHardwareAcceleration) {
TEST_F(GpuDataManagerImplPrivateTest, SwiftShaderRendering) {
// Blacklist, then register SwiftShader.
ScopedGpuDataManagerImplPrivate manager;
+ manager->InitializeForTesting("", gpu::GPUInfo());
EXPECT_EQ(0u, manager->GetBlacklistedFeatureCount());
EXPECT_TRUE(manager->GpuAccessAllowed(NULL));
EXPECT_FALSE(manager->ShouldUseSwiftShader());
@@ -270,6 +272,7 @@ TEST_F(GpuDataManagerImplPrivateTest, SwiftShaderRendering) {
TEST_F(GpuDataManagerImplPrivateTest, SwiftShaderRendering2) {
// Register SwiftShader, then blacklist.
ScopedGpuDataManagerImplPrivate manager;
+ manager->InitializeForTesting("", gpu::GPUInfo());
EXPECT_EQ(0u, manager->GetBlacklistedFeatureCount());
EXPECT_TRUE(manager->GpuAccessAllowed(NULL));
EXPECT_FALSE(manager->ShouldUseSwiftShader());
@@ -311,6 +314,7 @@ TEST_F(GpuDataManagerImplPrivateTest, GpuInfoUpdate) {
TEST_F(GpuDataManagerImplPrivateTest, NoGpuInfoUpdateWithSwiftShader) {
ScopedGpuDataManagerImpl manager;
+ manager->InitializeForTesting("", gpu::GPUInfo());
manager->DisableHardwareAcceleration();
const base::FilePath test_path(FILE_PATH_LITERAL("AnyPath"));
@@ -593,6 +597,43 @@ TEST_F(GpuDataManagerImplPrivateTest, SetGLStringsNoEffects) {
EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount());
EXPECT_TRUE(manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL));
}
+
+TEST_F(GpuDataManagerImplPrivateTest, SetGLStringsDefered) {
+ const char* kGLVendorMesa = "Tungsten Graphics, Inc";
+ const char* kGLRendererMesa = "Mesa DRI Intel(R) G41";
+ const char* kGLVersionMesa801 = "2.1 Mesa 8.0.1-DEVEL";
+
+ ScopedGpuDataManagerImplPrivate manager;
+ EXPECT_EQ(0u, manager->GetBlacklistedFeatureCount());
+ EXPECT_TRUE(manager->GpuAccessAllowed(NULL));
+
+ const std::string blacklist_json = LONG_STRING_CONST({
+ "name" : "gpu blacklist",
+ "version" : "0.1",
+ "entries" : [ {
+ "id" : 1,
+ "vendor_id" : "0x8086",
+ "device_id" : ["0x0042"],
+ "driver_vendor" : "Mesa",
+ "driver_version" : {"op" : ">=", "value" : "8.0.0"},
+ "features" : ["webgl"]
+ } ]
+ });
+
+ // Check that it is allowed to call SetGLStrings before Initialize.
+
+ // Assume browser gets GL strings from local state.
+ manager->SetGLStrings(kGLVendorMesa, kGLRendererMesa, kGLVersionMesa801);
+
+ gpu::GPUInfo gpu_info;
+ gpu_info.gpu.vendor_id = 0x8086;
+ gpu_info.gpu.device_id = 0x0042;
+ manager->InitializeForTesting(blacklist_json, gpu_info);
+
+ EXPECT_TRUE(manager->GpuAccessAllowed(NULL));
+ EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount());
+ EXPECT_TRUE(manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL));
+}
#endif // OS_LINUX
TEST_F(GpuDataManagerImplPrivateTest, GpuDriverBugListSingle) {
« no previous file with comments | « content/browser/gpu/gpu_data_manager_impl_private.cc ('k') | content/browser/renderer_host/gpu_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698