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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 for (int x = 0; x < x_max && !snapshot_different_; ++x) { | 174 for (int x = 0; x < x_max && !snapshot_different_; ++x) { |
175 if (pixels[y * stride / sizeof(int32) + x + snapshot_x_offset] != | 175 if (pixels[y * stride / sizeof(int32) + x + snapshot_x_offset] != |
176 ref_pixels[y * w + x + ref_x_offset]) | 176 ref_pixels[y * w + x + ref_x_offset]) |
177 snapshot_different_ = true; | 177 snapshot_different_ = true; |
178 } | 178 } |
179 } | 179 } |
180 | 180 |
181 if (snapshot_different_) { | 181 if (snapshot_different_) { |
182 std::vector<unsigned char> png_data; | 182 std::vector<unsigned char> png_data; |
183 gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &png_data); | 183 gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &png_data); |
184 if (file_util::CreateTemporaryFile(&snapshot_filename_)) { | 184 if (base::CreateTemporaryFile(&snapshot_filename_)) { |
185 file_util::WriteFile(snapshot_filename_, | 185 file_util::WriteFile(snapshot_filename_, |
186 reinterpret_cast<char*>(&png_data[0]), png_data.size()); | 186 reinterpret_cast<char*>(&png_data[0]), png_data.size()); |
187 } | 187 } |
188 } | 188 } |
189 } | 189 } |
190 | 190 |
191 // content::NotificationObserver | 191 // content::NotificationObserver |
192 virtual void Observe(int type, | 192 virtual void Observe(int type, |
193 const content::NotificationSource& source, | 193 const content::NotificationSource& source, |
194 const content::NotificationDetails& details) { | 194 const content::NotificationDetails& details) { |
(...skipping 222 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 |