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.h" |
7 #include "base/files/file_enumerator.h" | 7 #include "base/files/file_enumerator.h" |
8 #include "base/hash.h" | 8 #include "base/hash.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 if (pixels[y * stride / sizeof(int32) + x + snapshot_x_offset] != | 179 if (pixels[y * stride / sizeof(int32) + x + snapshot_x_offset] != |
180 ref_pixels[y * w + x + ref_x_offset]) | 180 ref_pixels[y * w + x + ref_x_offset]) |
181 snapshot_different_ = true; | 181 snapshot_different_ = true; |
182 } | 182 } |
183 } | 183 } |
184 | 184 |
185 if (snapshot_different_) { | 185 if (snapshot_different_) { |
186 std::vector<unsigned char> png_data; | 186 std::vector<unsigned char> png_data; |
187 gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &png_data); | 187 gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &png_data); |
188 if (base::CreateTemporaryFile(&snapshot_filename_)) { | 188 if (base::CreateTemporaryFile(&snapshot_filename_)) { |
189 file_util::WriteFile(snapshot_filename_, | 189 base::WriteFile(snapshot_filename_, |
190 reinterpret_cast<char*>(&png_data[0]), png_data.size()); | 190 reinterpret_cast<char*>(&png_data[0]), png_data.size()); |
191 } | 191 } |
192 } | 192 } |
193 } | 193 } |
194 | 194 |
195 // content::NotificationObserver | 195 // content::NotificationObserver |
196 virtual void Observe(int type, | 196 virtual void Observe(int type, |
197 const content::NotificationSource& source, | 197 const content::NotificationSource& source, |
198 const content::NotificationDetails& details) { | 198 const content::NotificationDetails& details) { |
199 if (type == content::NOTIFICATION_LOAD_STOP) { | 199 if (type == content::NOTIFICATION_LOAD_STOP) { |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 browser()->tab_strip_model()->GetActiveWebContents(), | 424 browser()->tab_strip_model()->GetActiveWebContents(), |
425 "reloadPDF();")); | 425 "reloadPDF();")); |
426 observer.Wait(); | 426 observer.Wait(); |
427 | 427 |
428 ASSERT_EQ("success", | 428 ASSERT_EQ("success", |
429 browser()->tab_strip_model()->GetActiveWebContents()-> | 429 browser()->tab_strip_model()->GetActiveWebContents()-> |
430 GetURL().query()); | 430 GetURL().query()); |
431 } | 431 } |
432 | 432 |
433 } // namespace | 433 } // namespace |
OLD | NEW |