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