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/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/gpu_blacklist.h" | 11 #include "chrome/browser/gpu_blacklist.h" |
12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/common/chrome_paths.h" | 13 #include "chrome/common/chrome_paths.h" |
14 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
15 #include "chrome/test/base/in_process_browser_test.h" | 15 #include "chrome/test/base/in_process_browser_test.h" |
16 #include "chrome/test/base/test_launcher_utils.h" | 16 #include "chrome/test/base/test_launcher_utils.h" |
17 #include "chrome/test/base/tracing.h" | 17 #include "chrome/test/base/tracing.h" |
18 #include "chrome/test/base/ui_test_utils.h" | 18 #include "chrome/test/base/ui_test_utils.h" |
19 #include "content/public/browser/gpu_data_manager.h" | 19 #include "content/public/browser/gpu_data_manager.h" |
20 #include "content/public/common/content_switches.h" | 20 #include "content/public/common/content_switches.h" |
| 21 #include "content/test/gpu/gpu_test_config.h" |
21 #include "net/base/net_util.h" | 22 #include "net/base/net_util.h" |
22 #include "ui/gfx/gl/gl_switches.h" | 23 #include "ui/gfx/gl/gl_switches.h" |
23 | 24 |
24 using content::GpuDataManager; | 25 using content::GpuDataManager; |
25 using content::GpuFeatureType; | 26 using content::GpuFeatureType; |
26 | 27 |
27 namespace { | 28 namespace { |
28 | 29 |
29 typedef uint32 GpuResultFlags; | 30 typedef uint32 GpuResultFlags; |
30 #define EXPECT_NO_GPU_PROCESS GpuResultFlags(1<<0) | 31 #define EXPECT_NO_GPU_PROCESS GpuResultFlags(1<<0) |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, MultisamplingAllowed) { | 218 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, MultisamplingAllowed) { |
218 GpuFeatureType type = GpuDataManager::GetInstance()->GetGpuFeatureType(); | 219 GpuFeatureType type = GpuDataManager::GetInstance()->GetGpuFeatureType(); |
219 EXPECT_EQ(type, 0); | 220 EXPECT_EQ(type, 0); |
220 | 221 |
221 // Multisampling is not supported if running on top of osmesa. | 222 // Multisampling is not supported if running on top of osmesa. |
222 std::string use_gl = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 223 std::string use_gl = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
223 switches::kUseGL); | 224 switches::kUseGL); |
224 if (use_gl == gfx::kGLImplementationOSMesaName) | 225 if (use_gl == gfx::kGLImplementationOSMesaName) |
225 return; | 226 return; |
226 | 227 |
| 228 #if defined(OS_LINUX) |
| 229 // Linux Intel uses mesa driver, where multisampling is not supported. |
| 230 GPUTestBotConfig test_bot; |
| 231 test_bot.LoadCurrentConfig(NULL); |
| 232 const std::vector<uint32>& gpu_vendor = test_bot.gpu_vendor(); |
| 233 if (gpu_vendor.size() == 1 && gpu_vendor[0] == 0x8086) |
| 234 return; |
| 235 #endif |
| 236 |
227 const FilePath url(FILE_PATH_LITERAL("feature_multisampling.html")); | 237 const FilePath url(FILE_PATH_LITERAL("feature_multisampling.html")); |
228 RunTest(url, "\"TRUE\"", true); | 238 RunTest(url, "\"TRUE\"", true); |
229 } | 239 } |
230 | 240 |
231 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, MultisamplingBlocked) { | 241 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, MultisamplingBlocked) { |
232 const std::string json_blacklist = | 242 const std::string json_blacklist = |
233 "{\n" | 243 "{\n" |
234 " \"name\": \"gpu blacklist\",\n" | 244 " \"name\": \"gpu blacklist\",\n" |
235 " \"version\": \"1.0\",\n" | 245 " \"version\": \"1.0\",\n" |
236 " \"entries\": [\n" | 246 " \"entries\": [\n" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 GpuFeatureTest::SetUpCommandLine(command_line); | 279 GpuFeatureTest::SetUpCommandLine(command_line); |
270 command_line->AppendSwitch(switches::kEnableAccelerated2dCanvas); | 280 command_line->AppendSwitch(switches::kEnableAccelerated2dCanvas); |
271 } | 281 } |
272 }; | 282 }; |
273 | 283 |
274 IN_PROC_BROWSER_TEST_F(Canvas2DEnabledTest, Canvas2DAllowed) { | 284 IN_PROC_BROWSER_TEST_F(Canvas2DEnabledTest, Canvas2DAllowed) { |
275 GpuFeatureType type = GpuDataManager::GetInstance()->GetGpuFeatureType(); | 285 GpuFeatureType type = GpuDataManager::GetInstance()->GetGpuFeatureType(); |
276 EXPECT_EQ(type, 0); | 286 EXPECT_EQ(type, 0); |
277 | 287 |
278 const FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html")); | 288 const FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html")); |
279 RunTest(url, EXPECT_GPU_SWAP_BUFFERS); | 289 |
| 290 GpuResultFlags expectations = EXPECT_GPU_SWAP_BUFFERS; |
| 291 #if defined(OS_WIN) |
| 292 // Accelerated canvas 2D is not supported on XP. |
| 293 GPUTestBotConfig test_bot; |
| 294 test_bot.LoadCurrentConfig(NULL); |
| 295 if (test_bot.os() == GPUTestConfig::kOSWinXP) |
| 296 expectations = EXPECT_NO_GPU_PROCESS; |
| 297 #endif |
| 298 RunTest(url, expectations); |
280 } | 299 } |
281 | 300 |
282 IN_PROC_BROWSER_TEST_F(Canvas2DEnabledTest, Canvas2DBlocked) { | 301 IN_PROC_BROWSER_TEST_F(Canvas2DEnabledTest, Canvas2DBlocked) { |
283 const std::string json_blacklist = | 302 const std::string json_blacklist = |
284 "{\n" | 303 "{\n" |
285 " \"name\": \"gpu blacklist\",\n" | 304 " \"name\": \"gpu blacklist\",\n" |
286 " \"version\": \"1.0\",\n" | 305 " \"version\": \"1.0\",\n" |
287 " \"entries\": [\n" | 306 " \"entries\": [\n" |
288 " {\n" | 307 " {\n" |
289 " \"id\": 1,\n" | 308 " \"id\": 1,\n" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 } | 352 } |
334 }; | 353 }; |
335 | 354 |
336 IN_PROC_BROWSER_TEST_F(ThreadedCompositorTest, FLAKY_ThreadedCompositor) { | 355 IN_PROC_BROWSER_TEST_F(ThreadedCompositorTest, FLAKY_ThreadedCompositor) { |
337 const FilePath url(FILE_PATH_LITERAL("feature_compositing.html")); | 356 const FilePath url(FILE_PATH_LITERAL("feature_compositing.html")); |
338 RunTest(url, EXPECT_GPU_SWAP_BUFFERS); | 357 RunTest(url, EXPECT_GPU_SWAP_BUFFERS); |
339 } | 358 } |
340 | 359 |
341 } // namespace anonymous | 360 } // namespace anonymous |
342 | 361 |
OLD | NEW |