| OLD | NEW |
| 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/tab_contents/core_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/browser/ui/window_sizer.h" | 14 #include "chrome/browser/ui/window_sizer.h" |
| 14 #include "chrome/common/chrome_notification_types.h" | 15 #include "chrome/common/chrome_notification_types.h" |
| 15 #include "chrome/common/chrome_paths.h" | 16 #include "chrome/common/chrome_paths.h" |
| 16 #include "chrome/test/base/in_process_browser_test.h" | 17 #include "chrome/test/base/in_process_browser_test.h" |
| 17 #include "chrome/test/base/ui_test_utils.h" | 18 #include "chrome/test/base/ui_test_utils.h" |
| 18 #include "content/browser/renderer_host/render_view_host.h" | 19 #include "content/browser/renderer_host/render_view_host.h" |
| 19 #include "content/browser/tab_contents/tab_contents.h" | 20 #include "content/browser/tab_contents/tab_contents.h" |
| 20 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
| 21 #include "net/test/test_server.h" | 22 #include "net/test/test_server.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 GURL url(ui_test_utils::GetTestUrl( | 73 GURL url(ui_test_utils::GetTestUrl( |
| 73 GetPDFTestDir(), | 74 GetPDFTestDir(), |
| 74 FilePath(FILE_PATH_LITERAL("pdf_browsertest.pdf")))); | 75 FilePath(FILE_PATH_LITERAL("pdf_browsertest.pdf")))); |
| 75 ui_test_utils::NavigateToURL(browser(), url); | 76 ui_test_utils::NavigateToURL(browser(), url); |
| 76 } | 77 } |
| 77 | 78 |
| 78 void VerifySnapshot(const std::string& expected_filename) { | 79 void VerifySnapshot(const std::string& expected_filename) { |
| 79 snapshot_different_ = true; | 80 snapshot_different_ = true; |
| 80 expected_filename_ = expected_filename; | 81 expected_filename_ = expected_filename; |
| 81 TabContentsWrapper* wrapper = browser()->GetSelectedTabContentsWrapper(); | 82 TabContentsWrapper* wrapper = browser()->GetSelectedTabContentsWrapper(); |
| 82 wrapper->CaptureSnapshot(); | 83 wrapper->core_tab_helper()->CaptureSnapshot(); |
| 83 ui_test_utils::RegisterAndWait( | 84 ui_test_utils::RegisterAndWait( |
| 84 this, | 85 this, |
| 85 chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN, | 86 chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN, |
| 86 content::Source<TabContentsWrapper>(wrapper)); | 87 content::Source<TabContentsWrapper>(wrapper)); |
| 87 ASSERT_FALSE(snapshot_different_) << "Rendering didn't match, see result " | 88 ASSERT_FALSE(snapshot_different_) << "Rendering didn't match, see result " |
| 88 "at " << snapshot_filename_.value().c_str(); | 89 "at " << snapshot_filename_.value().c_str(); |
| 89 } | 90 } |
| 90 | 91 |
| 91 void WaitForResponse() { | 92 void WaitForResponse() { |
| 92 // Even if the plugin has loaded the data or scrolled, because of how | 93 // 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 Loading... |
| 353 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( | 354 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( |
| 354 browser()->GetSelectedTabContents()->render_view_host(), | 355 browser()->GetSelectedTabContents()->render_view_host(), |
| 355 std::wstring(), | 356 std::wstring(), |
| 356 L"reloadPDF();")); | 357 L"reloadPDF();")); |
| 357 observer.Wait(); | 358 observer.Wait(); |
| 358 | 359 |
| 359 ASSERT_EQ("success", browser()->GetSelectedTabContents()->GetURL().query()); | 360 ASSERT_EQ("success", browser()->GetSelectedTabContents()->GetURL().query()); |
| 360 } | 361 } |
| 361 | 362 |
| 362 } // namespace | 363 } // namespace |
| OLD | NEW |