| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 class IconCacherTest : public ::testing::Test { | 44 class IconCacherTest : public ::testing::Test { |
| 45 protected: | 45 protected: |
| 46 IconCacherTest() | 46 IconCacherTest() |
| 47 : site_(base::string16(), // title, unused | 47 : site_(base::string16(), // title, unused |
| 48 GURL("http://url.google/"), | 48 GURL("http://url.google/"), |
| 49 GURL("http://url.google/icon.png"), | 49 GURL("http://url.google/icon.png"), |
| 50 GURL("http://url.google/favicon.ico"), | 50 GURL("http://url.google/favicon.ico"), |
| 51 GURL()), // thumbnail, unused | 51 GURL()), // thumbnail, unused |
| 52 image_fetcher_(new ::testing::StrictMock<MockImageFetcher>), | 52 image_fetcher_(new ::testing::StrictMock<MockImageFetcher>), |
| 53 favicon_service_(/*favicon_client=*/nullptr, &history_service_) { | 53 favicon_service_(/*favicon_client=*/nullptr, |
| 54 &history_service_, |
| 55 nullptr) { |
| 54 CHECK(history_dir_.CreateUniqueTempDir()); | 56 CHECK(history_dir_.CreateUniqueTempDir()); |
| 55 CHECK(history_service_.Init( | 57 CHECK(history_service_.Init( |
| 56 history::HistoryDatabaseParams(history_dir_.GetPath(), 0, 0))); | 58 history::HistoryDatabaseParams(history_dir_.GetPath(), 0, 0))); |
| 57 } | 59 } |
| 58 | 60 |
| 59 void PreloadIcon(const GURL& url, | 61 void PreloadIcon(const GURL& url, |
| 60 const GURL& icon_url, | 62 const GURL& icon_url, |
| 61 favicon_base::IconType icon_type, | 63 favicon_base::IconType icon_type, |
| 62 int width, | 64 int width, |
| 63 int height) { | 65 int height) { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 | 192 |
| 191 IconCacherImpl cacher(&favicon_service_, std::move(image_fetcher_)); | 193 IconCacherImpl cacher(&favicon_service_, std::move(image_fetcher_)); |
| 192 cacher.StartFetch(site_, BindMockFunction(&done)); | 194 cacher.StartFetch(site_, BindMockFunction(&done)); |
| 193 loop.Run(); | 195 loop.Run(); |
| 194 EXPECT_FALSE(IconIsCachedFor(site_.url, favicon_base::FAVICON)); | 196 EXPECT_FALSE(IconIsCachedFor(site_.url, favicon_base::FAVICON)); |
| 195 EXPECT_FALSE(IconIsCachedFor(site_.url, favicon_base::TOUCH_ICON)); | 197 EXPECT_FALSE(IconIsCachedFor(site_.url, favicon_base::TOUCH_ICON)); |
| 196 } | 198 } |
| 197 | 199 |
| 198 } // namespace | 200 } // namespace |
| 199 } // namespace ntp_tiles | 201 } // namespace ntp_tiles |
| OLD | NEW |