| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/ntp_tiles/icon_cacher_impl.h" | 5 #include "components/ntp_tiles/icon_cacher_impl.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 MOCK_METHOD1(SetImageFetcherDelegate, | 42 MOCK_METHOD1(SetImageFetcherDelegate, |
| 43 void(image_fetcher::ImageFetcherDelegate* delegate)); | 43 void(image_fetcher::ImageFetcherDelegate* delegate)); |
| 44 MOCK_METHOD1(SetDataUseServiceName, | 44 MOCK_METHOD1(SetDataUseServiceName, |
| 45 void(image_fetcher::ImageFetcher::DataUseServiceName name)); | 45 void(image_fetcher::ImageFetcher::DataUseServiceName name)); |
| 46 MOCK_METHOD3(StartOrQueueNetworkRequest, | 46 MOCK_METHOD3(StartOrQueueNetworkRequest, |
| 47 void(const std::string& id, | 47 void(const std::string& id, |
| 48 const GURL& image_url, | 48 const GURL& image_url, |
| 49 base::Callback<void(const std::string& id, | 49 base::Callback<void(const std::string& id, |
| 50 const gfx::Image& image)> callback)); | 50 const gfx::Image& image)> callback)); |
| 51 MOCK_METHOD1(SetDesiredImageFrameSize, void(const gfx::Size&)); | 51 MOCK_METHOD1(SetDesiredImageFrameSize, void(const gfx::Size&)); |
| 52 MOCK_METHOD0(DisableCookies, void()); |
| 52 MOCK_METHOD0(GetImageDecoder, image_fetcher::ImageDecoder*()); | 53 MOCK_METHOD0(GetImageDecoder, image_fetcher::ImageDecoder*()); |
| 53 }; | 54 }; |
| 54 | 55 |
| 55 // This class provides methods to inject an image resource where a real resource | 56 // This class provides methods to inject an image resource where a real resource |
| 56 // would be necessary otherwise. All other methods have return values that allow | 57 // would be necessary otherwise. All other methods have return values that allow |
| 57 // the normal implementation to proceed. | 58 // the normal implementation to proceed. |
| 58 class MockResourceDelegate : public ui::ResourceBundle::Delegate { | 59 class MockResourceDelegate : public ui::ResourceBundle::Delegate { |
| 59 public: | 60 public: |
| 60 ~MockResourceDelegate() override {} | 61 ~MockResourceDelegate() override {} |
| 61 | 62 |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 Eq(gfx::Size(64, 64))); // Compares dimensions, not objects. | 322 Eq(gfx::Size(64, 64))); // Compares dimensions, not objects. |
| 322 | 323 |
| 323 // Let the fetcher continue and wait for the second call of the callback. | 324 // Let the fetcher continue and wait for the second call of the callback. |
| 324 fetch_loop.Run(); // Wait for the updated image. | 325 fetch_loop.Run(); // Wait for the updated image. |
| 325 EXPECT_THAT(GetCachedIconFor(site_.url, favicon_base::TOUCH_ICON).Size(), | 326 EXPECT_THAT(GetCachedIconFor(site_.url, favicon_base::TOUCH_ICON).Size(), |
| 326 Eq(gfx::Size(128, 128))); // Compares dimensions, not objects. | 327 Eq(gfx::Size(128, 128))); // Compares dimensions, not objects. |
| 327 } | 328 } |
| 328 | 329 |
| 329 } // namespace | 330 } // namespace |
| 330 } // namespace ntp_tiles | 331 } // namespace ntp_tiles |
| OLD | NEW |