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

Side by Side Diff: chrome/test/automation/automation_proxy_uitest.cc

Issue 5572001: Send screenshots back to the client for debugging (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: need to push again to make sure rietveld didn't screw up Created 9 years, 8 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/test/automation/automation_json_requests.cc ('k') | chrome/test/automation/tab_proxy.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <string> 5 #include <string>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 1602 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 return filename.AppendASCII("automation_proxy_snapshot") 1613 return filename.AppendASCII("automation_proxy_snapshot")
1614 .AppendASCII(relative_path); 1614 .AppendASCII(relative_path);
1615 } 1615 }
1616 1616
1617 FilePath snapshot_path_; 1617 FilePath snapshot_path_;
1618 ScopedTempDir snapshot_dir_; 1618 ScopedTempDir snapshot_dir_;
1619 }; 1619 };
1620 1620
1621 // See http://crbug.com/63022. 1621 // See http://crbug.com/63022.
1622 #if defined(OS_LINUX) 1622 #if defined(OS_LINUX)
1623 #define MAYBE_ContentSmallerThanView FAILS_ContentSmallerThanView
1624 #else
1625 #define MAYBE_ContentSmallerThanView ContentSmallerThanView
1626 #endif
1627 // Tests that taking a snapshot when the content is smaller than the view
1628 // produces a snapshot equal to the view size.
1629 TEST_F(AutomationProxySnapshotTest, MAYBE_ContentSmallerThanView) {
1630 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
1631 ASSERT_TRUE(browser.get());
1632
1633 scoped_refptr<WindowProxy> window(browser->GetWindow());
1634 ASSERT_TRUE(window.get());
1635 ASSERT_TRUE(window->SetBounds(gfx::Rect(300, 400)));
1636
1637 scoped_refptr<TabProxy> tab(browser->GetTab(0));
1638 ASSERT_TRUE(tab.get());
1639
1640 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS,
1641 tab->NavigateToURL(GURL(chrome::kAboutBlankURL)));
1642
1643 gfx::Rect view_bounds;
1644 ASSERT_TRUE(window->GetViewBounds(VIEW_ID_TAB_CONTAINER, &view_bounds,
1645 false));
1646
1647 ASSERT_TRUE(tab->CaptureEntirePageAsPNG(snapshot_path_));
1648
1649 SkBitmap bitmap;
1650 ASSERT_NO_FATAL_FAILURE(AssertReadPNG(snapshot_path_, &bitmap));
1651 ASSERT_EQ(view_bounds.width(), bitmap.width());
1652 ASSERT_EQ(view_bounds.height(), bitmap.height());
1653 }
1654
1655 // See http://crbug.com/63022.
1656 #if defined(OS_LINUX)
1657 #define MAYBE_ContentLargerThanView FAILS_ContentLargerThanView 1623 #define MAYBE_ContentLargerThanView FAILS_ContentLargerThanView
1658 #else 1624 #else
1659 #define MAYBE_ContentLargerThanView ContentLargerThanView 1625 #define MAYBE_ContentLargerThanView ContentLargerThanView
1660 #endif 1626 #endif
1661 // Tests that taking a snapshot when the content is larger than the view 1627 // Tests that taking a snapshot when the content is larger than the view
1662 // produces a snapshot equal to the content size. 1628 // produces a snapshot equal to the content size.
1663 TEST_F(AutomationProxySnapshotTest, MAYBE_ContentLargerThanView) { 1629 TEST_F(AutomationProxySnapshotTest, MAYBE_ContentLargerThanView) {
1664 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); 1630 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
1665 ASSERT_TRUE(browser.get()); 1631 ASSERT_TRUE(browser.get());
1666 1632
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1752 int diff_pixels_count = 0; 1718 int diff_pixels_count = 0;
1753 for (int x = 0; x < img_size.width(); ++x) { 1719 for (int x = 0; x < img_size.width(); ++x) {
1754 for (int y = 0; y < img_size.height(); ++y) { 1720 for (int y = 0; y < img_size.height(); ++y) {
1755 if (*snapshot_bmp.getAddr32(x, y) != *reference_bmp.getAddr32(x, y)) { 1721 if (*snapshot_bmp.getAddr32(x, y) != *reference_bmp.getAddr32(x, y)) {
1756 ++diff_pixels_count; 1722 ++diff_pixels_count;
1757 } 1723 }
1758 } 1724 }
1759 } 1725 }
1760 ASSERT_EQ(diff_pixels_count, 0); 1726 ASSERT_EQ(diff_pixels_count, 0);
1761 } 1727 }
OLDNEW
« no previous file with comments | « chrome/test/automation/automation_json_requests.cc ('k') | chrome/test/automation/tab_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698