| 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/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/test/trace_event_analyzer.h" | 10 #include "base/test/trace_event_analyzer.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 using content::GpuFeatureType; | 37 using content::GpuFeatureType; |
| 38 using trace_analyzer::Query; | 38 using trace_analyzer::Query; |
| 39 using trace_analyzer::TraceAnalyzer; | 39 using trace_analyzer::TraceAnalyzer; |
| 40 using trace_analyzer::TraceEventVector; | 40 using trace_analyzer::TraceEventVector; |
| 41 | 41 |
| 42 namespace { | 42 namespace { |
| 43 | 43 |
| 44 const char kSwapBuffersEvent[] = "SwapBuffers"; | 44 const char kSwapBuffersEvent[] = "SwapBuffers"; |
| 45 const char kAcceleratedCanvasCreationEvent[] = "Canvas2DLayerBridgeCreation"; | 45 const char kAcceleratedCanvasCreationEvent[] = "Canvas2DLayerBridgeCreation"; |
| 46 const char kWebGLCreationEvent[] = "DrawingBufferCreation"; | 46 const char kWebGLCreationEvent[] = "DrawingBufferCreation"; |
| 47 const char kThreadedCompositingEvent[] = "ThreadedCompositingInitialization"; | |
| 48 | 47 |
| 49 class GpuFeatureTest : public InProcessBrowserTest { | 48 class GpuFeatureTest : public InProcessBrowserTest { |
| 50 public: | 49 public: |
| 51 GpuFeatureTest() : trace_categories_("test_gpu"), gpu_enabled_(false) {} | 50 GpuFeatureTest() : trace_categories_("test_gpu"), gpu_enabled_(false) {} |
| 52 | 51 |
| 53 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 52 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 54 FilePath test_dir; | 53 FilePath test_dir; |
| 55 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); | 54 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); |
| 56 gpu_test_dir_ = test_dir.AppendASCII("gpu"); | 55 gpu_test_dir_ = test_dir.AppendASCII("gpu"); |
| 57 } | 56 } |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 GpuFeatureType type = | 226 GpuFeatureType type = |
| 228 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); | 227 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); |
| 229 type = IgnoreGpuFeatures(type); | 228 type = IgnoreGpuFeatures(type); |
| 230 | 229 |
| 231 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING); | 230 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING); |
| 232 | 231 |
| 233 const FilePath url(FILE_PATH_LITERAL("feature_compositing.html")); | 232 const FilePath url(FILE_PATH_LITERAL("feature_compositing.html")); |
| 234 RunEventTest(url, kSwapBuffersEvent, false); | 233 RunEventTest(url, kSwapBuffersEvent, false); |
| 235 } | 234 } |
| 236 | 235 |
| 237 #if !(defined(OS_WIN) && defined(USE_AURA)) // http://crbug.com/163046 | |
| 238 | |
| 239 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, ThreadedCompositingTextureSharing) { | |
| 240 const std::string json_blacklist = | |
| 241 "{\n" | |
| 242 " \"name\": \"gpu blacklist\",\n" | |
| 243 " \"version\": \"1.0\",\n" | |
| 244 " \"entries\": [\n" | |
| 245 " {\n" | |
| 246 " \"id\": 1,\n" | |
| 247 " \"blacklist\": [\n" | |
| 248 " \"texture_sharing\"\n" | |
| 249 " ]\n" | |
| 250 " }\n" | |
| 251 " ]\n" | |
| 252 "}"; | |
| 253 SetupBlacklist(json_blacklist); | |
| 254 GpuFeatureType type = | |
| 255 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); | |
| 256 type = IgnoreGpuFeatures(type); | |
| 257 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_TEXTURE_SHARING); | |
| 258 | |
| 259 const FilePath url(FILE_PATH_LITERAL("feature_compositing.html")); | |
| 260 RunEventTest(url, kThreadedCompositingEvent, false); | |
| 261 } | |
| 262 | |
| 263 #endif | |
| 264 | |
| 265 class AcceleratedCompositingTest : public GpuFeatureTest { | 236 class AcceleratedCompositingTest : public GpuFeatureTest { |
| 266 public: | 237 public: |
| 267 virtual void SetUpCommandLine(CommandLine* command_line) { | 238 virtual void SetUpCommandLine(CommandLine* command_line) { |
| 268 GpuFeatureTest::SetUpCommandLine(command_line); | 239 GpuFeatureTest::SetUpCommandLine(command_line); |
| 269 command_line->AppendSwitch(switches::kDisableAcceleratedCompositing); | 240 command_line->AppendSwitch(switches::kDisableAcceleratedCompositing); |
| 270 } | 241 } |
| 271 }; | 242 }; |
| 272 | 243 |
| 273 #if defined(OS_WIN) && defined(USE_AURA) | 244 #if defined(OS_WIN) && defined(USE_AURA) |
| 274 // Compositing is always on for Windows Aura. | 245 // Compositing is always on for Windows Aura. |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 base::StringPrintf( | 561 base::StringPrintf( |
| 591 "%d (resize offset %d): IOSurface width %d -> %d; Creates %d " | 562 "%d (resize offset %d): IOSurface width %d -> %d; Creates %d " |
| 592 "Expected %d", offset_i, offsets[offset_i], | 563 "Expected %d", offset_i, offsets[offset_i], |
| 593 old_width, new_width, num_creates, expected_creates); | 564 old_width, new_width, num_creates, expected_creates); |
| 594 } | 565 } |
| 595 } | 566 } |
| 596 } | 567 } |
| 597 #endif | 568 #endif |
| 598 | 569 |
| 599 } // namespace anonymous | 570 } // namespace anonymous |
| OLD | NEW |