| 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 23 matching lines...) Expand all Loading... |
| 34 #endif | 34 #endif |
| 35 | 35 |
| 36 using content::GpuDataManager; | 36 using content::GpuDataManager; |
| 37 using content::GpuFeatureType; | 37 using content::GpuFeatureType; |
| 38 using trace_analyzer::Query; | 38 using trace_analyzer::Query; |
| 39 using trace_analyzer::TraceAnalyzer; | 39 using trace_analyzer::TraceAnalyzer; |
| 40 using trace_analyzer::TraceEventVector; | 40 using trace_analyzer::TraceEventVector; |
| 41 | 41 |
| 42 namespace { | 42 namespace { |
| 43 | 43 |
| 44 const char kSwapBuffersEvent[] = "SwapBuffers"; | 44 typedef uint32 GpuResultFlags; |
| 45 const char kAcceleratedCanvasCreationEvent[] = "Canvas2DLayerBridgeCreation"; | 45 #define EXPECT_NO_GPU_SWAP_BUFFERS GpuResultFlags(1<<0) |
| 46 const char kWebGLCreationEvent[] = "DrawingBufferCreation"; | 46 // Expect a SwapBuffers to occur (see gles2_cmd_decoder.cc). |
| 47 #define EXPECT_GPU_SWAP_BUFFERS GpuResultFlags(1<<1) |
| 47 | 48 |
| 48 class GpuFeatureTest : public InProcessBrowserTest { | 49 class GpuFeatureTest : public InProcessBrowserTest { |
| 49 public: | 50 public: |
| 50 GpuFeatureTest() : trace_categories_("test_gpu"), gpu_enabled_(false) {} | 51 GpuFeatureTest() : trace_categories_("test_gpu"), gpu_enabled_(false) {} |
| 51 | 52 |
| 52 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 53 virtual void SetUpInProcessBrowserTestFixture() { |
| 53 FilePath test_dir; | 54 FilePath test_dir; |
| 54 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); | 55 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); |
| 55 gpu_test_dir_ = test_dir.AppendASCII("gpu"); | 56 gpu_test_dir_ = test_dir.AppendASCII("gpu"); |
| 56 } | 57 } |
| 57 | 58 |
| 58 virtual void SetUpCommandLine(CommandLine* command_line) { | 59 virtual void SetUpCommandLine(CommandLine* command_line) { |
| 59 // Do not use mesa if real GPU is required. | 60 // Do not use mesa if real GPU is required. |
| 60 if (!command_line->HasSwitch(switches::kUseGpuInTests)) { | 61 if (!command_line->HasSwitch(switches::kUseGpuInTests)) { |
| 61 #if !defined(OS_MACOSX) | 62 #if !defined(OS_MACOSX) |
| 62 CHECK(test_launcher_utils::OverrideGLImplementation( | 63 CHECK(test_launcher_utils::OverrideGLImplementation( |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 browser(), net::FilePathToFileURL(test_path)); | 103 browser(), net::FilePathToFileURL(test_path)); |
| 103 } | 104 } |
| 104 | 105 |
| 105 std::string result; | 106 std::string result; |
| 106 // Wait for message indicating the test has finished running. | 107 // Wait for message indicating the test has finished running. |
| 107 ASSERT_TRUE(message_queue.WaitForMessage(&result)); | 108 ASSERT_TRUE(message_queue.WaitForMessage(&result)); |
| 108 if (expected_reply) | 109 if (expected_reply) |
| 109 EXPECT_STREQ(expected_reply, result.c_str()); | 110 EXPECT_STREQ(expected_reply, result.c_str()); |
| 110 } | 111 } |
| 111 | 112 |
| 112 // Open the URL and check the trace stream for the given event. | 113 void RunTest(const FilePath& url, GpuResultFlags expectations) { |
| 113 void RunEventTest(const FilePath& url, | |
| 114 const char* event_name = NULL, | |
| 115 bool event_expected = false) { | |
| 116 #if defined(OS_LINUX) && !defined(NDEBUG) | 114 #if defined(OS_LINUX) && !defined(NDEBUG) |
| 117 // Bypass tests on GPU Linux Debug bots. | 115 // Bypass tests on GPU Linux Debug bots. |
| 118 if (gpu_enabled_) | 116 if (gpu_enabled_) |
| 119 return; | 117 return; |
| 120 #endif | 118 #endif |
| 121 #if defined(OS_MACOSX) | 119 #if defined(OS_MACOSX) |
| 122 // Bypass tests on Mac OSX 10.5 bots (IOSurfaceSupport is now required). | 120 // Bypass tests on Mac OSX 10.5 bots (IOSurfaceSupport is now required). |
| 123 if (!IOSurfaceSupport::Initialize()) | 121 if (!IOSurfaceSupport::Initialize()) |
| 124 return; | 122 return; |
| 125 #endif | 123 #endif |
| 126 | 124 |
| 127 ASSERT_TRUE(tracing::BeginTracing(trace_categories_)); | 125 ASSERT_TRUE(tracing::BeginTracing(trace_categories_)); |
| 128 | 126 |
| 129 // Have to use a new tab for the blacklist to work. | 127 // Have to use a new tab for the blacklist to work. |
| 130 RunTest(url, NULL, true); | 128 RunTest(url, NULL, true); |
| 131 | 129 |
| 132 ASSERT_TRUE(tracing::EndTracing(&trace_events_json_)); | 130 ASSERT_TRUE(tracing::EndTracing(&trace_events_json_)); |
| 133 | 131 |
| 134 analyzer_.reset(TraceAnalyzer::Create(trace_events_json_)); | 132 analyzer_.reset(TraceAnalyzer::Create(trace_events_json_)); |
| 135 analyzer_->AssociateBeginEndEvents(); | 133 analyzer_->AssociateBeginEndEvents(); |
| 136 TraceEventVector events; | 134 TraceEventVector events; |
| 137 | 135 |
| 138 if (!event_name) | 136 if (expectations & EXPECT_NO_GPU_SWAP_BUFFERS) { |
| 139 return; | 137 EXPECT_EQ(analyzer_->FindEvents(Query::EventNameIs("SwapBuffers"), |
| 138 &events), size_t(0)); |
| 139 } |
| 140 | 140 |
| 141 size_t event_count = | 141 // Check for swap buffers if expected: |
| 142 analyzer_->FindEvents(Query::EventNameIs(event_name), &events); | 142 if (expectations & EXPECT_GPU_SWAP_BUFFERS) { |
| 143 | 143 EXPECT_GT(analyzer_->FindEvents(Query::EventNameIs("SwapBuffers"), |
| 144 if (event_expected) | 144 &events), size_t(0)); |
| 145 EXPECT_GT(event_count, 0U); | 145 } |
| 146 else | |
| 147 EXPECT_EQ(event_count, 0U); | |
| 148 } | 146 } |
| 149 | 147 |
| 150 // Trigger a resize of the chrome window, and use tracing to wait for the | 148 // Trigger a resize of the chrome window, and use tracing to wait for the |
| 151 // given |wait_event|. | 149 // given |wait_event|. |
| 152 bool ResizeAndWait(const gfx::Rect& new_bounds, | 150 bool ResizeAndWait(const gfx::Rect& new_bounds, |
| 153 const char* trace_categories, | 151 const char* trace_categories, |
| 154 const char* wait_category, | 152 const char* wait_category, |
| 155 const char* wait_event) { | 153 const char* wait_event) { |
| 156 if (!tracing::BeginTracingWithWatch(trace_categories, wait_category, | 154 if (!tracing::BeginTracingWithWatch(trace_categories, wait_category, |
| 157 wait_event, 1)) | 155 wait_event, 1)) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 173 std::string trace_events_json_; | 171 std::string trace_events_json_; |
| 174 bool gpu_enabled_; | 172 bool gpu_enabled_; |
| 175 }; | 173 }; |
| 176 | 174 |
| 177 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, AcceleratedCompositingAllowed) { | 175 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, AcceleratedCompositingAllowed) { |
| 178 GpuFeatureType type = | 176 GpuFeatureType type = |
| 179 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); | 177 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); |
| 180 EXPECT_EQ(type, 0); | 178 EXPECT_EQ(type, 0); |
| 181 | 179 |
| 182 const FilePath url(FILE_PATH_LITERAL("feature_compositing.html")); | 180 const FilePath url(FILE_PATH_LITERAL("feature_compositing.html")); |
| 183 RunEventTest(url, kSwapBuffersEvent, true); | 181 RunTest(url, EXPECT_GPU_SWAP_BUFFERS); |
| 184 } | 182 } |
| 185 | 183 |
| 186 // Flash Stage3D may be blacklisted for other reasons on XP, so ignore it. | 184 // Flash Stage3D may be blacklisted for other reasons on XP, so ignore it. |
| 187 GpuFeatureType IgnoreGpuFeatures(GpuFeatureType type) { | 185 GpuFeatureType IgnoreGpuFeatures(GpuFeatureType type) { |
| 188 #if defined(OS_WIN) | 186 #if defined(OS_WIN) |
| 189 if (base::win::GetVersion() < base::win::VERSION_VISTA) | 187 if (base::win::GetVersion() < base::win::VERSION_VISTA) |
| 190 return static_cast<GpuFeatureType>(type & | 188 return static_cast<GpuFeatureType>(type & |
| 191 ~content::GPU_FEATURE_TYPE_FLASH_STAGE3D); | 189 ~content::GPU_FEATURE_TYPE_FLASH_STAGE3D); |
| 192 #endif | 190 #endif |
| 193 return type; | 191 return type; |
| 194 } | 192 } |
| 195 | 193 |
| 196 class AcceleratedCompositingBlockedTest : public GpuFeatureTest { | 194 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, AcceleratedCompositingBlocked) { |
| 197 public: | 195 const std::string json_blacklist = |
| 198 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | |
| 199 GpuFeatureTest::SetUpInProcessBrowserTestFixture(); | |
| 200 const std::string json_blacklist = | |
| 201 "{\n" | 196 "{\n" |
| 202 " \"name\": \"gpu blacklist\",\n" | 197 " \"name\": \"gpu blacklist\",\n" |
| 203 " \"version\": \"1.0\",\n" | 198 " \"version\": \"1.0\",\n" |
| 204 " \"entries\": [\n" | 199 " \"entries\": [\n" |
| 205 " {\n" | 200 " {\n" |
| 206 " \"id\": 1,\n" | 201 " \"id\": 1,\n" |
| 207 " \"blacklist\": [\n" | 202 " \"blacklist\": [\n" |
| 208 " \"accelerated_compositing\"\n" | 203 " \"accelerated_compositing\"\n" |
| 209 " ]\n" | 204 " ]\n" |
| 210 " }\n" | 205 " }\n" |
| 211 " ]\n" | 206 " ]\n" |
| 212 "}"; | 207 "}"; |
| 213 SetupBlacklist(json_blacklist); | 208 SetupBlacklist(json_blacklist); |
| 214 } | |
| 215 }; | |
| 216 | |
| 217 IN_PROC_BROWSER_TEST_F(AcceleratedCompositingBlockedTest, | |
| 218 AcceleratedCompositingBlocked) { | |
| 219 GpuFeatureType type = | 209 GpuFeatureType type = |
| 220 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); | 210 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); |
| 221 type = IgnoreGpuFeatures(type); | 211 type = IgnoreGpuFeatures(type); |
| 222 | |
| 223 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING); | 212 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING); |
| 224 | 213 |
| 225 const FilePath url(FILE_PATH_LITERAL("feature_compositing.html")); | 214 const FilePath url(FILE_PATH_LITERAL("feature_compositing.html")); |
| 226 RunEventTest(url, kSwapBuffersEvent, false); | 215 RunTest(url, EXPECT_NO_GPU_SWAP_BUFFERS); |
| 227 } | 216 } |
| 228 | 217 |
| 229 class AcceleratedCompositingTest : public GpuFeatureTest { | 218 class AcceleratedCompositingTest : public GpuFeatureTest { |
| 230 public: | 219 public: |
| 231 virtual void SetUpCommandLine(CommandLine* command_line) { | 220 virtual void SetUpCommandLine(CommandLine* command_line) { |
| 232 GpuFeatureTest::SetUpCommandLine(command_line); | 221 GpuFeatureTest::SetUpCommandLine(command_line); |
| 233 command_line->AppendSwitch(switches::kDisableAcceleratedCompositing); | 222 command_line->AppendSwitch(switches::kDisableAcceleratedCompositing); |
| 234 } | 223 } |
| 235 }; | 224 }; |
| 236 | 225 |
| 237 IN_PROC_BROWSER_TEST_F(AcceleratedCompositingTest, | 226 IN_PROC_BROWSER_TEST_F(AcceleratedCompositingTest, |
| 238 AcceleratedCompositingDisabled) { | 227 AcceleratedCompositingDisabled) { |
| 239 const FilePath url(FILE_PATH_LITERAL("feature_compositing.html")); | 228 const FilePath url(FILE_PATH_LITERAL("feature_compositing.html")); |
| 240 RunEventTest(url, kSwapBuffersEvent, false); | 229 RunTest(url, EXPECT_NO_GPU_SWAP_BUFFERS); |
| 241 } | 230 } |
| 242 | 231 |
| 243 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, WebGLAllowed) { | 232 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, WebGLAllowed) { |
| 244 GpuFeatureType type = | 233 GpuFeatureType type = |
| 245 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); | 234 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); |
| 246 EXPECT_EQ(type, 0); | 235 EXPECT_EQ(type, 0); |
| 247 | 236 |
| 248 const FilePath url(FILE_PATH_LITERAL("feature_webgl.html")); | 237 const FilePath url(FILE_PATH_LITERAL("feature_webgl.html")); |
| 249 RunEventTest(url, kWebGLCreationEvent, true); | 238 RunTest(url, EXPECT_GPU_SWAP_BUFFERS); |
| 250 } | 239 } |
| 251 | 240 |
| 252 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, WebGLBlocked) { | 241 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, WebGLBlocked) { |
| 253 const std::string json_blacklist = | 242 const std::string json_blacklist = |
| 254 "{\n" | 243 "{\n" |
| 255 " \"name\": \"gpu blacklist\",\n" | 244 " \"name\": \"gpu blacklist\",\n" |
| 256 " \"version\": \"1.0\",\n" | 245 " \"version\": \"1.0\",\n" |
| 257 " \"entries\": [\n" | 246 " \"entries\": [\n" |
| 258 " {\n" | 247 " {\n" |
| 259 " \"id\": 1,\n" | 248 " \"id\": 1,\n" |
| 260 " \"blacklist\": [\n" | 249 " \"blacklist\": [\n" |
| 261 " \"webgl\"\n" | 250 " \"webgl\"\n" |
| 262 " ]\n" | 251 " ]\n" |
| 263 " }\n" | 252 " }\n" |
| 264 " ]\n" | 253 " ]\n" |
| 265 "}"; | 254 "}"; |
| 266 SetupBlacklist(json_blacklist); | 255 SetupBlacklist(json_blacklist); |
| 267 GpuFeatureType type = | 256 GpuFeatureType type = |
| 268 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); | 257 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); |
| 269 type = IgnoreGpuFeatures(type); | 258 type = IgnoreGpuFeatures(type); |
| 270 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL); | 259 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL); |
| 271 | 260 |
| 272 const FilePath url(FILE_PATH_LITERAL("feature_webgl.html")); | 261 const FilePath url(FILE_PATH_LITERAL("feature_webgl.html")); |
| 273 RunEventTest(url, kWebGLCreationEvent, false); | 262 RunTest(url, EXPECT_NO_GPU_SWAP_BUFFERS); |
| 274 } | 263 } |
| 275 | 264 |
| 276 class WebGLTest : public GpuFeatureTest { | 265 class WebGLTest : public GpuFeatureTest { |
| 277 public: | 266 public: |
| 278 virtual void SetUpCommandLine(CommandLine* command_line) { | 267 virtual void SetUpCommandLine(CommandLine* command_line) { |
| 279 GpuFeatureTest::SetUpCommandLine(command_line); | 268 GpuFeatureTest::SetUpCommandLine(command_line); |
| 280 #if !defined(OS_ANDROID) | 269 #if !defined(OS_ANDROID) |
| 281 // On Android, WebGL is disabled by default | 270 // On Android, WebGL is disabled by default |
| 282 command_line->AppendSwitch(switches::kDisableExperimentalWebGL); | 271 command_line->AppendSwitch(switches::kDisableExperimentalWebGL); |
| 283 #endif | 272 #endif |
| 284 } | 273 } |
| 285 }; | 274 }; |
| 286 | 275 |
| 287 IN_PROC_BROWSER_TEST_F(WebGLTest, WebGLDisabled) { | 276 IN_PROC_BROWSER_TEST_F(WebGLTest, WebGLDisabled) { |
| 288 const FilePath url(FILE_PATH_LITERAL("feature_webgl.html")); | 277 const FilePath url(FILE_PATH_LITERAL("feature_webgl.html")); |
| 289 RunEventTest(url, kWebGLCreationEvent, false); | 278 RunTest(url, EXPECT_NO_GPU_SWAP_BUFFERS); |
| 290 } | 279 } |
| 291 | 280 |
| 292 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, MultisamplingAllowed) { | 281 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, MultisamplingAllowed) { |
| 293 GpuFeatureType type = | 282 GpuFeatureType type = |
| 294 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); | 283 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); |
| 295 EXPECT_EQ(type, 0); | 284 EXPECT_EQ(type, 0); |
| 296 | 285 |
| 297 // Multisampling is not supported if running on top of osmesa. | 286 // Multisampling is not supported if running on top of osmesa. |
| 298 std::string use_gl = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 287 std::string use_gl = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 299 switches::kUseGL); | 288 switches::kUseGL); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, Canvas2DAllowed) { | 349 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, Canvas2DAllowed) { |
| 361 // Accelerated canvas 2D is not supported on XP. | 350 // Accelerated canvas 2D is not supported on XP. |
| 362 if (GPUTestBotConfig::CurrentConfigMatches("XP")) | 351 if (GPUTestBotConfig::CurrentConfigMatches("XP")) |
| 363 return; | 352 return; |
| 364 | 353 |
| 365 GpuFeatureType type = | 354 GpuFeatureType type = |
| 366 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); | 355 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); |
| 367 EXPECT_EQ(type, 0); | 356 EXPECT_EQ(type, 0); |
| 368 | 357 |
| 369 const FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html")); | 358 const FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html")); |
| 370 RunEventTest(url, kAcceleratedCanvasCreationEvent, true); | 359 RunTest(url, EXPECT_GPU_SWAP_BUFFERS); |
| 371 } | 360 } |
| 372 | 361 |
| 373 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, Canvas2DBlocked) { | 362 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, Canvas2DBlocked) { |
| 374 const std::string json_blacklist = | 363 const std::string json_blacklist = |
| 375 "{\n" | 364 "{\n" |
| 376 " \"name\": \"gpu blacklist\",\n" | 365 " \"name\": \"gpu blacklist\",\n" |
| 377 " \"version\": \"1.0\",\n" | 366 " \"version\": \"1.0\",\n" |
| 378 " \"entries\": [\n" | 367 " \"entries\": [\n" |
| 379 " {\n" | 368 " {\n" |
| 380 " \"id\": 1,\n" | 369 " \"id\": 1,\n" |
| 381 " \"blacklist\": [\n" | 370 " \"blacklist\": [\n" |
| 382 " \"accelerated_2d_canvas\"\n" | 371 " \"accelerated_2d_canvas\"\n" |
| 383 " ]\n" | 372 " ]\n" |
| 384 " }\n" | 373 " }\n" |
| 385 " ]\n" | 374 " ]\n" |
| 386 "}"; | 375 "}"; |
| 387 SetupBlacklist(json_blacklist); | 376 SetupBlacklist(json_blacklist); |
| 388 GpuFeatureType type = | 377 GpuFeatureType type = |
| 389 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); | 378 GpuDataManager::GetInstance()->GetBlacklistedFeatures(); |
| 390 type = IgnoreGpuFeatures(type); | 379 type = IgnoreGpuFeatures(type); |
| 391 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS); | 380 EXPECT_EQ(type, content::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS); |
| 392 | 381 |
| 393 const FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html")); | 382 const FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html")); |
| 394 RunEventTest(url, kAcceleratedCanvasCreationEvent, false); | 383 RunTest(url, EXPECT_NO_GPU_SWAP_BUFFERS); |
| 395 } | 384 } |
| 396 | 385 |
| 397 class Canvas2DDisabledTest : public GpuFeatureTest { | 386 class Canvas2DDisabledTest : public GpuFeatureTest { |
| 398 public: | 387 public: |
| 399 virtual void SetUpCommandLine(CommandLine* command_line) { | 388 virtual void SetUpCommandLine(CommandLine* command_line) { |
| 400 GpuFeatureTest::SetUpCommandLine(command_line); | 389 GpuFeatureTest::SetUpCommandLine(command_line); |
| 401 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); | 390 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); |
| 402 } | 391 } |
| 403 }; | 392 }; |
| 404 | 393 |
| 405 IN_PROC_BROWSER_TEST_F(Canvas2DDisabledTest, Canvas2DDisabled) { | 394 IN_PROC_BROWSER_TEST_F(Canvas2DDisabledTest, Canvas2DDisabled) { |
| 406 const FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html")); | 395 const FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html")); |
| 407 RunEventTest(url, kAcceleratedCanvasCreationEvent, false); | 396 RunTest(url, EXPECT_NO_GPU_SWAP_BUFFERS); |
| 408 } | 397 } |
| 409 | 398 |
| 410 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, | 399 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, |
| 411 CanOpenPopupAndRenderWithWebGLCanvas) { | 400 CanOpenPopupAndRenderWithWebGLCanvas) { |
| 412 const FilePath url(FILE_PATH_LITERAL("webgl_popup.html")); | 401 const FilePath url(FILE_PATH_LITERAL("webgl_popup.html")); |
| 413 RunTest(url, "\"SUCCESS\"", false); | 402 RunTest(url, "\"SUCCESS\"", false); |
| 414 } | 403 } |
| 415 | 404 |
| 416 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, CanOpenPopupAndRenderWith2DCanvas) { | 405 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, CanOpenPopupAndRenderWith2DCanvas) { |
| 417 const FilePath url(FILE_PATH_LITERAL("canvas_popup.html")); | 406 const FilePath url(FILE_PATH_LITERAL("canvas_popup.html")); |
| 418 RunTest(url, "\"SUCCESS\"", false); | 407 RunTest(url, "\"SUCCESS\"", false); |
| 419 } | 408 } |
| 420 | 409 |
| 421 class ThreadedCompositorTest : public GpuFeatureTest { | 410 class ThreadedCompositorTest : public GpuFeatureTest { |
| 422 public: | 411 public: |
| 423 virtual void SetUpCommandLine(CommandLine* command_line) { | 412 virtual void SetUpCommandLine(CommandLine* command_line) { |
| 424 GpuFeatureTest::SetUpCommandLine(command_line); | 413 GpuFeatureTest::SetUpCommandLine(command_line); |
| 425 command_line->AppendSwitch(switches::kEnableThreadedCompositing); | 414 command_line->AppendSwitch(switches::kEnableThreadedCompositing); |
| 426 } | 415 } |
| 427 }; | 416 }; |
| 428 | 417 |
| 429 // disabled in http://crbug.com/123503 | 418 // disabled in http://crbug.com/123503 |
| 430 IN_PROC_BROWSER_TEST_F(ThreadedCompositorTest, ThreadedCompositor) { | 419 IN_PROC_BROWSER_TEST_F(ThreadedCompositorTest, ThreadedCompositor) { |
| 431 const FilePath url(FILE_PATH_LITERAL("feature_compositing.html")); | 420 const FilePath url(FILE_PATH_LITERAL("feature_compositing.html")); |
| 432 RunEventTest(url, kSwapBuffersEvent, true); | 421 RunTest(url, EXPECT_GPU_SWAP_BUFFERS); |
| 433 } | 422 } |
| 434 | 423 |
| 435 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, RafNoDamage) { | 424 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, RafNoDamage) { |
| 436 trace_categories_ = "-test_*"; | 425 trace_categories_ = "-test_*"; |
| 437 const FilePath url(FILE_PATH_LITERAL("feature_raf_no_damage.html")); | 426 const FilePath url(FILE_PATH_LITERAL("feature_raf_no_damage.html")); |
| 438 RunEventTest(url); | 427 RunTest(url, GpuResultFlags(0)); |
| 439 | 428 |
| 440 if (!analyzer_.get()) | 429 if (!analyzer_.get()) |
| 441 return; | 430 return; |
| 442 | 431 |
| 443 // Search for matching name on begin event or async_begin event (any begin). | 432 // Search for matching name on begin event or async_begin event (any begin). |
| 444 Query query_raf = | 433 Query query_raf = |
| 445 (Query::EventPhaseIs(TRACE_EVENT_PHASE_BEGIN) || | 434 (Query::EventPhaseIs(TRACE_EVENT_PHASE_BEGIN) || |
| 446 Query::EventPhaseIs(TRACE_EVENT_PHASE_ASYNC_BEGIN)) && | 435 Query::EventPhaseIs(TRACE_EVENT_PHASE_ASYNC_BEGIN)) && |
| 447 Query::EventNameIs("___RafWithNoDamage___"); | 436 Query::EventNameIs("___RafWithNoDamage___"); |
| 448 TraceEventVector events; | 437 TraceEventVector events; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 base::StringPrintf( | 523 base::StringPrintf( |
| 535 "%d (resize offset %d): IOSurface width %d -> %d; Creates %d " | 524 "%d (resize offset %d): IOSurface width %d -> %d; Creates %d " |
| 536 "Expected %d", offset_i, offsets[offset_i], | 525 "Expected %d", offset_i, offsets[offset_i], |
| 537 old_width, new_width, num_creates, expected_creates); | 526 old_width, new_width, num_creates, expected_creates); |
| 538 } | 527 } |
| 539 } | 528 } |
| 540 } | 529 } |
| 541 #endif | 530 #endif |
| 542 | 531 |
| 543 } // namespace anonymous | 532 } // namespace anonymous |
| OLD | NEW |