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 11 matching lines...) Expand all Loading... |
22 #include "content/public/common/gpu_info.h" | 22 #include "content/public/common/gpu_info.h" |
23 #include "content/test/gpu/gpu_test_config.h" | 23 #include "content/test/gpu/gpu_test_config.h" |
24 #include "content/test/gpu/test_switches.h" | 24 #include "content/test/gpu/test_switches.h" |
25 #include "net/base/net_util.h" | 25 #include "net/base/net_util.h" |
26 #include "ui/gl/gl_switches.h" | 26 #include "ui/gl/gl_switches.h" |
27 #include "ui/compositor/compositor_setup.h" | 27 #include "ui/compositor/compositor_setup.h" |
28 #if defined(OS_MACOSX) | 28 #if defined(OS_MACOSX) |
29 #include "ui/surface/io_surface_support_mac.h" | 29 #include "ui/surface/io_surface_support_mac.h" |
30 #endif | 30 #endif |
31 | 31 |
| 32 #if defined(OS_WIN) |
| 33 #include "base/win/windows_version.h" |
| 34 #endif |
| 35 |
32 using content::GpuDataManager; | 36 using content::GpuDataManager; |
33 using content::GpuFeatureType; | 37 using content::GpuFeatureType; |
34 using trace_analyzer::Query; | 38 using trace_analyzer::Query; |
35 using trace_analyzer::TraceAnalyzer; | 39 using trace_analyzer::TraceAnalyzer; |
36 using trace_analyzer::TraceEventVector; | 40 using trace_analyzer::TraceEventVector; |
37 | 41 |
38 namespace { | 42 namespace { |
39 | 43 |
40 typedef uint32 GpuResultFlags; | 44 typedef uint32 GpuResultFlags; |
41 #define EXPECT_NO_GPU_SWAP_BUFFERS GpuResultFlags(1<<0) | 45 #define EXPECT_NO_GPU_SWAP_BUFFERS GpuResultFlags(1<<0) |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 174 |
171 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, AcceleratedCompositingAllowed) { | 175 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, AcceleratedCompositingAllowed) { |
172 GpuFeatureType type = | 176 GpuFeatureType type = |
173 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); | 177 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); |
174 EXPECT_EQ(type, 0); | 178 EXPECT_EQ(type, 0); |
175 | 179 |
176 const FilePath url(FILE_PATH_LITERAL("feature_compositing.html")); | 180 const FilePath url(FILE_PATH_LITERAL("feature_compositing.html")); |
177 RunTest(url, EXPECT_GPU_SWAP_BUFFERS); | 181 RunTest(url, EXPECT_GPU_SWAP_BUFFERS); |
178 } | 182 } |
179 | 183 |
| 184 // Flash Stage3D may be blacklisted for other reasons on XP, so ignore it. |
| 185 GpuFeatureType IgnoreGpuFeatures(GpuFeatureType type) { |
| 186 #if defined(OS_WIN) |
| 187 if (base::win::GetVersion() < base::win::VERSION_VISTA) |
| 188 return static_cast<GpuFeatureType>(type & |
| 189 ~content::GPU_FEATURE_TYPE_FLASH_STAGE3D); |
| 190 #endif |
| 191 return type; |
| 192 } |
| 193 |
180 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, AcceleratedCompositingBlocked) { | 194 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, AcceleratedCompositingBlocked) { |
181 const std::string json_blacklist = | 195 const std::string json_blacklist = |
182 "{\n" | 196 "{\n" |
183 " \"name\": \"gpu blacklist\",\n" | 197 " \"name\": \"gpu blacklist\",\n" |
184 " \"version\": \"1.0\",\n" | 198 " \"version\": \"1.0\",\n" |
185 " \"entries\": [\n" | 199 " \"entries\": [\n" |
186 " {\n" | 200 " {\n" |
187 " \"id\": 1,\n" | 201 " \"id\": 1,\n" |
188 " \"blacklist\": [\n" | 202 " \"blacklist\": [\n" |
189 " \"accelerated_compositing\"\n" | 203 " \"accelerated_compositing\"\n" |
190 " ]\n" | 204 " ]\n" |
191 " }\n" | 205 " }\n" |
192 " ]\n" | 206 " ]\n" |
193 "}"; | 207 "}"; |
194 SetupBlacklist(json_blacklist); | 208 SetupBlacklist(json_blacklist); |
195 GpuFeatureType type = | 209 GpuFeatureType type = |
196 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); | 210 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); |
| 211 type = IgnoreGpuFeatures(type); |
197 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING); | 212 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING); |
198 | 213 |
199 const FilePath url(FILE_PATH_LITERAL("feature_compositing.html")); | 214 const FilePath url(FILE_PATH_LITERAL("feature_compositing.html")); |
200 RunTest(url, EXPECT_NO_GPU_SWAP_BUFFERS); | 215 RunTest(url, EXPECT_NO_GPU_SWAP_BUFFERS); |
201 } | 216 } |
202 | 217 |
203 class AcceleratedCompositingTest : public GpuFeatureTest { | 218 class AcceleratedCompositingTest : public GpuFeatureTest { |
204 public: | 219 public: |
205 virtual void SetUpCommandLine(CommandLine* command_line) { | 220 virtual void SetUpCommandLine(CommandLine* command_line) { |
206 GpuFeatureTest::SetUpCommandLine(command_line); | 221 GpuFeatureTest::SetUpCommandLine(command_line); |
(...skipping 26 matching lines...) Expand all Loading... |
233 " \"id\": 1,\n" | 248 " \"id\": 1,\n" |
234 " \"blacklist\": [\n" | 249 " \"blacklist\": [\n" |
235 " \"webgl\"\n" | 250 " \"webgl\"\n" |
236 " ]\n" | 251 " ]\n" |
237 " }\n" | 252 " }\n" |
238 " ]\n" | 253 " ]\n" |
239 "}"; | 254 "}"; |
240 SetupBlacklist(json_blacklist); | 255 SetupBlacklist(json_blacklist); |
241 GpuFeatureType type = | 256 GpuFeatureType type = |
242 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); | 257 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); |
| 258 type = IgnoreGpuFeatures(type); |
243 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL); | 259 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL); |
244 | 260 |
245 const FilePath url(FILE_PATH_LITERAL("feature_webgl.html")); | 261 const FilePath url(FILE_PATH_LITERAL("feature_webgl.html")); |
246 RunTest(url, EXPECT_NO_GPU_SWAP_BUFFERS); | 262 RunTest(url, EXPECT_NO_GPU_SWAP_BUFFERS); |
247 } | 263 } |
248 | 264 |
249 class WebGLTest : public GpuFeatureTest { | 265 class WebGLTest : public GpuFeatureTest { |
250 public: | 266 public: |
251 virtual void SetUpCommandLine(CommandLine* command_line) { | 267 virtual void SetUpCommandLine(CommandLine* command_line) { |
252 GpuFeatureTest::SetUpCommandLine(command_line); | 268 GpuFeatureTest::SetUpCommandLine(command_line); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 " \"id\": 1,\n" | 315 " \"id\": 1,\n" |
300 " \"blacklist\": [\n" | 316 " \"blacklist\": [\n" |
301 " \"multisampling\"\n" | 317 " \"multisampling\"\n" |
302 " ]\n" | 318 " ]\n" |
303 " }\n" | 319 " }\n" |
304 " ]\n" | 320 " ]\n" |
305 "}"; | 321 "}"; |
306 SetupBlacklist(json_blacklist); | 322 SetupBlacklist(json_blacklist); |
307 GpuFeatureType type = | 323 GpuFeatureType type = |
308 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); | 324 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); |
| 325 type = IgnoreGpuFeatures(type); |
309 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_MULTISAMPLING); | 326 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_MULTISAMPLING); |
310 | 327 |
311 const FilePath url(FILE_PATH_LITERAL("feature_multisampling.html")); | 328 const FilePath url(FILE_PATH_LITERAL("feature_multisampling.html")); |
312 RunTest(url, "\"FALSE\"", true); | 329 RunTest(url, "\"FALSE\"", true); |
313 } | 330 } |
314 | 331 |
315 class WebGLMultisamplingTest : public GpuFeatureTest { | 332 class WebGLMultisamplingTest : public GpuFeatureTest { |
316 public: | 333 public: |
317 virtual void SetUpCommandLine(CommandLine* command_line) { | 334 virtual void SetUpCommandLine(CommandLine* command_line) { |
318 GpuFeatureTest::SetUpCommandLine(command_line); | 335 GpuFeatureTest::SetUpCommandLine(command_line); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 " \"id\": 1,\n" | 369 " \"id\": 1,\n" |
353 " \"blacklist\": [\n" | 370 " \"blacklist\": [\n" |
354 " \"accelerated_2d_canvas\"\n" | 371 " \"accelerated_2d_canvas\"\n" |
355 " ]\n" | 372 " ]\n" |
356 " }\n" | 373 " }\n" |
357 " ]\n" | 374 " ]\n" |
358 "}"; | 375 "}"; |
359 SetupBlacklist(json_blacklist); | 376 SetupBlacklist(json_blacklist); |
360 GpuFeatureType type = | 377 GpuFeatureType type = |
361 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); | 378 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); |
| 379 type = IgnoreGpuFeatures(type); |
362 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS); | 380 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS); |
363 | 381 |
364 const FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html")); | 382 const FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html")); |
365 RunTest(url, EXPECT_NO_GPU_SWAP_BUFFERS); | 383 RunTest(url, EXPECT_NO_GPU_SWAP_BUFFERS); |
366 } | 384 } |
367 | 385 |
368 class Canvas2DDisabledTest : public GpuFeatureTest { | 386 class Canvas2DDisabledTest : public GpuFeatureTest { |
369 public: | 387 public: |
370 virtual void SetUpCommandLine(CommandLine* command_line) { | 388 virtual void SetUpCommandLine(CommandLine* command_line) { |
371 GpuFeatureTest::SetUpCommandLine(command_line); | 389 GpuFeatureTest::SetUpCommandLine(command_line); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 base::StringPrintf( | 523 base::StringPrintf( |
506 "%d (resize offset %d): IOSurface width %d -> %d; Creates %d " | 524 "%d (resize offset %d): IOSurface width %d -> %d; Creates %d " |
507 "Expected %d", offset_i, offsets[offset_i], | 525 "Expected %d", offset_i, offsets[offset_i], |
508 old_width, new_width, num_creates, expected_creates); | 526 old_width, new_width, num_creates, expected_creates); |
509 } | 527 } |
510 } | 528 } |
511 } | 529 } |
512 #endif | 530 #endif |
513 | 531 |
514 } // namespace anonymous | 532 } // namespace anonymous |
OLD | NEW |