| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 public: | 32 public: |
| 33 MOCK_METHOD1(SetImageFetcherDelegate, | 33 MOCK_METHOD1(SetImageFetcherDelegate, |
| 34 void(image_fetcher::ImageFetcherDelegate* delegate)); | 34 void(image_fetcher::ImageFetcherDelegate* delegate)); |
| 35 MOCK_METHOD1(SetDataUseServiceName, | 35 MOCK_METHOD1(SetDataUseServiceName, |
| 36 void(image_fetcher::ImageFetcher::DataUseServiceName name)); | 36 void(image_fetcher::ImageFetcher::DataUseServiceName name)); |
| 37 MOCK_METHOD3(StartOrQueueNetworkRequest, | 37 MOCK_METHOD3(StartOrQueueNetworkRequest, |
| 38 void(const std::string& id, | 38 void(const std::string& id, |
| 39 const GURL& image_url, | 39 const GURL& image_url, |
| 40 base::Callback<void(const std::string& id, | 40 base::Callback<void(const std::string& id, |
| 41 const gfx::Image& image)> callback)); | 41 const gfx::Image& image)> callback)); |
| 42 MOCK_METHOD1(SetDesiredImageFrameSize, void(const gfx::Size&)); |
| 42 }; | 43 }; |
| 43 | 44 |
| 44 class IconCacherTest : public ::testing::Test { | 45 class IconCacherTest : public ::testing::Test { |
| 45 protected: | 46 protected: |
| 46 IconCacherTest() | 47 IconCacherTest() |
| 47 : site_(base::string16(), // title, unused | 48 : site_(base::string16(), // title, unused |
| 48 GURL("http://url.google/"), | 49 GURL("http://url.google/"), |
| 49 GURL("http://url.google/icon.png"), | 50 GURL("http://url.google/icon.png"), |
| 50 GURL("http://url.google/favicon.ico"), | 51 GURL("http://url.google/favicon.ico"), |
| 51 GURL()), // thumbnail, unused | 52 GURL()), // thumbnail, unused |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 | 191 |
| 191 IconCacherImpl cacher(&favicon_service_, std::move(image_fetcher_)); | 192 IconCacherImpl cacher(&favicon_service_, std::move(image_fetcher_)); |
| 192 cacher.StartFetch(site_, BindMockFunction(&done)); | 193 cacher.StartFetch(site_, BindMockFunction(&done)); |
| 193 loop.Run(); | 194 loop.Run(); |
| 194 EXPECT_FALSE(IconIsCachedFor(site_.url, favicon_base::FAVICON)); | 195 EXPECT_FALSE(IconIsCachedFor(site_.url, favicon_base::FAVICON)); |
| 195 EXPECT_FALSE(IconIsCachedFor(site_.url, favicon_base::TOUCH_ICON)); | 196 EXPECT_FALSE(IconIsCachedFor(site_.url, favicon_base::TOUCH_ICON)); |
| 196 } | 197 } |
| 197 | 198 |
| 198 } // namespace | 199 } // namespace |
| 199 } // namespace ntp_tiles | 200 } // namespace ntp_tiles |
| OLD | NEW |