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