| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/frame_host/navigation_controller_impl.h" | 5 #include "content/browser/frame_host/navigation_controller_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // Returns true if images |a| and |b| have the same pixel data. | 69 // Returns true if images |a| and |b| have the same pixel data. |
| 70 bool DoImagesMatch(const gfx::Image& a, const gfx::Image& b) { | 70 bool DoImagesMatch(const gfx::Image& a, const gfx::Image& b) { |
| 71 // Assume that if the 1x bitmaps match, the images match. | 71 // Assume that if the 1x bitmaps match, the images match. |
| 72 SkBitmap a_bitmap = a.AsBitmap(); | 72 SkBitmap a_bitmap = a.AsBitmap(); |
| 73 SkBitmap b_bitmap = b.AsBitmap(); | 73 SkBitmap b_bitmap = b.AsBitmap(); |
| 74 | 74 |
| 75 if (a_bitmap.width() != b_bitmap.width() || | 75 if (a_bitmap.width() != b_bitmap.width() || |
| 76 a_bitmap.height() != b_bitmap.height()) { | 76 a_bitmap.height() != b_bitmap.height()) { |
| 77 return false; | 77 return false; |
| 78 } | 78 } |
| 79 SkAutoLockPixels a_bitmap_lock(a_bitmap); | |
| 80 SkAutoLockPixels b_bitmap_lock(b_bitmap); | |
| 81 return memcmp(a_bitmap.getPixels(), | 79 return memcmp(a_bitmap.getPixels(), |
| 82 b_bitmap.getPixels(), | 80 b_bitmap.getPixels(), |
| 83 a_bitmap.getSize()) == 0; | 81 a_bitmap.getSize()) == 0; |
| 84 } | 82 } |
| 85 | 83 |
| 86 class MockScreenshotManager : public content::NavigationEntryScreenshotManager { | 84 class MockScreenshotManager : public content::NavigationEntryScreenshotManager { |
| 87 public: | 85 public: |
| 88 explicit MockScreenshotManager(content::NavigationControllerImpl* owner) | 86 explicit MockScreenshotManager(content::NavigationControllerImpl* owner) |
| 89 : content::NavigationEntryScreenshotManager(owner), | 87 : content::NavigationEntryScreenshotManager(owner), |
| 90 encoding_screenshot_in_progress_(false) { | 88 encoding_screenshot_in_progress_(false) { |
| (...skipping 5193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5284 main_test_rfh()->SimulateNavigationStart(url_1); | 5282 main_test_rfh()->SimulateNavigationStart(url_1); |
| 5285 EXPECT_EQ(url_1, controller.GetVisibleEntry()->GetURL()); | 5283 EXPECT_EQ(url_1, controller.GetVisibleEntry()->GetURL()); |
| 5286 EXPECT_EQ(ReloadType::NONE, last_reload_type_); | 5284 EXPECT_EQ(ReloadType::NONE, last_reload_type_); |
| 5287 | 5285 |
| 5288 main_test_rfh()->SimulateNavigationCommit(url_2); | 5286 main_test_rfh()->SimulateNavigationCommit(url_2); |
| 5289 main_test_rfh()->SimulateNavigationCommit(url_1); | 5287 main_test_rfh()->SimulateNavigationCommit(url_1); |
| 5290 main_test_rfh()->SimulateNavigationCommit(url_1); | 5288 main_test_rfh()->SimulateNavigationCommit(url_1); |
| 5291 } | 5289 } |
| 5292 | 5290 |
| 5293 } // namespace content | 5291 } // namespace content |
| OLD | NEW |