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/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "chrome/browser/history/top_sites_impl.h" | 8 #include "chrome/browser/history/top_sites_impl.h" |
9 #include "chrome/test/base/testing_profile.h" | 9 #include "chrome/test/base/testing_profile.h" |
| 10 #include "content/public/test/test_browser_thread_bundle.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
11 | 12 |
12 typedef testing::Test ThumbnailServiceTest; | 13 class ThumbnailServiceTest : public testing::Test { |
| 14 private: |
| 15 content::TestBrowserThreadBundle thread_bundle_; |
| 16 }; |
13 | 17 |
14 // A mock version of TopSitesImpl, used for testing | 18 // A mock version of TopSitesImpl, used for testing |
15 // ShouldAcquirePageThumbnail(). | 19 // ShouldAcquirePageThumbnail(). |
16 class MockTopSites : public history::TopSitesImpl { | 20 class MockTopSites : public history::TopSitesImpl { |
17 public: | 21 public: |
18 explicit MockTopSites(Profile* profile) | 22 explicit MockTopSites(Profile* profile) |
19 : history::TopSitesImpl(profile), | 23 : history::TopSitesImpl(profile), |
20 capacity_(1) { | 24 capacity_(1) { |
21 } | 25 } |
22 | 26 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 good_score.at_top = true; | 118 good_score.at_top = true; |
115 good_score.good_clipping = true; | 119 good_score.good_clipping = true; |
116 good_score.boring_score = 0.0; | 120 good_score.boring_score = 0.0; |
117 good_score.load_completed = true; | 121 good_score.load_completed = true; |
118 profile.AddKnownURL(kGoodURL, good_score); | 122 profile.AddKnownURL(kGoodURL, good_score); |
119 | 123 |
120 // Should be false, as the existing thumbnail is good enough (i.e. don't | 124 // Should be false, as the existing thumbnail is good enough (i.e. don't |
121 // need to replace the existing thumbnail which is new and good). | 125 // need to replace the existing thumbnail which is new and good). |
122 EXPECT_FALSE(thumbnail_service->ShouldAcquirePageThumbnail(kGoodURL)); | 126 EXPECT_FALSE(thumbnail_service->ShouldAcquirePageThumbnail(kGoodURL)); |
123 } | 127 } |
OLD | NEW |