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