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" | |
22 #include "net/base/net_util.h" | 21 #include "net/base/net_util.h" |
23 #include "ui/gfx/gl/gl_switches.h" | 22 #include "ui/gfx/gl/gl_switches.h" |
24 | 23 |
25 using content::GpuDataManager; | 24 using content::GpuDataManager; |
26 using content::GpuFeatureType; | 25 using content::GpuFeatureType; |
27 | 26 |
28 namespace { | 27 namespace { |
29 | 28 |
30 typedef uint32 GpuResultFlags; | 29 typedef uint32 GpuResultFlags; |
31 #define EXPECT_NO_GPU_PROCESS GpuResultFlags(1<<0) | 30 #define EXPECT_NO_GPU_PROCESS GpuResultFlags(1<<0) |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, MultisamplingAllowed) { | 217 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, MultisamplingAllowed) { |
219 GpuFeatureType type = GpuDataManager::GetInstance()->GetGpuFeatureType(); | 218 GpuFeatureType type = GpuDataManager::GetInstance()->GetGpuFeatureType(); |
220 EXPECT_EQ(type, 0); | 219 EXPECT_EQ(type, 0); |
221 | 220 |
222 // Multisampling is not supported if running on top of osmesa. | 221 // Multisampling is not supported if running on top of osmesa. |
223 std::string use_gl = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 222 std::string use_gl = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
224 switches::kUseGL); | 223 switches::kUseGL); |
225 if (use_gl == gfx::kGLImplementationOSMesaName) | 224 if (use_gl == gfx::kGLImplementationOSMesaName) |
226 return; | 225 return; |
227 | 226 |
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 | |
237 const FilePath url(FILE_PATH_LITERAL("feature_multisampling.html")); | 227 const FilePath url(FILE_PATH_LITERAL("feature_multisampling.html")); |
238 RunTest(url, "\"TRUE\"", true); | 228 RunTest(url, "\"TRUE\"", true); |
239 } | 229 } |
240 | 230 |
241 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, MultisamplingBlocked) { | 231 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, MultisamplingBlocked) { |
242 const std::string json_blacklist = | 232 const std::string json_blacklist = |
243 "{\n" | 233 "{\n" |
244 " \"name\": \"gpu blacklist\",\n" | 234 " \"name\": \"gpu blacklist\",\n" |
245 " \"version\": \"1.0\",\n" | 235 " \"version\": \"1.0\",\n" |
246 " \"entries\": [\n" | 236 " \"entries\": [\n" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 GpuFeatureTest::SetUpCommandLine(command_line); | 269 GpuFeatureTest::SetUpCommandLine(command_line); |
280 command_line->AppendSwitch(switches::kEnableAccelerated2dCanvas); | 270 command_line->AppendSwitch(switches::kEnableAccelerated2dCanvas); |
281 } | 271 } |
282 }; | 272 }; |
283 | 273 |
284 IN_PROC_BROWSER_TEST_F(Canvas2DEnabledTest, Canvas2DAllowed) { | 274 IN_PROC_BROWSER_TEST_F(Canvas2DEnabledTest, Canvas2DAllowed) { |
285 GpuFeatureType type = GpuDataManager::GetInstance()->GetGpuFeatureType(); | 275 GpuFeatureType type = GpuDataManager::GetInstance()->GetGpuFeatureType(); |
286 EXPECT_EQ(type, 0); | 276 EXPECT_EQ(type, 0); |
287 | 277 |
288 const FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html")); | 278 const FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html")); |
289 | 279 RunTest(url, EXPECT_GPU_SWAP_BUFFERS); |
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); | |
299 } | 280 } |
300 | 281 |
301 IN_PROC_BROWSER_TEST_F(Canvas2DEnabledTest, Canvas2DBlocked) { | 282 IN_PROC_BROWSER_TEST_F(Canvas2DEnabledTest, Canvas2DBlocked) { |
302 const std::string json_blacklist = | 283 const std::string json_blacklist = |
303 "{\n" | 284 "{\n" |
304 " \"name\": \"gpu blacklist\",\n" | 285 " \"name\": \"gpu blacklist\",\n" |
305 " \"version\": \"1.0\",\n" | 286 " \"version\": \"1.0\",\n" |
306 " \"entries\": [\n" | 287 " \"entries\": [\n" |
307 " {\n" | 288 " {\n" |
308 " \"id\": 1,\n" | 289 " \"id\": 1,\n" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 } | 333 } |
353 }; | 334 }; |
354 | 335 |
355 IN_PROC_BROWSER_TEST_F(ThreadedCompositorTest, DISABLED_ThreadedCompositor) { | 336 IN_PROC_BROWSER_TEST_F(ThreadedCompositorTest, DISABLED_ThreadedCompositor) { |
356 const FilePath url(FILE_PATH_LITERAL("feature_compositing.html")); | 337 const FilePath url(FILE_PATH_LITERAL("feature_compositing.html")); |
357 RunTest(url, EXPECT_GPU_SWAP_BUFFERS); | 338 RunTest(url, EXPECT_GPU_SWAP_BUFFERS); |
358 } | 339 } |
359 | 340 |
360 } // namespace anonymous | 341 } // namespace anonymous |
361 | 342 |
OLD | NEW |