| 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" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "chrome/browser/ui/window_snapshot/window_snapshot.h" | 21 #include "chrome/browser/ui/window_snapshot/window_snapshot.h" |
| 22 #include "chrome/common/chrome_paths.h" | 22 #include "chrome/common/chrome_paths.h" |
| 23 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
| 24 #include "chrome/test/base/test_switches.h" | 24 #include "chrome/test/base/test_switches.h" |
| 25 #include "chrome/test/base/tracing.h" | 25 #include "chrome/test/base/tracing.h" |
| 26 #include "chrome/test/base/ui_test_utils.h" | 26 #include "chrome/test/base/ui_test_utils.h" |
| 27 #include "chrome/test/perf/browser_perf_test.h" | 27 #include "chrome/test/perf/browser_perf_test.h" |
| 28 #include "chrome/test/perf/perf_test.h" | 28 #include "chrome/test/perf/perf_test.h" |
| 29 #include "content/public/browser/web_contents.h" | 29 #include "content/public/browser/web_contents.h" |
| 30 #include "content/public/common/content_switches.h" | 30 #include "content/public/common/content_switches.h" |
| 31 #include "content/public/test/browser_test_utils.h" |
| 31 #include "content/test/gpu/gpu_test_config.h" | 32 #include "content/test/gpu/gpu_test_config.h" |
| 32 #include "googleurl/src/gurl.h" | 33 #include "googleurl/src/gurl.h" |
| 33 #include "net/base/mock_host_resolver.h" | 34 #include "net/base/mock_host_resolver.h" |
| 34 #include "net/base/net_util.h" | 35 #include "net/base/net_util.h" |
| 35 #include "testing/gtest/include/gtest/gtest.h" | 36 #include "testing/gtest/include/gtest/gtest.h" |
| 36 #include "third_party/skia/include/core/SkBitmap.h" | 37 #include "third_party/skia/include/core/SkBitmap.h" |
| 37 #include "third_party/skia/include/core/SkColor.h" | 38 #include "third_party/skia/include/core/SkColor.h" |
| 38 #include "ui/gfx/codec/png_codec.h" | 39 #include "ui/gfx/codec/png_codec.h" |
| 39 #include "ui/gl/gl_switches.h" | 40 #include "ui/gl/gl_switches.h" |
| 40 | 41 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 command_line->AppendSwitch(switches::kDisableExperimentalWebGL); | 195 command_line->AppendSwitch(switches::kDisableExperimentalWebGL); |
| 195 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); | 196 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); |
| 196 } | 197 } |
| 197 } | 198 } |
| 198 | 199 |
| 199 void Wait(int ms) { | 200 void Wait(int ms) { |
| 200 base::RunLoop run_loop; | 201 base::RunLoop run_loop; |
| 201 MessageLoop::current()->PostDelayedTask( | 202 MessageLoop::current()->PostDelayedTask( |
| 202 FROM_HERE, run_loop.QuitClosure(), | 203 FROM_HERE, run_loop.QuitClosure(), |
| 203 base::TimeDelta::FromMilliseconds(ms)); | 204 base::TimeDelta::FromMilliseconds(ms)); |
| 204 ui_test_utils::RunThisRunLoop(&run_loop); | 205 content::RunThisRunLoop(&run_loop); |
| 205 } | 206 } |
| 206 | 207 |
| 207 // Take snapshot of the current tab, encode it as PNG, and save to a SkBitmap. | 208 // Take snapshot of the current tab, encode it as PNG, and save to a SkBitmap. |
| 208 bool TabSnapShotToImage(SkBitmap* bitmap) { | 209 bool TabSnapShotToImage(SkBitmap* bitmap) { |
| 209 CHECK(bitmap); | 210 CHECK(bitmap); |
| 210 std::vector<unsigned char> png; | 211 std::vector<unsigned char> png; |
| 211 | 212 |
| 212 gfx::Rect root_bounds = browser()->window()->GetBounds(); | 213 gfx::Rect root_bounds = browser()->window()->GetBounds(); |
| 213 gfx::Rect tab_contents_bounds; | 214 gfx::Rect tab_contents_bounds; |
| 214 chrome::GetActiveWebContents(browser())->GetContainerBounds( | 215 chrome::GetActiveWebContents(browser())->GetContainerBounds( |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 | 553 |
| 553 IN_PROC_BROWSER_TEST_F(ThroughputTestSW, CanvasManyImagesSW) { | 554 IN_PROC_BROWSER_TEST_F(ThroughputTestSW, CanvasManyImagesSW) { |
| 554 RunCanvasBenchTest("many_images", kNone); | 555 RunCanvasBenchTest("many_images", kNone); |
| 555 } | 556 } |
| 556 | 557 |
| 557 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, CanvasManyImagesGPU) { | 558 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, CanvasManyImagesGPU) { |
| 558 RunCanvasBenchTest("many_images", kNone | kIsGpuCanvasTest); | 559 RunCanvasBenchTest("many_images", kNone | kIsGpuCanvasTest); |
| 559 } | 560 } |
| 560 | 561 |
| 561 } // namespace | 562 } // namespace |
| OLD | NEW |