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