| 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 #if defined(USE_AURA) | 360 #if defined(USE_AURA) |
| 361 // TODO(gpu): Fix this test in software compositing mode: | 361 // TODO(gpu): Fix this test in software compositing mode: |
| 362 // http://crbug.com/306790. | 362 // http://crbug.com/306790. |
| 363 if (!content::GpuDataManager::GetInstance()->CanUseGpuBrowserCompositor()) | 363 if (!content::GpuDataManager::GetInstance()->CanUseGpuBrowserCompositor()) |
| 364 return; | 364 return; |
| 365 #endif | 365 #endif |
| 366 // Accelerated canvas 2D is not supported on XP. | 366 // Accelerated canvas 2D is not supported on XP. |
| 367 if (gpu::GPUTestBotConfig::CurrentConfigMatches("XP")) | 367 if (gpu::GPUTestBotConfig::CurrentConfigMatches("XP")) |
| 368 return; | 368 return; |
| 369 | 369 |
| 370 bool is_blacklisted = false; | 370 EXPECT_FALSE(GpuDataManager::GetInstance()->IsFeatureBlacklisted( |
| 371 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 371 gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)); |
| 372 // Blacklist rule #24 disables accelerated_2d_canvas on Linux. | |
| 373 // TODO(gab): Enable GPU control lists on Linux. | |
| 374 // is_blacklisted = true; | |
| 375 #elif defined(OS_WIN) | |
| 376 // Blacklist rule #67 disables accelerated_2d_canvas on XP. | |
| 377 if (base::win::GetVersion() < base::win::VERSION_VISTA) | |
| 378 is_blacklisted = true; | |
| 379 #endif | |
| 380 | |
| 381 EXPECT_EQ(is_blacklisted, | |
| 382 GpuDataManager::GetInstance()->IsFeatureBlacklisted( | |
| 383 gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)); | |
| 384 | 372 |
| 385 const base::FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html")); | 373 const base::FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html")); |
| 386 RunEventTest(url, kAcceleratedCanvasCreationEvent, !is_blacklisted); | 374 RunEventTest(url, kAcceleratedCanvasCreationEvent, true); |
| 387 } | 375 } |
| 388 | 376 |
| 389 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, Canvas2DBlocked) { | 377 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, Canvas2DBlocked) { |
| 390 const std::string json_blacklist = | 378 const std::string json_blacklist = |
| 391 "{\n" | 379 "{\n" |
| 392 " \"name\": \"gpu blacklist\",\n" | 380 " \"name\": \"gpu blacklist\",\n" |
| 393 " \"version\": \"1.0\",\n" | 381 " \"version\": \"1.0\",\n" |
| 394 " \"entries\": [\n" | 382 " \"entries\": [\n" |
| 395 " {\n" | 383 " {\n" |
| 396 " \"id\": 1,\n" | 384 " \"id\": 1,\n" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 base::StringPrintf( | 546 base::StringPrintf( |
| 559 "%d (resize offset %d): IOSurface width %d -> %d; Creates %d " | 547 "%d (resize offset %d): IOSurface width %d -> %d; Creates %d " |
| 560 "Expected %d", offset_i, offsets[offset_i], | 548 "Expected %d", offset_i, offsets[offset_i], |
| 561 old_width, new_width, num_creates, expected_creates); | 549 old_width, new_width, num_creates, expected_creates); |
| 562 } | 550 } |
| 563 } | 551 } |
| 564 } | 552 } |
| 565 #endif | 553 #endif |
| 566 | 554 |
| 567 } // namespace | 555 } // namespace |
| OLD | NEW |