OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/thumbnails/thumbnail_service_impl.h" | 5 #include "chrome/browser/thumbnails/thumbnail_service_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "chrome/browser/history/history_utils.h" | 9 #include "chrome/browser/history/history_utils.h" |
10 #include "chrome/browser/history/top_sites_factory.h" | 10 #include "chrome/browser/history/top_sites_factory.h" |
11 #include "chrome/common/pref_names.h" | 11 #include "chrome/common/pref_names.h" |
12 #include "chrome/test/base/testing_profile.h" | 12 #include "chrome/test/base/testing_profile.h" |
13 #include "components/history/core/browser/top_sites_impl.h" | 13 #include "components/history/core/browser/top_sites_impl.h" |
| 14 #include "content/public/test/test_browser_thread_bundle.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
15 | 16 |
16 typedef testing::Test ThumbnailServiceTest; | 17 class ThumbnailServiceTest : public testing::Test { |
| 18 content::TestBrowserThreadBundle thread_bundle_; |
| 19 }; |
17 | 20 |
18 namespace { | 21 namespace { |
19 | 22 |
20 // A mock version of TopSitesImpl, used for testing | 23 // A mock version of TopSitesImpl, used for testing |
21 // ShouldAcquirePageThumbnail(). | 24 // ShouldAcquirePageThumbnail(). |
22 class MockTopSites : public history::TopSitesImpl { | 25 class MockTopSites : public history::TopSitesImpl { |
23 public: | 26 public: |
24 explicit MockTopSites(Profile* profile) | 27 explicit MockTopSites(Profile* profile) |
25 : history::TopSitesImpl(profile->GetPrefs(), | 28 : history::TopSitesImpl(profile->GetPrefs(), |
26 nullptr, | 29 nullptr, |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 good_score.at_top = true; | 133 good_score.at_top = true; |
131 good_score.good_clipping = true; | 134 good_score.good_clipping = true; |
132 good_score.boring_score = 0.0; | 135 good_score.boring_score = 0.0; |
133 good_score.load_completed = true; | 136 good_score.load_completed = true; |
134 profile.AddKnownURL(kGoodURL, good_score); | 137 profile.AddKnownURL(kGoodURL, good_score); |
135 | 138 |
136 // Should be false, as the existing thumbnail is good enough (i.e. don't | 139 // Should be false, as the existing thumbnail is good enough (i.e. don't |
137 // need to replace the existing thumbnail which is new and good). | 140 // need to replace the existing thumbnail which is new and good). |
138 EXPECT_FALSE(thumbnail_service->ShouldAcquirePageThumbnail(kGoodURL)); | 141 EXPECT_FALSE(thumbnail_service->ShouldAcquirePageThumbnail(kGoodURL)); |
139 } | 142 } |
OLD | NEW |