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

Side by Side Diff: chrome/browser/ui/pdf/pdf_browsertest.cc

Issue 10828360: Try two different pixel results for mac for the PDFBrowserTest.Basic test. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 | « no previous file | no next file » | 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/file_util.h" 5 #include "base/file_util.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "base/string_number_conversions.h" 7 #include "base/string_number_conversions.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 ASSERT_GT(screen_bounds.width(), kBrowserWidth); 73 ASSERT_GT(screen_bounds.width(), kBrowserWidth);
74 ASSERT_GT(screen_bounds.height(), kBrowserHeight); 74 ASSERT_GT(screen_bounds.height(), kBrowserHeight);
75 browser()->window()->SetBounds(bounds); 75 browser()->window()->SetBounds(bounds);
76 76
77 GURL url(ui_test_utils::GetTestUrl( 77 GURL url(ui_test_utils::GetTestUrl(
78 GetPDFTestDir(), 78 GetPDFTestDir(),
79 FilePath(FILE_PATH_LITERAL("pdf_browsertest.pdf")))); 79 FilePath(FILE_PATH_LITERAL("pdf_browsertest.pdf"))));
80 ui_test_utils::NavigateToURL(browser(), url); 80 ui_test_utils::NavigateToURL(browser(), url);
81 } 81 }
82 82
83 void VerifySnapshot(const std::string& expected_filename) { 83 bool VerifySnapshot(const std::string& expected_filename) {
84 snapshot_different_ = true; 84 snapshot_different_ = true;
85 expected_filename_ = expected_filename; 85 expected_filename_ = expected_filename;
86 TabContents* tab_contents = chrome::GetActiveTabContents(browser()); 86 TabContents* tab_contents = chrome::GetActiveTabContents(browser());
87 tab_contents->snapshot_tab_helper()->CaptureSnapshot(); 87 tab_contents->snapshot_tab_helper()->CaptureSnapshot();
88 ui_test_utils::RegisterAndWait( 88 ui_test_utils::RegisterAndWait(
89 this, 89 this,
90 chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN, 90 chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN,
91 content::Source<WebContents>(tab_contents->web_contents())); 91 content::Source<WebContents>(tab_contents->web_contents()));
92 ASSERT_FALSE(snapshot_different_) << "Rendering didn't match, see result " 92 if (snapshot_different_) {
93 "at " << snapshot_filename_.value().c_str(); 93 LOG(INFO) << "Rendering didn't match, see result " <<
94 snapshot_filename_.value().c_str();
95 }
96 return !snapshot_different_;
94 } 97 }
95 98
96 void WaitForResponse() { 99 void WaitForResponse() {
97 // Even if the plugin has loaded the data or scrolled, because of how 100 // Even if the plugin has loaded the data or scrolled, because of how
98 // pepper painting works, we might not have the data. One way to force this 101 // pepper painting works, we might not have the data. One way to force this
99 // to be flushed is to do a find operation, since on this two-page test 102 // to be flushed is to do a find operation, since on this two-page test
100 // document, it'll wait for us to flush the renderer message loop twice and 103 // document, it'll wait for us to flush the renderer message loop twice and
101 // also the browser's once, at which point we're guaranteed to have updated 104 // also the browser's once, at which point we're guaranteed to have updated
102 // the backingstore. Hacky, but it works. 105 // the backingstore. Hacky, but it works.
103 // Note that we need to change the text each time, because if we don't the 106 // Note that we need to change the text each time, because if we don't the
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 FilePath snapshot_filename_; 196 FilePath snapshot_filename_;
194 // How many times we've seen chrome::LOAD_STOP. 197 // How many times we've seen chrome::LOAD_STOP.
195 int load_stop_notification_count_; 198 int load_stop_notification_count_;
196 199
197 scoped_ptr<net::TestServer> pdf_test_server_; 200 scoped_ptr<net::TestServer> pdf_test_server_;
198 }; 201 };
199 202
200 #if defined(OS_CHROMEOS) 203 #if defined(OS_CHROMEOS)
201 // TODO(sanjeevr): http://crbug.com/79837 204 // TODO(sanjeevr): http://crbug.com/79837
202 #define MAYBE_Basic DISABLED_Basic 205 #define MAYBE_Basic DISABLED_Basic
203 #elif defined(OS_MACOSX)
204 // Fails on release builder for Mac: http://crbug.com/142531
205 #define MAYBE_Basic DISABLED_Basic
206 #else 206 #else
207 #define MAYBE_Basic Basic 207 #define MAYBE_Basic Basic
208 #endif 208 #endif
209 // Tests basic PDF rendering. This can be broken depending on bad merges with 209 // Tests basic PDF rendering. This can be broken depending on bad merges with
210 // the vendor, so it's important that we have basic sanity checking. 210 // the vendor, so it's important that we have basic sanity checking.
211 IN_PROC_BROWSER_TEST_F(PDFBrowserTest, MAYBE_Basic) { 211 IN_PROC_BROWSER_TEST_F(PDFBrowserTest, MAYBE_Basic) {
212 ASSERT_NO_FATAL_FAILURE(Load()); 212 ASSERT_NO_FATAL_FAILURE(Load());
213 ASSERT_NO_FATAL_FAILURE(WaitForResponse()); 213 ASSERT_NO_FATAL_FAILURE(WaitForResponse());
214 // OS X uses CoreText, and FreeType renders slightly different on Linux and 214 // OS X uses CoreText, and FreeType renders slightly different on Linux and
215 // Win. 215 // Win.
216 #if defined(OS_MACOSX) 216 #if defined(OS_MACOSX)
217 std::string expectation_file = "pdf_browsertest_mac.png"; 217 // The bots render differently than locally, see http://crbug.com/142531.
218 ASSERT_TRUE(VerifySnapshot("pdf_browsertest_mac.png") ||
219 VerifySnapshot("pdf_browsertest_mac2.png"));
218 #elif defined(OS_LINUX) 220 #elif defined(OS_LINUX)
219 std::string expectation_file = "pdf_browsertest_linux.png"; 221 ASSERT_TRUE(VerifySnapshot("pdf_browsertest_linux.png"));
220 #else 222 #else
221 std::string expectation_file = "pdf_browsertest.png"; 223 ASSERT_TRUE(VerifySnapshot("pdf_browsertest.png"));
222 #endif 224 #endif
223 ASSERT_NO_FATAL_FAILURE(VerifySnapshot(expectation_file));
224 } 225 }
225 226
226 #if defined(OS_CHROMEOS) 227 #if defined(OS_CHROMEOS)
227 // TODO(sanjeevr): http://crbug.com/79837 228 // TODO(sanjeevr): http://crbug.com/79837
228 #define MAYBE_Scroll DISABLED_Scroll 229 #define MAYBE_Scroll DISABLED_Scroll
229 #else 230 #else
230 #define MAYBE_Scroll Scroll 231 #define MAYBE_Scroll Scroll
231 #endif 232 #endif
232 // Tests that scrolling works. 233 // Tests that scrolling works.
233 IN_PROC_BROWSER_TEST_F(PDFBrowserTest, MAYBE_Scroll) { 234 IN_PROC_BROWSER_TEST_F(PDFBrowserTest, MAYBE_Scroll) {
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), 358 chrome::GetActiveWebContents(browser())->GetRenderViewHost(),
358 std::wstring(), 359 std::wstring(),
359 L"reloadPDF();")); 360 L"reloadPDF();"));
360 observer.Wait(); 361 observer.Wait();
361 362
362 ASSERT_EQ("success", 363 ASSERT_EQ("success",
363 chrome::GetActiveWebContents(browser())->GetURL().query()); 364 chrome::GetActiveWebContents(browser())->GetURL().query());
364 } 365 }
365 366
366 } // namespace 367 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698