| OLD | NEW |
| 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/files/file.h" |
| 6 #include "base/files/file_enumerator.h" | 7 #include "base/files/file_enumerator.h" |
| 7 #include "base/hash.h" | 8 #include "base/hash.h" |
| 8 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 9 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
| 13 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/browser_window.h" | 15 #include "chrome/browser/ui/browser_window.h" |
| 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 } | 123 } |
| 123 | 124 |
| 124 private: | 125 private: |
| 125 void GetSnapshotFromRendererCallback(bool success, | 126 void GetSnapshotFromRendererCallback(bool success, |
| 126 const SkBitmap& bitmap) { | 127 const SkBitmap& bitmap) { |
| 127 base::MessageLoopForUI::current()->Quit(); | 128 base::MessageLoopForUI::current()->Quit(); |
| 128 ASSERT_EQ(success, true); | 129 ASSERT_EQ(success, true); |
| 129 base::FilePath reference = ui_test_utils::GetTestFilePath( | 130 base::FilePath reference = ui_test_utils::GetTestFilePath( |
| 130 GetPDFTestDir(), | 131 GetPDFTestDir(), |
| 131 base::FilePath().AppendASCII(expected_filename_)); | 132 base::FilePath().AppendASCII(expected_filename_)); |
| 132 base::PlatformFileInfo info; | 133 base::File::Info info; |
| 133 ASSERT_TRUE(base::GetFileInfo(reference, &info)); | 134 ASSERT_TRUE(base::GetFileInfo(reference, &info)); |
| 134 int size = static_cast<size_t>(info.size); | 135 int size = static_cast<size_t>(info.size); |
| 135 scoped_ptr<char[]> data(new char[size]); | 136 scoped_ptr<char[]> data(new char[size]); |
| 136 ASSERT_EQ(size, base::ReadFile(reference, data.get(), size)); | 137 ASSERT_EQ(size, base::ReadFile(reference, data.get(), size)); |
| 137 | 138 |
| 138 int w, h; | 139 int w, h; |
| 139 std::vector<unsigned char> decoded; | 140 std::vector<unsigned char> decoded; |
| 140 ASSERT_TRUE(gfx::PNGCodec::Decode( | 141 ASSERT_TRUE(gfx::PNGCodec::Decode( |
| 141 reinterpret_cast<unsigned char*>(data.get()), size, | 142 reinterpret_cast<unsigned char*>(data.get()), size, |
| 142 gfx::PNGCodec::FORMAT_BGRA, &decoded, &w, &h)); | 143 gfx::PNGCodec::FORMAT_BGRA, &decoded, &w, &h)); |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 browser()->tab_strip_model()->GetActiveWebContents(), | 418 browser()->tab_strip_model()->GetActiveWebContents(), |
| 418 "reloadPDF();")); | 419 "reloadPDF();")); |
| 419 observer.Wait(); | 420 observer.Wait(); |
| 420 | 421 |
| 421 ASSERT_EQ("success", | 422 ASSERT_EQ("success", |
| 422 browser()->tab_strip_model()->GetActiveWebContents()-> | 423 browser()->tab_strip_model()->GetActiveWebContents()-> |
| 423 GetURL().query()); | 424 GetURL().query()); |
| 424 } | 425 } |
| 425 | 426 |
| 426 } // namespace | 427 } // namespace |
| OLD | NEW |