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"; |
47 | 48 |
48 class GpuFeatureTest : public InProcessBrowserTest { | 49 class GpuFeatureTest : public InProcessBrowserTest { |
49 public: | 50 public: |
50 GpuFeatureTest() : trace_categories_("test_gpu"), gpu_enabled_(false) {} | 51 GpuFeatureTest() : trace_categories_("test_gpu"), gpu_enabled_(false) {} |
51 | 52 |
52 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 53 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
53 FilePath test_dir; | 54 FilePath test_dir; |
54 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); | 55 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); |
55 gpu_test_dir_ = test_dir.AppendASCII("gpu"); | 56 gpu_test_dir_ = test_dir.AppendASCII("gpu"); |
56 } | 57 } |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 GpuFeatureType type = | 220 GpuFeatureType type = |
220 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); | 221 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); |
221 type = IgnoreGpuFeatures(type); | 222 type = IgnoreGpuFeatures(type); |
222 | 223 |
223 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING); | 224 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING); |
224 | 225 |
225 const FilePath url(FILE_PATH_LITERAL("feature_compositing.html")); | 226 const FilePath url(FILE_PATH_LITERAL("feature_compositing.html")); |
226 RunEventTest(url, kSwapBuffersEvent, false); | 227 RunEventTest(url, kSwapBuffersEvent, false); |
227 } | 228 } |
228 | 229 |
| 230 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, ThreadedCompositingTextureSharing) { |
| 231 const std::string json_blacklist = |
| 232 "{\n" |
| 233 " \"name\": \"gpu blacklist\",\n" |
| 234 " \"version\": \"1.0\",\n" |
| 235 " \"entries\": [\n" |
| 236 " {\n" |
| 237 " \"id\": 1,\n" |
| 238 " \"blacklist\": [\n" |
| 239 " \"texture_sharing\"\n" |
| 240 " ]\n" |
| 241 " }\n" |
| 242 " ]\n" |
| 243 "}"; |
| 244 SetupBlacklist(json_blacklist); |
| 245 GpuFeatureType type = |
| 246 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); |
| 247 type = IgnoreGpuFeatures(type); |
| 248 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_TEXTURE_SHARING); |
| 249 |
| 250 const FilePath url(FILE_PATH_LITERAL("feature_compositing.html")); |
| 251 RunEventTest(url, kThreadedCompositingEvent, false); |
| 252 } |
| 253 |
229 class AcceleratedCompositingTest : public GpuFeatureTest { | 254 class AcceleratedCompositingTest : public GpuFeatureTest { |
230 public: | 255 public: |
231 virtual void SetUpCommandLine(CommandLine* command_line) { | 256 virtual void SetUpCommandLine(CommandLine* command_line) { |
232 GpuFeatureTest::SetUpCommandLine(command_line); | 257 GpuFeatureTest::SetUpCommandLine(command_line); |
233 command_line->AppendSwitch(switches::kDisableAcceleratedCompositing); | 258 command_line->AppendSwitch(switches::kDisableAcceleratedCompositing); |
234 } | 259 } |
235 }; | 260 }; |
236 | 261 |
237 IN_PROC_BROWSER_TEST_F(AcceleratedCompositingTest, | 262 IN_PROC_BROWSER_TEST_F(AcceleratedCompositingTest, |
238 AcceleratedCompositingDisabled) { | 263 AcceleratedCompositingDisabled) { |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 base::StringPrintf( | 564 base::StringPrintf( |
540 "%d (resize offset %d): IOSurface width %d -> %d; Creates %d " | 565 "%d (resize offset %d): IOSurface width %d -> %d; Creates %d " |
541 "Expected %d", offset_i, offsets[offset_i], | 566 "Expected %d", offset_i, offsets[offset_i], |
542 old_width, new_width, num_creates, expected_creates); | 567 old_width, new_width, num_creates, expected_creates); |
543 } | 568 } |
544 } | 569 } |
545 } | 570 } |
546 #endif | 571 #endif |
547 | 572 |
548 } // namespace anonymous | 573 } // namespace anonymous |
OLD | NEW |