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

Side by Side Diff: chrome/test/gpu/gpu_pixel_browsertest.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
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/test/perf/rendering/throughput_tests.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/path_service.h" 8 #include "base/path_service.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_window.h" 13 #include "chrome/browser/ui/browser_window.h"
14 #include "chrome/browser/ui/tabs/tab_strip_model.h" 14 #include "chrome/browser/ui/tabs/tab_strip_model.h"
15 #include "chrome/browser/ui/window_snapshot/window_snapshot.h" 15 #include "chrome/browser/ui/window_snapshot/window_snapshot.h"
16 #include "chrome/common/chrome_switches.h" 16 #include "chrome/common/chrome_switches.h"
17 #include "chrome/common/chrome_version_info.h" 17 #include "chrome/common/chrome_version_info.h"
18 #include "chrome/test/base/in_process_browser_test.h" 18 #include "chrome/test/base/in_process_browser_test.h"
19 #include "chrome/test/base/test_launcher_utils.h" 19 #include "chrome/test/base/test_launcher_utils.h"
20 #include "chrome/test/base/tracing.h" 20 #include "chrome/test/base/tracing.h"
21 #include "chrome/test/base/ui_test_utils.h" 21 #include "chrome/test/base/ui_test_utils.h"
22 #include "content/public/browser/render_view_host.h" 22 #include "content/public/browser/render_view_host.h"
23 #include "content/public/browser/web_contents.h" 23 #include "content/public/browser/web_contents.h"
24 #include "content/public/browser/web_contents_view.h"
24 #include "content/public/common/content_paths.h" 25 #include "content/public/common/content_paths.h"
25 #include "content/public/common/content_switches.h" 26 #include "content/public/common/content_switches.h"
26 #include "content/public/test/browser_test_utils.h" 27 #include "content/public/test/browser_test_utils.h"
27 #include "googleurl/src/gurl.h" 28 #include "googleurl/src/gurl.h"
28 #include "net/base/net_util.h" 29 #include "net/base/net_util.h"
29 #include "testing/gtest/include/gtest/gtest.h" 30 #include "testing/gtest/include/gtest/gtest.h"
30 #include "third_party/skia/include/core/SkBitmap.h" 31 #include "third_party/skia/include/core/SkBitmap.h"
31 #include "third_party/skia/include/core/SkColor.h" 32 #include "third_party/skia/include/core/SkColor.h"
32 #include "ui/compositor/compositor_setup.h" 33 #include "ui/compositor/compositor_setup.h"
33 #include "ui/gfx/codec/png_codec.h" 34 #include "ui/gfx/codec/png_codec.h"
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 return true; 386 return true;
386 } 387 }
387 388
388 // Take snapshot of the current tab, encode it as PNG, and save to a SkBitmap. 389 // Take snapshot of the current tab, encode it as PNG, and save to a SkBitmap.
389 bool TabSnapShotToImage(SkBitmap* bitmap) { 390 bool TabSnapShotToImage(SkBitmap* bitmap) {
390 CHECK(bitmap); 391 CHECK(bitmap);
391 std::vector<unsigned char> png; 392 std::vector<unsigned char> png;
392 393
393 gfx::Rect root_bounds = browser()->window()->GetBounds(); 394 gfx::Rect root_bounds = browser()->window()->GetBounds();
394 gfx::Rect tab_contents_bounds; 395 gfx::Rect tab_contents_bounds;
395 browser()->tab_strip_model()->GetActiveWebContents()->GetContainerBounds( 396 browser()->tab_strip_model()->GetActiveWebContents()->GetView()->
396 &tab_contents_bounds); 397 GetContainerBounds(&tab_contents_bounds);
397 398
398 gfx::Rect snapshot_bounds(tab_contents_bounds.x() - root_bounds.x(), 399 gfx::Rect snapshot_bounds(tab_contents_bounds.x() - root_bounds.x(),
399 tab_contents_bounds.y() - root_bounds.y(), 400 tab_contents_bounds.y() - root_bounds.y(),
400 tab_contents_bounds.width(), 401 tab_contents_bounds.width(),
401 tab_contents_bounds.height()); 402 tab_contents_bounds.height());
402 403
403 gfx::NativeWindow native_window = browser()->window()->GetNativeWindow(); 404 gfx::NativeWindow native_window = browser()->window()->GetNativeWindow();
404 if (!chrome::GrabWindowSnapshotForUser(native_window, &png, 405 if (!chrome::GrabWindowSnapshotForUser(native_window, &png,
405 snapshot_bounds)) { 406 snapshot_bounds)) {
406 LOG(ERROR) << "browser::GrabWindowSnapShot() failed"; 407 LOG(ERROR) << "browser::GrabWindowSnapShot() failed";
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 {160, 100, 0, 0, 0} 540 {160, 100, 0, 0, 0}
540 }; 541 };
541 const size_t ref_pixel_count = sizeof(ref_pixels) / sizeof(ReferencePixel); 542 const size_t ref_pixel_count = sizeof(ref_pixels) / sizeof(ReferencePixel);
542 543
543 gfx::Size container_size(400, 300); 544 gfx::Size container_size(400, 300);
544 base::FilePath url = 545 base::FilePath url =
545 test_data_dir().AppendASCII("pixel_canvas2d.html"); 546 test_data_dir().AppendASCII("pixel_canvas2d.html");
546 RunPixelTest(container_size, url, ref_img_revision_update, 547 RunPixelTest(container_size, url, ref_img_revision_update,
547 ref_pixels, ref_pixel_count); 548 ref_pixels, ref_pixel_count);
548 } 549 }
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/test/perf/rendering/throughput_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698