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

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

Issue 10909282: Switch SnapshotTabHelper to use WebContentsUserData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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/browser/extensions/api/tabs/tabs.cc ('k') | chrome/browser/ui/snapshot_tab_helper.h » ('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/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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 bool 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 WebContents* web_contents = chrome::GetActiveWebContents(browser());
87 tab_contents->snapshot_tab_helper()->CaptureSnapshot(); 87 SnapshotTabHelper::FromWebContents(web_contents)->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>(web_contents));
92 if (snapshot_different_) { 92 if (snapshot_different_) {
93 LOG(INFO) << "Rendering didn't match, see result " << 93 LOG(INFO) << "Rendering didn't match, see result " <<
94 snapshot_filename_.value().c_str(); 94 snapshot_filename_.value().c_str();
95 } 95 }
96 return !snapshot_different_; 96 return !snapshot_different_;
97 } 97 }
98 98
99 void WaitForResponse() { 99 void WaitForResponse() {
100 // 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
101 // 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
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), 389 chrome::GetActiveWebContents(browser())->GetRenderViewHost(),
390 std::wstring(), 390 std::wstring(),
391 L"reloadPDF();")); 391 L"reloadPDF();"));
392 observer.Wait(); 392 observer.Wait();
393 393
394 ASSERT_EQ("success", 394 ASSERT_EQ("success",
395 chrome::GetActiveWebContents(browser())->GetURL().query()); 395 chrome::GetActiveWebContents(browser())->GetURL().query());
396 } 396 }
397 397
398 } // namespace 398 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/tabs/tabs.cc ('k') | chrome/browser/ui/snapshot_tab_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698