| 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_path.h" | 6 #include "base/file_path.h" |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/run_loop.h" |
| 11 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
| 12 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
| 13 #include "base/test/trace_event_analyzer.h" | 14 #include "base/test/trace_event_analyzer.h" |
| 14 #include "base/values.h" | 15 #include "base/values.h" |
| 15 #include "chrome/browser/net/url_fixer_upper.h" | 16 #include "chrome/browser/net/url_fixer_upper.h" |
| 16 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/browser_window.h" | 18 #include "chrome/browser/ui/browser_window.h" |
| 18 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 19 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 19 #include "chrome/browser/ui/window_snapshot/window_snapshot.h" | 20 #include "chrome/browser/ui/window_snapshot/window_snapshot.h" |
| 20 #include "chrome/common/chrome_paths.h" | 21 #include "chrome/common/chrome_paths.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 if (use_gpu_) { | 189 if (use_gpu_) { |
| 189 command_line->AppendSwitch(switches::kForceCompositingMode); | 190 command_line->AppendSwitch(switches::kForceCompositingMode); |
| 190 } else { | 191 } else { |
| 191 command_line->AppendSwitch(switches::kDisableAcceleratedCompositing); | 192 command_line->AppendSwitch(switches::kDisableAcceleratedCompositing); |
| 192 command_line->AppendSwitch(switches::kDisableExperimentalWebGL); | 193 command_line->AppendSwitch(switches::kDisableExperimentalWebGL); |
| 193 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); | 194 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); |
| 194 } | 195 } |
| 195 } | 196 } |
| 196 | 197 |
| 197 void Wait(int ms) { | 198 void Wait(int ms) { |
| 199 base::RunLoop run_loop; |
| 198 MessageLoop::current()->PostDelayedTask( | 200 MessageLoop::current()->PostDelayedTask( |
| 199 FROM_HERE, | 201 FROM_HERE, run_loop.QuitClosure(), |
| 200 MessageLoop::QuitClosure(), | |
| 201 base::TimeDelta::FromMilliseconds(ms)); | 202 base::TimeDelta::FromMilliseconds(ms)); |
| 202 ui_test_utils::RunMessageLoop(); | 203 ui_test_utils::RunThisRunLoop(&run_loop); |
| 203 } | 204 } |
| 204 | 205 |
| 205 // Take snapshot of the current tab, encode it as PNG, and save to a SkBitmap. | 206 // Take snapshot of the current tab, encode it as PNG, and save to a SkBitmap. |
| 206 bool TabSnapShotToImage(SkBitmap* bitmap) { | 207 bool TabSnapShotToImage(SkBitmap* bitmap) { |
| 207 CHECK(bitmap); | 208 CHECK(bitmap); |
| 208 std::vector<unsigned char> png; | 209 std::vector<unsigned char> png; |
| 209 | 210 |
| 210 gfx::Rect root_bounds = browser()->window()->GetBounds(); | 211 gfx::Rect root_bounds = browser()->window()->GetBounds(); |
| 211 gfx::Rect tab_contents_bounds; | 212 gfx::Rect tab_contents_bounds; |
| 212 browser()->GetActiveWebContents()->GetContainerBounds( | 213 browser()->GetActiveWebContents()->GetContainerBounds( |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 // specified, then after spinup_time the test waits for the color at the | 462 // specified, then after spinup_time the test waits for the color at the |
| 462 // specified pixel coordinate to match the given color with the given operator. | 463 // specified pixel coordinate to match the given color with the given operator. |
| 463 IN_PROC_BROWSER_TEST_F(ThroughputTestSW, DISABLED_TestURL) { | 464 IN_PROC_BROWSER_TEST_F(ThroughputTestSW, DISABLED_TestURL) { |
| 464 RunTestWithURL(kAllowExternalDNS); | 465 RunTestWithURL(kAllowExternalDNS); |
| 465 } | 466 } |
| 466 | 467 |
| 467 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, DISABLED_TestURL) { | 468 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, DISABLED_TestURL) { |
| 468 RunTestWithURL(kAllowExternalDNS); | 469 RunTestWithURL(kAllowExternalDNS); |
| 469 } | 470 } |
| 470 | 471 |
| 471 // crbug.com/124049 | 472 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, Particles) { |
| 472 #if defined(OS_MACOSX) | |
| 473 #define MAYBE_Particles DISABLED_Particles | |
| 474 #else | |
| 475 #define MAYBE_Particles Particles | |
| 476 #endif | |
| 477 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, MAYBE_Particles) { | |
| 478 RunTest("particles", kInternal); | 473 RunTest("particles", kInternal); |
| 479 } | 474 } |
| 480 | 475 |
| 481 IN_PROC_BROWSER_TEST_F(ThroughputTestSW, CanvasDemoSW) { | 476 IN_PROC_BROWSER_TEST_F(ThroughputTestSW, CanvasDemoSW) { |
| 482 RunTest("canvas-demo", kInternal); | 477 RunTest("canvas-demo", kInternal); |
| 483 } | 478 } |
| 484 | 479 |
| 485 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, CanvasDemoGPU) { | 480 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, CanvasDemoGPU) { |
| 486 RunTest("canvas-demo", kInternal | kIsGpuCanvasTest); | 481 RunTest("canvas-demo", kInternal | kIsGpuCanvasTest); |
| 487 } | 482 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 RunTest("canvas2d_balls_draw_from_canvas", kNone | kIsGpuCanvasTest); | 515 RunTest("canvas2d_balls_draw_from_canvas", kNone | kIsGpuCanvasTest); |
| 521 } | 516 } |
| 522 | 517 |
| 523 IN_PROC_BROWSER_TEST_F(ThroughputTestSW, CanvasTextSW) { | 518 IN_PROC_BROWSER_TEST_F(ThroughputTestSW, CanvasTextSW) { |
| 524 if (IsGpuAvailable() && | 519 if (IsGpuAvailable() && |
| 525 GPUTestBotConfig::CurrentConfigMatches("MAC AMD")) | 520 GPUTestBotConfig::CurrentConfigMatches("MAC AMD")) |
| 526 return; | 521 return; |
| 527 RunTest("canvas2d_balls_text", kNone); | 522 RunTest("canvas2d_balls_text", kNone); |
| 528 } | 523 } |
| 529 | 524 |
| 530 // crbug.com/124049 | 525 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, CanvasTextGPU) { |
| 531 #if defined(OS_MACOSX) | |
| 532 #define MAYBE_CanvasTextGPU DISABLED_CanvasTextGPU | |
| 533 #else | |
| 534 #define MAYBE_CanvasTextGPU CanvasTextGPU | |
| 535 #endif | |
| 536 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, MAYBE_CanvasTextGPU) { | |
| 537 RunTest("canvas2d_balls_text", kNone | kIsGpuCanvasTest); | 526 RunTest("canvas2d_balls_text", kNone | kIsGpuCanvasTest); |
| 538 } | 527 } |
| 539 | 528 |
| 540 IN_PROC_BROWSER_TEST_F(ThroughputTestSW, CanvasFillPathSW) { | 529 IN_PROC_BROWSER_TEST_F(ThroughputTestSW, CanvasFillPathSW) { |
| 541 RunTest("canvas2d_balls_fill_path", kNone); | 530 RunTest("canvas2d_balls_fill_path", kNone); |
| 542 } | 531 } |
| 543 | 532 |
| 544 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, CanvasFillPathGPU) { | 533 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, CanvasFillPathGPU) { |
| 545 RunTest("canvas2d_balls_fill_path", kNone | kIsGpuCanvasTest); | 534 RunTest("canvas2d_balls_fill_path", kNone | kIsGpuCanvasTest); |
| 546 } | 535 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 558 | 547 |
| 559 IN_PROC_BROWSER_TEST_F(ThroughputTestSW, CanvasManyImagesSW) { | 548 IN_PROC_BROWSER_TEST_F(ThroughputTestSW, CanvasManyImagesSW) { |
| 560 RunCanvasBenchTest("many_images", kNone); | 549 RunCanvasBenchTest("many_images", kNone); |
| 561 } | 550 } |
| 562 | 551 |
| 563 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, CanvasManyImagesGPU) { | 552 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, CanvasManyImagesGPU) { |
| 564 RunCanvasBenchTest("many_images", kNone | kIsGpuCanvasTest); | 553 RunCanvasBenchTest("many_images", kNone | kIsGpuCanvasTest); |
| 565 } | 554 } |
| 566 | 555 |
| 567 } // namespace | 556 } // namespace |
| OLD | NEW |