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