| OLD | NEW |
| 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 "base/message_loop.h" | 5 #include "base/message_loop.h" |
| 6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
| 7 #include "base/time.h" | 7 #include "base/time.h" |
| 8 #include "content/browser/gpu/gpu_data_manager_impl.h" | 8 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 9 #include "content/public/browser/gpu_data_manager_observer.h" | 9 #include "content/public/browser/gpu_data_manager_observer.h" |
| 10 #include "content/public/common/gpu_info.h" | 10 #include "content/public/common/gpu_info.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 EXPECT_EQ(0, manager->GetBlacklistedFeatures()); | 110 EXPECT_EQ(0, manager->GetBlacklistedFeatures()); |
| 111 EXPECT_TRUE(manager->GpuAccessAllowed()); | 111 EXPECT_TRUE(manager->GpuAccessAllowed()); |
| 112 | 112 |
| 113 const std::string blacklist_json = | 113 const std::string blacklist_json = |
| 114 "{\n" | 114 "{\n" |
| 115 " \"name\": \"gpu blacklist\",\n" | 115 " \"name\": \"gpu blacklist\",\n" |
| 116 " \"version\": \"0.1\",\n" | 116 " \"version\": \"0.1\",\n" |
| 117 " \"entries\": [\n" | 117 " \"entries\": [\n" |
| 118 " {\n" | 118 " {\n" |
| 119 " \"id\": 1,\n" | 119 " \"id\": 1,\n" |
| 120 " \"blacklist\": [\n" | 120 " \"features\": [\n" |
| 121 " \"webgl\"\n" | 121 " \"webgl\"\n" |
| 122 " ]\n" | 122 " ]\n" |
| 123 " },\n" | 123 " },\n" |
| 124 " {\n" | 124 " {\n" |
| 125 " \"id\": 2,\n" | 125 " \"id\": 2,\n" |
| 126 " \"gl_renderer\": {\n" | 126 " \"gl_renderer\": {\n" |
| 127 " \"op\": \"contains\",\n" | 127 " \"op\": \"contains\",\n" |
| 128 " \"value\": \"GeForce\"\n" | 128 " \"value\": \"GeForce\"\n" |
| 129 " },\n" | 129 " },\n" |
| 130 " \"blacklist\": [\n" | 130 " \"features\": [\n" |
| 131 " \"accelerated_2d_canvas\"\n" | 131 " \"accelerated_2d_canvas\"\n" |
| 132 " ]\n" | 132 " ]\n" |
| 133 " }\n" | 133 " }\n" |
| 134 " ]\n" | 134 " ]\n" |
| 135 "}"; | 135 "}"; |
| 136 | 136 |
| 137 GPUInfo gpu_info; | 137 GPUInfo gpu_info; |
| 138 gpu_info.gpu.vendor_id = 0x10de; | 138 gpu_info.gpu.vendor_id = 0x10de; |
| 139 gpu_info.gpu.device_id = 0x0640; | 139 gpu_info.gpu.device_id = 0x0640; |
| 140 manager->InitializeForTesting(blacklist_json, gpu_info); | 140 manager->InitializeForTesting(blacklist_json, gpu_info); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 165 " {\n" | 165 " {\n" |
| 166 " \"id\": 1,\n" | 166 " \"id\": 1,\n" |
| 167 " \"exceptions\": [\n" | 167 " \"exceptions\": [\n" |
| 168 " {\n" | 168 " {\n" |
| 169 " \"gl_renderer\": {\n" | 169 " \"gl_renderer\": {\n" |
| 170 " \"op\": \"contains\",\n" | 170 " \"op\": \"contains\",\n" |
| 171 " \"value\": \"GeForce\"\n" | 171 " \"value\": \"GeForce\"\n" |
| 172 " }\n" | 172 " }\n" |
| 173 " }\n" | 173 " }\n" |
| 174 " ],\n" | 174 " ],\n" |
| 175 " \"blacklist\": [\n" | 175 " \"features\": [\n" |
| 176 " \"webgl\"\n" | 176 " \"webgl\"\n" |
| 177 " ]\n" | 177 " ]\n" |
| 178 " }\n" | 178 " }\n" |
| 179 " ]\n" | 179 " ]\n" |
| 180 "}"; | 180 "}"; |
| 181 | 181 |
| 182 GPUInfo gpu_info; | 182 GPUInfo gpu_info; |
| 183 gpu_info.gpu.vendor_id = 0x10de; | 183 gpu_info.gpu.vendor_id = 0x10de; |
| 184 gpu_info.gpu.device_id = 0x0640; | 184 gpu_info.gpu.device_id = 0x0640; |
| 185 manager->InitializeForTesting(blacklist_json, gpu_info); | 185 manager->InitializeForTesting(blacklist_json, gpu_info); |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 " \"vendor_id\": \"0x8086\",\n" | 472 " \"vendor_id\": \"0x8086\",\n" |
| 473 " \"exceptions\": [\n" | 473 " \"exceptions\": [\n" |
| 474 " {\n" | 474 " {\n" |
| 475 " \"device_id\": [\"0x0042\"],\n" | 475 " \"device_id\": [\"0x0042\"],\n" |
| 476 " \"driver_version\": {\n" | 476 " \"driver_version\": {\n" |
| 477 " \"op\": \">=\",\n" | 477 " \"op\": \">=\",\n" |
| 478 " \"number\": \"8.0.2\"\n" | 478 " \"number\": \"8.0.2\"\n" |
| 479 " }\n" | 479 " }\n" |
| 480 " }\n" | 480 " }\n" |
| 481 " ],\n" | 481 " ],\n" |
| 482 " \"blacklist\": [\n" | 482 " \"features\": [\n" |
| 483 " \"webgl\"\n" | 483 " \"webgl\"\n" |
| 484 " ]\n" | 484 " ]\n" |
| 485 " }\n" | 485 " }\n" |
| 486 " ]\n" | 486 " ]\n" |
| 487 "}"; | 487 "}"; |
| 488 | 488 |
| 489 GPUInfo gpu_info; | 489 GPUInfo gpu_info; |
| 490 gpu_info.gpu.vendor_id = 0x8086; | 490 gpu_info.gpu.vendor_id = 0x8086; |
| 491 gpu_info.gpu.device_id = 0x0042; | 491 gpu_info.gpu.device_id = 0x0042; |
| 492 manager->InitializeForTesting(blacklist_json, gpu_info); | 492 manager->InitializeForTesting(blacklist_json, gpu_info); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 " \"vendor_id\": \"0x8086\",\n" | 525 " \"vendor_id\": \"0x8086\",\n" |
| 526 " \"exceptions\": [\n" | 526 " \"exceptions\": [\n" |
| 527 " {\n" | 527 " {\n" |
| 528 " \"device_id\": [\"0x0042\"],\n" | 528 " \"device_id\": [\"0x0042\"],\n" |
| 529 " \"driver_version\": {\n" | 529 " \"driver_version\": {\n" |
| 530 " \"op\": \">=\",\n" | 530 " \"op\": \">=\",\n" |
| 531 " \"number\": \"8.0.2\"\n" | 531 " \"number\": \"8.0.2\"\n" |
| 532 " }\n" | 532 " }\n" |
| 533 " }\n" | 533 " }\n" |
| 534 " ],\n" | 534 " ],\n" |
| 535 " \"blacklist\": [\n" | 535 " \"features\": [\n" |
| 536 " \"webgl\"\n" | 536 " \"webgl\"\n" |
| 537 " ]\n" | 537 " ]\n" |
| 538 " }\n" | 538 " }\n" |
| 539 " ]\n" | 539 " ]\n" |
| 540 "}"; | 540 "}"; |
| 541 | 541 |
| 542 GPUInfo gpu_info; | 542 GPUInfo gpu_info; |
| 543 gpu_info.gpu.vendor_id = 0x8086; | 543 gpu_info.gpu.vendor_id = 0x8086; |
| 544 gpu_info.gpu.device_id = 0x0042; | 544 gpu_info.gpu.device_id = 0x0042; |
| 545 gpu_info.gl_vendor = kGLVendorMesa; | 545 gpu_info.gl_vendor = kGLVendorMesa; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 556 // Now assume browser gets GL strings from local state. | 556 // Now assume browser gets GL strings from local state. |
| 557 // SetGLStrings() has no effects because GPUInfo already got these strings. | 557 // SetGLStrings() has no effects because GPUInfo already got these strings. |
| 558 // (Otherwise the entry should not apply.) | 558 // (Otherwise the entry should not apply.) |
| 559 manager->SetGLStrings(kGLVendorMesa, kGLRendererMesa, kGLVersionMesa802); | 559 manager->SetGLStrings(kGLVendorMesa, kGLRendererMesa, kGLVersionMesa802); |
| 560 EXPECT_TRUE(manager->GpuAccessAllowed()); | 560 EXPECT_TRUE(manager->GpuAccessAllowed()); |
| 561 EXPECT_EQ(GPU_FEATURE_TYPE_WEBGL, manager->GetBlacklistedFeatures()); | 561 EXPECT_EQ(GPU_FEATURE_TYPE_WEBGL, manager->GetBlacklistedFeatures()); |
| 562 } | 562 } |
| 563 #endif // OS_LINUX | 563 #endif // OS_LINUX |
| 564 | 564 |
| 565 } // namespace content | 565 } // namespace content |
| OLD | NEW |