| 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/test/trace_event_analyzer.h" | 10 #include "base/test/trace_event_analyzer.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, MAYBE_AcceleratedCompositingAllowed) { | 182 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, MAYBE_AcceleratedCompositingAllowed) { |
| 183 EXPECT_FALSE(GpuDataManager::GetInstance()->IsFeatureBlacklisted( | 183 EXPECT_FALSE(GpuDataManager::GetInstance()->IsFeatureBlacklisted( |
| 184 gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING)); | 184 gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING)); |
| 185 | 185 |
| 186 const base::FilePath url(FILE_PATH_LITERAL("feature_compositing.html")); | 186 const base::FilePath url(FILE_PATH_LITERAL("feature_compositing.html")); |
| 187 RunEventTest(url, kSwapBuffersEvent, true); | 187 RunEventTest(url, kSwapBuffersEvent, true); |
| 188 } | 188 } |
| 189 | 189 |
| 190 class AcceleratedCompositingBlockedTest : public GpuFeatureTest { | 190 class AcceleratedCompositingBlockedTest : public GpuFeatureTest { |
| 191 public: | 191 public: |
| 192 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 192 virtual void SetUpOnMainThread() OVERRIDE { |
| 193 GpuFeatureTest::SetUpInProcessBrowserTestFixture(); | 193 GpuFeatureTest::SetUpOnMainThread(); |
| 194 const std::string json_blacklist = | 194 const std::string json_blacklist = |
| 195 "{\n" | 195 "{\n" |
| 196 " \"name\": \"gpu blacklist\",\n" | 196 " \"name\": \"gpu blacklist\",\n" |
| 197 " \"version\": \"1.0\",\n" | 197 " \"version\": \"1.0\",\n" |
| 198 " \"entries\": [\n" | 198 " \"entries\": [\n" |
| 199 " {\n" | 199 " {\n" |
| 200 " \"id\": 1,\n" | 200 " \"id\": 1,\n" |
| 201 " \"features\": [\n" | 201 " \"features\": [\n" |
| 202 " \"accelerated_compositing\"\n" | 202 " \"accelerated_compositing\"\n" |
| 203 " ]\n" | 203 " ]\n" |
| 204 " }\n" | 204 " }\n" |
| 205 " ]\n" | 205 " ]\n" |
| 206 "}"; | 206 "}"; |
| 207 SetupBlacklist(json_blacklist); | 207 SetupBlacklist(json_blacklist); |
| 208 } | 208 } |
| 209 }; | 209 }; |
| 210 | 210 |
| 211 #if defined(USE_AURA) | 211 #if defined(USE_AURA) |
| 212 // Compositing is always on for Aura. | 212 // Compositing is always on for Aura. |
| 213 #define MAYBE_AcceleratedCompositingBlocked DISABLED_AcceleratedCompositingBlock
ed | 213 #define MAYBE_AcceleratedCompositingBlocked DISABLED_AcceleratedCompositingBlock
ed |
| 214 #else | 214 #else |
| 215 #define MAYBE_AcceleratedCompositingBlocked AcceleratedCompositingBlocked | 215 #define MAYBE_AcceleratedCompositingBlocked AcceleratedCompositingBlocked |
| 216 #endif | 216 #endif |
| 217 | 217 |
| 218 IN_PROC_BROWSER_TEST_F(AcceleratedCompositingBlockedTest, | 218 IN_PROC_BROWSER_TEST_F(AcceleratedCompositingBlockedTest, |
| 219 MAYBE_AcceleratedCompositingBlocked) { | 219 MAYBE_AcceleratedCompositingBlocked) { |
| 220 EXPECT_TRUE(GpuDataManager::GetInstance()->IsFeatureBlacklisted( | 220 EXPECT_TRUE(GpuDataManager::GetInstance()->IsFeatureBlacklisted( |
| 221 gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING)); | 221 gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING)); |
| 222 | 222 |
| 223 const base::FilePath url(FILE_PATH_LITERAL("feature_compositing.html")); | 223 const base::FilePath url(FILE_PATH_LITERAL("feature_compositing.html")); |
| 224 RunEventTest(url, kSwapBuffersEvent, false); | 224 RunEventTest(url, kSwapBuffersEvent, false); |
| 225 } | 225 } |
| 226 | 226 |
| 227 class AcceleratedCompositingTest : public GpuFeatureTest { | 227 class AcceleratedCompositingTest : public GpuFeatureTest { |
| 228 public: | 228 public: |
| 229 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 229 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 | 359 |
| 360 const base::FilePath url(FILE_PATH_LITERAL("feature_multisampling.html")); | 360 const base::FilePath url(FILE_PATH_LITERAL("feature_multisampling.html")); |
| 361 RunTest(url, "\"FALSE\"", true); | 361 RunTest(url, "\"FALSE\"", true); |
| 362 } | 362 } |
| 363 | 363 |
| 364 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, Canvas2DAllowed) { | 364 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, Canvas2DAllowed) { |
| 365 // Accelerated canvas 2D is not supported on XP. | 365 // Accelerated canvas 2D is not supported on XP. |
| 366 if (gpu::GPUTestBotConfig::CurrentConfigMatches("XP")) | 366 if (gpu::GPUTestBotConfig::CurrentConfigMatches("XP")) |
| 367 return; | 367 return; |
| 368 | 368 |
| 369 EXPECT_FALSE(GpuDataManager::GetInstance()->IsFeatureBlacklisted( | 369 bool is_blacklisted = false; |
| 370 gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)); | 370 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 371 // Blacklist rule #24 disables accelerated_2d_canvas on Linux. |
| 372 is_blacklisted = true; |
| 373 #endif |
| 374 |
| 375 EXPECT_EQ(is_blacklisted, |
| 376 GpuDataManager::GetInstance()->IsFeatureBlacklisted( |
| 377 gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)); |
| 371 | 378 |
| 372 const base::FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html")); | 379 const base::FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html")); |
| 373 RunEventTest(url, kAcceleratedCanvasCreationEvent, true); | 380 RunEventTest(url, kAcceleratedCanvasCreationEvent, !is_blacklisted); |
| 374 } | 381 } |
| 375 | 382 |
| 376 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, Canvas2DBlocked) { | 383 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, Canvas2DBlocked) { |
| 377 const std::string json_blacklist = | 384 const std::string json_blacklist = |
| 378 "{\n" | 385 "{\n" |
| 379 " \"name\": \"gpu blacklist\",\n" | 386 " \"name\": \"gpu blacklist\",\n" |
| 380 " \"version\": \"1.0\",\n" | 387 " \"version\": \"1.0\",\n" |
| 381 " \"entries\": [\n" | 388 " \"entries\": [\n" |
| 382 " {\n" | 389 " {\n" |
| 383 " \"id\": 1,\n" | 390 " \"id\": 1,\n" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 base::StringPrintf( | 552 base::StringPrintf( |
| 546 "%d (resize offset %d): IOSurface width %d -> %d; Creates %d " | 553 "%d (resize offset %d): IOSurface width %d -> %d; Creates %d " |
| 547 "Expected %d", offset_i, offsets[offset_i], | 554 "Expected %d", offset_i, offsets[offset_i], |
| 548 old_width, new_width, num_creates, expected_creates); | 555 old_width, new_width, num_creates, expected_creates); |
| 549 } | 556 } |
| 550 } | 557 } |
| 551 } | 558 } |
| 552 #endif | 559 #endif |
| 553 | 560 |
| 554 } // namespace | 561 } // namespace |
| OLD | NEW |