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