OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/test/trace_event_analyzer.h" | 9 #include "base/test/trace_event_analyzer.h" |
10 #include "base/version.h" | 10 #include "base/version.h" |
11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/common/chrome_paths.h" | 12 #include "chrome/common/chrome_paths.h" |
13 #include "chrome/test/base/in_process_browser_test.h" | 13 #include "chrome/test/base/in_process_browser_test.h" |
| 14 #include "chrome/test/base/test_launcher_utils.h" |
14 #include "chrome/test/base/tracing.h" | 15 #include "chrome/test/base/tracing.h" |
15 #include "chrome/test/base/ui_test_utils.h" | 16 #include "chrome/test/base/ui_test_utils.h" |
16 #include "content/browser/gpu/gpu_blacklist.h" | 17 #include "content/browser/gpu/gpu_blacklist.h" |
17 #include "content/browser/gpu/gpu_data_manager.h" | 18 #include "content/browser/gpu/gpu_data_manager.h" |
18 #include "net/base/net_util.h" | 19 #include "net/base/net_util.h" |
19 #include "ui/gfx/gl/gl_switches.h" | 20 #include "ui/gfx/gl/gl_switches.h" |
20 | 21 |
21 namespace { | 22 namespace { |
22 | 23 |
23 typedef uint32 GpuResultFlags; | 24 typedef uint32 GpuResultFlags; |
24 #define EXPECT_NO_GPU_PROCESS GpuResultFlags(0) | 25 #define EXPECT_NO_GPU_PROCESS GpuResultFlags(0) |
25 // Expect GPU process to be created. | 26 // Expect GPU process to be created. |
26 #define EXPECT_GPU_PROCESS GpuResultFlags(1<<0) | 27 #define EXPECT_GPU_PROCESS GpuResultFlags(1<<0) |
27 // Expect num_contexts_ to be created (onscreen or offscreen). | 28 // Expect num_contexts_ to be created (onscreen or offscreen). |
28 #define EXPECT_GPU_CONTEXTS GpuResultFlags(1<<1) | 29 #define EXPECT_GPU_CONTEXTS GpuResultFlags(1<<1) |
29 // Expect a SwapBuffers to occur (see gles2_cmd_decoder.cc). | 30 // Expect a SwapBuffers to occur (see gles2_cmd_decoder.cc). |
30 #define EXPECT_GPU_SWAP_BUFFERS GpuResultFlags(1<<2) | 31 #define EXPECT_GPU_SWAP_BUFFERS GpuResultFlags(1<<2) |
31 | 32 |
32 class GpuFeatureTest : public InProcessBrowserTest { | 33 class GpuFeatureTest : public InProcessBrowserTest { |
33 public: | 34 public: |
34 GpuFeatureTest() | 35 GpuFeatureTest() |
35 : num_contexts_(0), | 36 : num_contexts_(0), |
36 num_offscreen_contexts_(0) {} | 37 num_offscreen_contexts_(0) {} |
37 | 38 |
38 virtual void SetUpCommandLine(CommandLine* command_line) { | 39 virtual void SetUpCommandLine(CommandLine* command_line) { |
39 // This enables DOM automation for tab contents. | 40 // This enables DOM automation for tab contents. |
40 EnableDOMAutomation(); | 41 EnableDOMAutomation(); |
41 #if !defined(OS_MACOSX) | 42 #if !defined(OS_MACOSX) |
42 CHECK(!command_line->HasSwitch(switches::kUseGL)) << | 43 CHECK(test_launcher_utils::OverrideGLImplementation( |
| 44 command_line, gfx::kGLImplementationOSMesaName)) << |
43 "kUseGL must not be set by test framework code!"; | 45 "kUseGL must not be set by test framework code!"; |
44 command_line->AppendSwitchASCII(switches::kUseGL, "osmesa"); | |
45 #endif | 46 #endif |
46 } | 47 } |
47 | 48 |
48 void SetupBlacklist(const std::string& json_blacklist) { | 49 void SetupBlacklist(const std::string& json_blacklist) { |
49 scoped_ptr<Version> os_version(Version::GetVersionFromString("1.0")); | 50 scoped_ptr<Version> os_version(Version::GetVersionFromString("1.0")); |
50 GpuBlacklist* blacklist = new GpuBlacklist("1.0"); | 51 GpuBlacklist* blacklist = new GpuBlacklist("1.0"); |
51 | 52 |
52 ASSERT_TRUE(blacklist->LoadGpuBlacklist( | 53 ASSERT_TRUE(blacklist->LoadGpuBlacklist( |
53 json_blacklist, GpuBlacklist::kAllOs)); | 54 json_blacklist, GpuBlacklist::kAllOs)); |
54 GpuDataManager::GetInstance()->SetGpuBlacklist(blacklist); | 55 GpuDataManager::GetInstance()->SetGpuBlacklist(blacklist); |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 EXPECT_EQ( | 228 EXPECT_EQ( |
228 flags.flags(), | 229 flags.flags(), |
229 static_cast<uint32>(GpuFeatureFlags::kGpuFeatureAccelerated2dCanvas)); | 230 static_cast<uint32>(GpuFeatureFlags::kGpuFeatureAccelerated2dCanvas)); |
230 | 231 |
231 const FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html")); | 232 const FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html")); |
232 RunTest(url, EXPECT_NO_GPU_PROCESS); | 233 RunTest(url, EXPECT_NO_GPU_PROCESS); |
233 } | 234 } |
234 | 235 |
235 } // namespace anonymous | 236 } // namespace anonymous |
236 | 237 |
OLD | NEW |