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/browser/ui/pdf/pdf_browsertest.cc

Issue 8865004: Create CoreTabHelper, move remaining core TCW functionality into it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: lots of helpers now Created 9 years 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) 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 "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"
11 #include "chrome/browser/ui/browser_window.h" 11 #include "chrome/browser/ui/browser_window.h"
12 #include "chrome/browser/ui/snapshot_tab_helper.h"
12 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 13 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
13 #include "chrome/common/chrome_notification_types.h" 14 #include "chrome/common/chrome_notification_types.h"
14 #include "chrome/common/chrome_paths.h" 15 #include "chrome/common/chrome_paths.h"
15 #include "chrome/test/base/in_process_browser_test.h" 16 #include "chrome/test/base/in_process_browser_test.h"
16 #include "chrome/test/base/ui_test_utils.h" 17 #include "chrome/test/base/ui_test_utils.h"
17 #include "content/browser/renderer_host/render_view_host.h" 18 #include "content/browser/renderer_host/render_view_host.h"
18 #include "content/browser/tab_contents/tab_contents.h" 19 #include "content/browser/tab_contents/tab_contents.h"
19 #include "content/public/browser/notification_observer.h" 20 #include "content/public/browser/notification_observer.h"
20 #include "net/test/test_server.h" 21 #include "net/test/test_server.h"
21 #include "ui/base/clipboard/clipboard.h" 22 #include "ui/base/clipboard/clipboard.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 GURL url(ui_test_utils::GetTestUrl( 71 GURL url(ui_test_utils::GetTestUrl(
71 GetPDFTestDir(), 72 GetPDFTestDir(),
72 FilePath(FILE_PATH_LITERAL("pdf_browsertest.pdf")))); 73 FilePath(FILE_PATH_LITERAL("pdf_browsertest.pdf"))));
73 ui_test_utils::NavigateToURL(browser(), url); 74 ui_test_utils::NavigateToURL(browser(), url);
74 } 75 }
75 76
76 void VerifySnapshot(const std::string& expected_filename) { 77 void VerifySnapshot(const std::string& expected_filename) {
77 snapshot_different_ = true; 78 snapshot_different_ = true;
78 expected_filename_ = expected_filename; 79 expected_filename_ = expected_filename;
79 TabContentsWrapper* wrapper = browser()->GetSelectedTabContentsWrapper(); 80 TabContentsWrapper* wrapper = browser()->GetSelectedTabContentsWrapper();
80 wrapper->CaptureSnapshot(); 81 wrapper->snapshot_tab_helper()->CaptureSnapshot();
81 ui_test_utils::RegisterAndWait( 82 ui_test_utils::RegisterAndWait(
82 this, 83 this,
83 chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN, 84 chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN,
84 content::Source<TabContentsWrapper>(wrapper)); 85 content::Source<TabContentsWrapper>(wrapper));
85 ASSERT_FALSE(snapshot_different_) << "Rendering didn't match, see result " 86 ASSERT_FALSE(snapshot_different_) << "Rendering didn't match, see result "
86 "at " << snapshot_filename_.value().c_str(); 87 "at " << snapshot_filename_.value().c_str();
87 } 88 }
88 89
89 void WaitForResponse() { 90 void WaitForResponse() {
90 // Even if the plugin has loaded the data or scrolled, because of how 91 // Even if the plugin has loaded the data or scrolled, because of how
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( 352 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript(
352 browser()->GetSelectedTabContents()->render_view_host(), 353 browser()->GetSelectedTabContents()->render_view_host(),
353 std::wstring(), 354 std::wstring(),
354 L"reloadPDF();")); 355 L"reloadPDF();"));
355 observer.Wait(); 356 observer.Wait();
356 357
357 ASSERT_EQ("success", browser()->GetSelectedTabContents()->GetURL().query()); 358 ASSERT_EQ("success", browser()->GetSelectedTabContents()->GetURL().query());
358 } 359 }
359 360
360 } // namespace 361 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698