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" |
11 #include "base/version.h" | 11 #include "base/version.h" |
12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/browser/ui/browser_window.h" | 13 #include "chrome/browser/ui/browser_window.h" |
14 #include "chrome/common/chrome_paths.h" | 14 #include "chrome/common/chrome_paths.h" |
15 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
16 #include "chrome/test/base/in_process_browser_test.h" | 16 #include "chrome/test/base/in_process_browser_test.h" |
17 #include "chrome/test/base/test_launcher_utils.h" | 17 #include "chrome/test/base/test_launcher_utils.h" |
18 #include "chrome/test/base/tracing.h" | 18 #include "chrome/test/base/tracing.h" |
19 #include "chrome/test/base/ui_test_utils.h" | 19 #include "chrome/test/base/ui_test_utils.h" |
20 #include "content/public/browser/gpu_data_manager.h" | 20 #include "content/public/browser/gpu_data_manager.h" |
21 #include "content/public/common/content_switches.h" | 21 #include "content/public/common/content_switches.h" |
22 #include "content/public/test/browser_test_utils.h" | 22 #include "content/public/test/browser_test_utils.h" |
23 #include "gpu/config/gpu_feature_type.h" | 23 #include "gpu/config/gpu_feature_type.h" |
24 #include "gpu/config/gpu_info.h" | 24 #include "gpu/config/gpu_info.h" |
25 #include "gpu/config/gpu_test_config.h" | 25 #include "gpu/config/gpu_test_config.h" |
26 #include "net/base/net_util.h" | 26 #include "net/base/net_util.h" |
27 #include "ui/compositor/compositor_setup.h" | |
28 #include "ui/gl/gl_switches.h" | 27 #include "ui/gl/gl_switches.h" |
29 | 28 |
30 #if defined(OS_MACOSX) | 29 #if defined(OS_MACOSX) |
31 #include "ui/gl/io_surface_support_mac.h" | 30 #include "ui/gl/io_surface_support_mac.h" |
32 #endif | 31 #endif |
33 | 32 |
34 #if defined(OS_WIN) | 33 #if defined(OS_WIN) |
35 #include "base/win/windows_version.h" | 34 #include "base/win/windows_version.h" |
36 #endif | 35 #endif |
37 | 36 |
38 using content::GpuDataManager; | 37 using content::GpuDataManager; |
39 using gpu::GpuFeatureType; | 38 using gpu::GpuFeatureType; |
40 using trace_analyzer::Query; | 39 using trace_analyzer::Query; |
41 using trace_analyzer::TraceAnalyzer; | 40 using trace_analyzer::TraceAnalyzer; |
42 using trace_analyzer::TraceEventVector; | 41 using trace_analyzer::TraceEventVector; |
43 | 42 |
44 namespace { | 43 namespace { |
45 | 44 |
46 const char kSwapBuffersEvent[] = "SwapBuffers"; | 45 const char kSwapBuffersEvent[] = "SwapBuffers"; |
47 const char kAcceleratedCanvasCreationEvent[] = "Canvas2DLayerBridgeCreation"; | 46 const char kAcceleratedCanvasCreationEvent[] = "Canvas2DLayerBridgeCreation"; |
48 const char kWebGLCreationEvent[] = "DrawingBufferCreation"; | 47 const char kWebGLCreationEvent[] = "DrawingBufferCreation"; |
49 | 48 |
50 class GpuFeatureTest : public InProcessBrowserTest { | 49 class GpuFeatureTest : public InProcessBrowserTest { |
51 public: | 50 public: |
52 GpuFeatureTest() : category_patterns_("test_gpu"), gpu_enabled_(false) {} | 51 GpuFeatureTest() : category_patterns_("test_gpu"), gpu_enabled_(false) {} |
53 | 52 |
| 53 virtual void SetUp() OVERRIDE { |
| 54 // We expect to use real GL contexts for these tests. |
| 55 DoNotUseTestContexts(); |
| 56 |
| 57 InProcessBrowserTest::SetUp(); |
| 58 } |
| 59 |
54 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 60 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
55 base::FilePath test_dir; | 61 base::FilePath test_dir; |
56 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); | 62 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); |
57 gpu_test_dir_ = test_dir.AppendASCII("gpu"); | 63 gpu_test_dir_ = test_dir.AppendASCII("gpu"); |
58 } | 64 } |
59 | 65 |
60 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 66 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
61 // Do not use mesa if real GPU is required. | 67 // Do not use mesa if real GPU is required. |
62 if (!command_line->HasSwitch(switches::kUseGpuInTests)) { | 68 if (!command_line->HasSwitch(switches::kUseGpuInTests)) { |
63 #if !defined(OS_MACOSX) | 69 #if !defined(OS_MACOSX) |
64 CHECK(test_launcher_utils::OverrideGLImplementation( | 70 CHECK(test_launcher_utils::OverrideGLImplementation( |
65 command_line, gfx::kGLImplementationOSMesaName)) << | 71 command_line, gfx::kGLImplementationOSMesaName)) << |
66 "kUseGL must not be set by test framework code!"; | 72 "kUseGL must not be set by test framework code!"; |
67 #endif | 73 #endif |
68 } else { | 74 } else { |
69 gpu_enabled_ = true; | 75 gpu_enabled_ = true; |
70 } | 76 } |
71 command_line->AppendSwitch(switches::kDisablePopupBlocking); | 77 command_line->AppendSwitch(switches::kDisablePopupBlocking); |
72 ui::DisableTestCompositor(); | |
73 command_line->AppendSwitchASCII(switches::kWindowSize, "400,300"); | 78 command_line->AppendSwitchASCII(switches::kWindowSize, "400,300"); |
74 } | 79 } |
75 | 80 |
76 void SetupBlacklist(const std::string& json_blacklist) { | 81 void SetupBlacklist(const std::string& json_blacklist) { |
77 gpu::GPUInfo gpu_info; | 82 gpu::GPUInfo gpu_info; |
78 GpuDataManager::GetInstance()->InitializeForTesting( | 83 GpuDataManager::GetInstance()->InitializeForTesting( |
79 json_blacklist, gpu_info); | 84 json_blacklist, gpu_info); |
80 } | 85 } |
81 | 86 |
82 // If expected_reply is NULL, we don't check the reply content. | 87 // If expected_reply is NULL, we don't check the reply content. |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 LOG(INFO) << | 556 LOG(INFO) << |
552 base::StringPrintf( | 557 base::StringPrintf( |
553 "%d (resize offset %d): IOSurface width %d -> %d; Creates %d " | 558 "%d (resize offset %d): IOSurface width %d -> %d; Creates %d " |
554 "Expected %d", offset_i, offsets[offset_i], | 559 "Expected %d", offset_i, offsets[offset_i], |
555 old_width, new_width, num_creates, expected_creates); | 560 old_width, new_width, num_creates, expected_creates); |
556 } | 561 } |
557 } | 562 } |
558 } | 563 } |
559 #endif | 564 #endif |
560 | 565 |
561 } // namespace anonymous | 566 } // namespace |
OLD | NEW |