Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Side by Side Diff: chrome/test/perf/rendering/throughput_tests.cc

Issue 12334073: Remove WebContents methods that duplicate WebContentsView methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/files/file_path.h" 7 #include "base/files/file_path.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/run_loop.h"
12 #include "base/stringprintf.h" 12 #include "base/stringprintf.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "base/test/trace_event_analyzer.h" 14 #include "base/test/trace_event_analyzer.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "chrome/browser/net/url_fixer_upper.h" 16 #include "chrome/browser/net/url_fixer_upper.h"
17 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
18 #include "chrome/browser/ui/browser_window.h" 18 #include "chrome/browser/ui/browser_window.h"
19 #include "chrome/browser/ui/tabs/tab_strip_model.h" 19 #include "chrome/browser/ui/tabs/tab_strip_model.h"
20 #include "chrome/browser/ui/window_snapshot/window_snapshot.h" 20 #include "chrome/browser/ui/window_snapshot/window_snapshot.h"
21 #include "chrome/common/chrome_paths.h" 21 #include "chrome/common/chrome_paths.h"
22 #include "chrome/common/chrome_switches.h" 22 #include "chrome/common/chrome_switches.h"
23 #include "chrome/test/base/test_switches.h" 23 #include "chrome/test/base/test_switches.h"
24 #include "chrome/test/base/tracing.h" 24 #include "chrome/test/base/tracing.h"
25 #include "chrome/test/base/ui_test_utils.h" 25 #include "chrome/test/base/ui_test_utils.h"
26 #include "chrome/test/perf/browser_perf_test.h" 26 #include "chrome/test/perf/browser_perf_test.h"
27 #include "chrome/test/perf/perf_test.h" 27 #include "chrome/test/perf/perf_test.h"
28 #include "content/public/browser/web_contents.h" 28 #include "content/public/browser/web_contents.h"
29 #include "content/public/browser/web_contents_view.h"
29 #include "content/public/common/content_switches.h" 30 #include "content/public/common/content_switches.h"
30 #include "content/public/test/browser_test_utils.h" 31 #include "content/public/test/browser_test_utils.h"
31 #include "content/public/test/test_utils.h" 32 #include "content/public/test/test_utils.h"
32 #include "content/test/gpu/gpu_test_config.h" 33 #include "content/test/gpu/gpu_test_config.h"
33 #include "googleurl/src/gurl.h" 34 #include "googleurl/src/gurl.h"
34 #include "net/base/mock_host_resolver.h" 35 #include "net/base/mock_host_resolver.h"
35 #include "net/base/net_util.h" 36 #include "net/base/net_util.h"
36 #include "testing/gtest/include/gtest/gtest.h" 37 #include "testing/gtest/include/gtest/gtest.h"
37 #include "third_party/skia/include/core/SkBitmap.h" 38 #include "third_party/skia/include/core/SkBitmap.h"
38 #include "third_party/skia/include/core/SkColor.h" 39 #include "third_party/skia/include/core/SkColor.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 content::RunThisRunLoop(&run_loop); 214 content::RunThisRunLoop(&run_loop);
214 } 215 }
215 216
216 // Take snapshot of the current tab, encode it as PNG, and save to a SkBitmap. 217 // Take snapshot of the current tab, encode it as PNG, and save to a SkBitmap.
217 bool TabSnapShotToImage(SkBitmap* bitmap) { 218 bool TabSnapShotToImage(SkBitmap* bitmap) {
218 CHECK(bitmap); 219 CHECK(bitmap);
219 std::vector<unsigned char> png; 220 std::vector<unsigned char> png;
220 221
221 gfx::Rect root_bounds = browser()->window()->GetBounds(); 222 gfx::Rect root_bounds = browser()->window()->GetBounds();
222 gfx::Rect tab_contents_bounds; 223 gfx::Rect tab_contents_bounds;
223 browser()->tab_strip_model()->GetActiveWebContents()->GetContainerBounds( 224 browser()->tab_strip_model()->GetActiveWebContents()->GetView()->
224 &tab_contents_bounds); 225 GetContainerBounds(&tab_contents_bounds);
225 226
226 gfx::Rect snapshot_bounds(tab_contents_bounds.x() - root_bounds.x(), 227 gfx::Rect snapshot_bounds(tab_contents_bounds.x() - root_bounds.x(),
227 tab_contents_bounds.y() - root_bounds.y(), 228 tab_contents_bounds.y() - root_bounds.y(),
228 tab_contents_bounds.width(), 229 tab_contents_bounds.width(),
229 tab_contents_bounds.height()); 230 tab_contents_bounds.height());
230 231
231 gfx::NativeWindow native_window = browser()->window()->GetNativeWindow(); 232 gfx::NativeWindow native_window = browser()->window()->GetNativeWindow();
232 if (!chrome::GrabWindowSnapshotForUser(native_window, &png, 233 if (!chrome::GrabWindowSnapshotForUser(native_window, &png,
233 snapshot_bounds)) { 234 snapshot_bounds)) {
234 LOG(ERROR) << "browser::GrabWindowSnapShot() failed"; 235 LOG(ERROR) << "browser::GrabWindowSnapShot() failed";
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 588
588 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, CanvasManyImagesGPU) { 589 IN_PROC_BROWSER_TEST_F(ThroughputTestGPU, CanvasManyImagesGPU) {
589 RunCanvasBenchTest("many_images", kNone | kIsGpuCanvasTest); 590 RunCanvasBenchTest("many_images", kNone | kIsGpuCanvasTest);
590 } 591 }
591 592
592 IN_PROC_BROWSER_TEST_F(ThroughputTestThread, CanvasManyImagesGPU) { 593 IN_PROC_BROWSER_TEST_F(ThroughputTestThread, CanvasManyImagesGPU) {
593 RunCanvasBenchTest("many_images", kNone | kIsGpuCanvasTest); 594 RunCanvasBenchTest("many_images", kNone | kIsGpuCanvasTest);
594 } 595 }
595 596
596 } // namespace 597 } // namespace
OLDNEW
« no previous file with comments | « chrome/test/gpu/gpu_pixel_browsertest.cc ('k') | components/web_contents_delegate_android/color_chooser_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698