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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 class GpuFeatureTest : public InProcessBrowserTest { | 48 class GpuFeatureTest : public InProcessBrowserTest { |
49 public: | 49 public: |
50 GpuFeatureTest() : trace_categories_("test_gpu"), gpu_enabled_(false) {} | 50 GpuFeatureTest() : trace_categories_("test_gpu"), gpu_enabled_(false) {} |
51 | 51 |
52 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 52 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
53 FilePath test_dir; | 53 FilePath test_dir; |
54 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); | 54 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); |
55 gpu_test_dir_ = test_dir.AppendASCII("gpu"); | 55 gpu_test_dir_ = test_dir.AppendASCII("gpu"); |
56 } | 56 } |
57 | 57 |
58 virtual void SetUpCommandLine(CommandLine* command_line) { | 58 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
59 // Do not use mesa if real GPU is required. | 59 // Do not use mesa if real GPU is required. |
60 if (!command_line->HasSwitch(switches::kUseGpuInTests)) { | 60 if (!command_line->HasSwitch(switches::kUseGpuInTests)) { |
61 #if !defined(OS_MACOSX) | 61 #if !defined(OS_MACOSX) |
62 CHECK(test_launcher_utils::OverrideGLImplementation( | 62 CHECK(test_launcher_utils::OverrideGLImplementation( |
63 command_line, gfx::kGLImplementationOSMesaName)) << | 63 command_line, gfx::kGLImplementationOSMesaName)) << |
64 "kUseGL must not be set by test framework code!"; | 64 "kUseGL must not be set by test framework code!"; |
65 #endif | 65 #endif |
66 } else { | 66 } else { |
67 gpu_enabled_ = true; | 67 gpu_enabled_ = true; |
68 } | 68 } |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 type = IgnoreGpuFeatures(type); | 228 type = IgnoreGpuFeatures(type); |
229 | 229 |
230 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING); | 230 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING); |
231 | 231 |
232 const FilePath url(FILE_PATH_LITERAL("feature_compositing.html")); | 232 const FilePath url(FILE_PATH_LITERAL("feature_compositing.html")); |
233 RunEventTest(url, kSwapBuffersEvent, false); | 233 RunEventTest(url, kSwapBuffersEvent, false); |
234 } | 234 } |
235 | 235 |
236 class AcceleratedCompositingTest : public GpuFeatureTest { | 236 class AcceleratedCompositingTest : public GpuFeatureTest { |
237 public: | 237 public: |
238 virtual void SetUpCommandLine(CommandLine* command_line) { | 238 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
239 GpuFeatureTest::SetUpCommandLine(command_line); | 239 GpuFeatureTest::SetUpCommandLine(command_line); |
240 command_line->AppendSwitch(switches::kDisableAcceleratedCompositing); | 240 command_line->AppendSwitch(switches::kDisableAcceleratedCompositing); |
241 } | 241 } |
242 }; | 242 }; |
243 | 243 |
244 #if defined(OS_WIN) && defined(USE_AURA) | 244 #if defined(OS_WIN) && defined(USE_AURA) |
245 // Compositing is always on for Windows Aura. | 245 // Compositing is always on for Windows Aura. |
246 #define MAYBE_AcceleratedCompositingDisabled DISABLED_AcceleratedCompositingDisa
bled | 246 #define MAYBE_AcceleratedCompositingDisabled DISABLED_AcceleratedCompositingDisa
bled |
247 #else | 247 #else |
248 #define MAYBE_AcceleratedCompositingDisabled AcceleratedCompositingDisabled | 248 #define MAYBE_AcceleratedCompositingDisabled AcceleratedCompositingDisabled |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); | 283 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); |
284 type = IgnoreGpuFeatures(type); | 284 type = IgnoreGpuFeatures(type); |
285 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL); | 285 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL); |
286 | 286 |
287 const FilePath url(FILE_PATH_LITERAL("feature_webgl.html")); | 287 const FilePath url(FILE_PATH_LITERAL("feature_webgl.html")); |
288 RunEventTest(url, kWebGLCreationEvent, false); | 288 RunEventTest(url, kWebGLCreationEvent, false); |
289 } | 289 } |
290 | 290 |
291 class WebGLTest : public GpuFeatureTest { | 291 class WebGLTest : public GpuFeatureTest { |
292 public: | 292 public: |
293 virtual void SetUpCommandLine(CommandLine* command_line) { | 293 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
294 GpuFeatureTest::SetUpCommandLine(command_line); | 294 GpuFeatureTest::SetUpCommandLine(command_line); |
295 #if !defined(OS_ANDROID) | 295 #if !defined(OS_ANDROID) |
296 // On Android, WebGL is disabled by default | 296 // On Android, WebGL is disabled by default |
297 command_line->AppendSwitch(switches::kDisableExperimentalWebGL); | 297 command_line->AppendSwitch(switches::kDisableExperimentalWebGL); |
298 #endif | 298 #endif |
299 } | 299 } |
300 }; | 300 }; |
301 | 301 |
302 IN_PROC_BROWSER_TEST_F(WebGLTest, WebGLDisabled) { | 302 IN_PROC_BROWSER_TEST_F(WebGLTest, WebGLDisabled) { |
303 const FilePath url(FILE_PATH_LITERAL("feature_webgl.html")); | 303 const FilePath url(FILE_PATH_LITERAL("feature_webgl.html")); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); | 350 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); |
351 type = IgnoreGpuFeatures(type); | 351 type = IgnoreGpuFeatures(type); |
352 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_MULTISAMPLING); | 352 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_MULTISAMPLING); |
353 | 353 |
354 const FilePath url(FILE_PATH_LITERAL("feature_multisampling.html")); | 354 const FilePath url(FILE_PATH_LITERAL("feature_multisampling.html")); |
355 RunTest(url, "\"FALSE\"", true); | 355 RunTest(url, "\"FALSE\"", true); |
356 } | 356 } |
357 | 357 |
358 class WebGLMultisamplingTest : public GpuFeatureTest { | 358 class WebGLMultisamplingTest : public GpuFeatureTest { |
359 public: | 359 public: |
360 virtual void SetUpCommandLine(CommandLine* command_line) { | 360 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
361 GpuFeatureTest::SetUpCommandLine(command_line); | 361 GpuFeatureTest::SetUpCommandLine(command_line); |
362 command_line->AppendSwitch(switches::kDisableGLMultisampling); | 362 command_line->AppendSwitch(switches::kDisableGLMultisampling); |
363 } | 363 } |
364 }; | 364 }; |
365 | 365 |
366 IN_PROC_BROWSER_TEST_F(WebGLMultisamplingTest, MultisamplingDisabled) { | 366 IN_PROC_BROWSER_TEST_F(WebGLMultisamplingTest, MultisamplingDisabled) { |
367 // Multisampling fails on virtualized mac os. | 367 // Multisampling fails on virtualized mac os. |
368 if (GPUTestBotConfig::CurrentConfigMatches("MAC VMWARE")) | 368 if (GPUTestBotConfig::CurrentConfigMatches("MAC VMWARE")) |
369 return; | 369 return; |
370 | 370 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); | 404 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); |
405 type = IgnoreGpuFeatures(type); | 405 type = IgnoreGpuFeatures(type); |
406 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS); | 406 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS); |
407 | 407 |
408 const FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html")); | 408 const FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html")); |
409 RunEventTest(url, kAcceleratedCanvasCreationEvent, false); | 409 RunEventTest(url, kAcceleratedCanvasCreationEvent, false); |
410 } | 410 } |
411 | 411 |
412 class Canvas2DDisabledTest : public GpuFeatureTest { | 412 class Canvas2DDisabledTest : public GpuFeatureTest { |
413 public: | 413 public: |
414 virtual void SetUpCommandLine(CommandLine* command_line) { | 414 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
415 GpuFeatureTest::SetUpCommandLine(command_line); | 415 GpuFeatureTest::SetUpCommandLine(command_line); |
416 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); | 416 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); |
417 } | 417 } |
418 }; | 418 }; |
419 | 419 |
420 IN_PROC_BROWSER_TEST_F(Canvas2DDisabledTest, Canvas2DDisabled) { | 420 IN_PROC_BROWSER_TEST_F(Canvas2DDisabledTest, Canvas2DDisabled) { |
421 const FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html")); | 421 const FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html")); |
422 RunEventTest(url, kAcceleratedCanvasCreationEvent, false); | 422 RunEventTest(url, kAcceleratedCanvasCreationEvent, false); |
423 } | 423 } |
424 | 424 |
425 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, | 425 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, |
426 CanOpenPopupAndRenderWithWebGLCanvas) { | 426 CanOpenPopupAndRenderWithWebGLCanvas) { |
427 const FilePath url(FILE_PATH_LITERAL("webgl_popup.html")); | 427 const FilePath url(FILE_PATH_LITERAL("webgl_popup.html")); |
428 RunTest(url, "\"SUCCESS\"", false); | 428 RunTest(url, "\"SUCCESS\"", false); |
429 } | 429 } |
430 | 430 |
431 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, CanOpenPopupAndRenderWith2DCanvas) { | 431 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, CanOpenPopupAndRenderWith2DCanvas) { |
432 const FilePath url(FILE_PATH_LITERAL("canvas_popup.html")); | 432 const FilePath url(FILE_PATH_LITERAL("canvas_popup.html")); |
433 RunTest(url, "\"SUCCESS\"", false); | 433 RunTest(url, "\"SUCCESS\"", false); |
434 } | 434 } |
435 | 435 |
436 class ThreadedCompositorTest : public GpuFeatureTest { | 436 class ThreadedCompositorTest : public GpuFeatureTest { |
437 public: | 437 public: |
438 virtual void SetUpCommandLine(CommandLine* command_line) { | 438 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
439 GpuFeatureTest::SetUpCommandLine(command_line); | 439 GpuFeatureTest::SetUpCommandLine(command_line); |
440 command_line->AppendSwitch(switches::kEnableThreadedCompositing); | 440 command_line->AppendSwitch(switches::kEnableThreadedCompositing); |
441 } | 441 } |
442 }; | 442 }; |
443 | 443 |
444 #if defined(OS_LINUX) | 444 #if defined(OS_LINUX) |
445 // http://crbug.com/157985: test fails on Linux | 445 // http://crbug.com/157985: test fails on Linux |
446 #define MAYBE_ThreadedCompositor DISABLED_ThreadedCompositor | 446 #define MAYBE_ThreadedCompositor DISABLED_ThreadedCompositor |
447 #else | 447 #else |
448 #define MAYBE_ThreadedCompositor ThreadedCompositor | 448 #define MAYBE_ThreadedCompositor ThreadedCompositor |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 base::StringPrintf( | 561 base::StringPrintf( |
562 "%d (resize offset %d): IOSurface width %d -> %d; Creates %d " | 562 "%d (resize offset %d): IOSurface width %d -> %d; Creates %d " |
563 "Expected %d", offset_i, offsets[offset_i], | 563 "Expected %d", offset_i, offsets[offset_i], |
564 old_width, new_width, num_creates, expected_creates); | 564 old_width, new_width, num_creates, expected_creates); |
565 } | 565 } |
566 } | 566 } |
567 } | 567 } |
568 #endif | 568 #endif |
569 | 569 |
570 } // namespace anonymous | 570 } // namespace anonymous |
OLD | NEW |