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 "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 DISALLOW_COPY_AND_ASSIGN(MockTopSites); | 53 DISALLOW_COPY_AND_ASSIGN(MockTopSites); |
54 }; | 54 }; |
55 | 55 |
56 // A mock version of TestingProfile holds MockTopSites. | 56 // A mock version of TestingProfile holds MockTopSites. |
57 class MockProfile : public TestingProfile { | 57 class MockProfile : public TestingProfile { |
58 public: | 58 public: |
59 MockProfile() : mock_top_sites_(new MockTopSites(this)) { | 59 MockProfile() : mock_top_sites_(new MockTopSites(this)) { |
60 } | 60 } |
61 | 61 |
62 virtual history::TopSites* GetTopSites() OVERRIDE { | 62 virtual history::TopSites* GetTopSites() OVERRIDE { |
63 return mock_top_sites_; | 63 return mock_top_sites_.get(); |
64 } | 64 } |
65 | 65 |
66 void AddKnownURL(const GURL& url, const ThumbnailScore& score) { | 66 void AddKnownURL(const GURL& url, const ThumbnailScore& score) { |
67 mock_top_sites_->AddKnownURL(url, score); | 67 mock_top_sites_->AddKnownURL(url, score); |
68 } | 68 } |
69 | 69 |
70 private: | 70 private: |
71 scoped_refptr<MockTopSites> mock_top_sites_; | 71 scoped_refptr<MockTopSites> mock_top_sites_; |
72 | 72 |
73 DISALLOW_COPY_AND_ASSIGN(MockProfile); | 73 DISALLOW_COPY_AND_ASSIGN(MockProfile); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 good_score.at_top = true; | 114 good_score.at_top = true; |
115 good_score.good_clipping = true; | 115 good_score.good_clipping = true; |
116 good_score.boring_score = 0.0; | 116 good_score.boring_score = 0.0; |
117 good_score.load_completed = true; | 117 good_score.load_completed = true; |
118 profile.AddKnownURL(kGoodURL, good_score); | 118 profile.AddKnownURL(kGoodURL, good_score); |
119 | 119 |
120 // 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 |
121 // need to replace the existing thumbnail which is new and good). | 121 // need to replace the existing thumbnail which is new and good). |
122 EXPECT_FALSE(thumbnail_service->ShouldAcquirePageThumbnail(kGoodURL)); | 122 EXPECT_FALSE(thumbnail_service->ShouldAcquirePageThumbnail(kGoodURL)); |
123 } | 123 } |
OLD | NEW |