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