Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3088)

Unified Diff: chrome/browser/history/top_sites_impl_unittest.cc

Issue 815983002: Topsites become keyedService based. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/history/top_sites_impl_unittest.cc
diff --git a/chrome/browser/history/top_sites_impl_unittest.cc b/chrome/browser/history/top_sites_impl_unittest.cc
index 799a011e2d2bbd523247ed4ae7b8015782a1a49b..640fb8904fa069a17cb0388aa6a04505a309dd18 100644
--- a/chrome/browser/history/top_sites_impl_unittest.cc
+++ b/chrome/browser/history/top_sites_impl_unittest.cc
@@ -12,9 +12,9 @@
#include "chrome/browser/history/history_notifications.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/history/history_unittest_base.h"
-#include "chrome/browser/history/top_sites.h"
#include "chrome/browser/history/top_sites_cache.h"
-#include "chrome/browser/history/top_sites_impl.h"
+#include "chrome/browser/history/top_sites_provider.h"
+#include "chrome/browser/history/top_sites_service.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/test/base/testing_profile.h"
@@ -30,15 +30,16 @@ using content::BrowserThread;
class TestTopSitesObserver : public history::TopSitesObserver {
public:
- explicit TestTopSitesObserver(Profile* profile, history::TopSites* top_sites);
+ explicit TestTopSitesObserver(Profile* profile,
+ history::TopSitesProvider* top_sites);
virtual ~TestTopSitesObserver();
// TopSitesObserver:
- void TopSitesLoaded(history::TopSites* top_sites) override;
- void TopSitesChanged(history::TopSites* top_sites) override;
+ void TopSitesLoaded(history::TopSitesProvider* top_sites) override;
+ void TopSitesChanged(history::TopSitesProvider* top_sites) override;
private:
Profile* profile_;
- history::TopSites* top_sites_;
+ history::TopSitesProvider* top_sites_;
};
TestTopSitesObserver::~TestTopSitesObserver() {
@@ -46,20 +47,21 @@ TestTopSitesObserver::~TestTopSitesObserver() {
}
TestTopSitesObserver::TestTopSitesObserver(Profile* profile,
- history::TopSites* top_sites)
+ history::TopSitesProvider* top_sites)
: profile_(profile), top_sites_(top_sites) {
DCHECK(top_sites_);
top_sites_->AddObserver(this);
}
-void TestTopSitesObserver::TopSitesLoaded(history::TopSites* top_sites) {
+void TestTopSitesObserver::TopSitesLoaded(
+ history::TopSitesProvider* top_sites) {
content::NotificationService::current()->Notify(
- chrome::NOTIFICATION_TOP_SITES_LOADED,
- content::Source<Profile>(profile_),
- content::Details<history::TopSites>(top_sites));
+ chrome::NOTIFICATION_TOP_SITES_LOADED, content::Source<Profile>(profile_),
+ content::Details<history::TopSitesProvider>(top_sites));
}
-void TestTopSitesObserver::TopSitesChanged(history::TopSites* top_sites) {
+void TestTopSitesObserver::TopSitesChanged(
+ history::TopSitesProvider* top_sites) {
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_TOP_SITES_CHANGED,
content::Source<Profile>(profile_),
@@ -99,13 +101,13 @@ class TopSitesQuerier {
// Queries top sites. If |wait| is true a nested message loop is run until the
// callback is notified.
- void QueryTopSites(TopSitesImpl* top_sites, bool wait) {
+ void QueryTopSites(TopSitesService* top_sites, bool wait) {
QueryAllTopSites(top_sites, wait, false);
}
// Queries top sites, including potentially forced URLs if
// |include_forced_urls| is true.
- void QueryAllTopSites(TopSitesImpl* top_sites,
+ void QueryAllTopSites(TopSitesService* top_sites,
bool wait,
bool include_forced_urls) {
int start_number_of_callbacks = number_of_callbacks_;
@@ -235,8 +237,8 @@ class TopSitesImplTest : public HistoryUnitTestBase {
base::MessageLoop::current()->Run();
}
- TopSitesImpl* top_sites() {
- return static_cast<TopSitesImpl*>(profile_->GetTopSites());
+ TopSitesService* top_sites() {
+ return static_cast<TopSitesService*>(profile_->GetTopSites());
}
TestingProfile* profile() {return profile_.get();}
HistoryService* history_service() {
@@ -313,7 +315,7 @@ class TopSitesImplTest : public HistoryUnitTestBase {
bool ThumbnailEqualsBytes(const gfx::Image& image,
base::RefCountedMemory* bytes) {
scoped_refptr<base::RefCountedBytes> encoded_image;
- TopSitesImpl::EncodeBitmap(image, &encoded_image);
+ TopSitesService::EncodeBitmap(image, &encoded_image);
return ThumbnailsAreEqual(encoded_image.get(), bytes);
}
@@ -474,7 +476,7 @@ TEST_F(TopSitesImplTest, DiffMostVisited) {
AppendMostVisitedURL(&new_list, gets_moved_1); // 3 (moved from 2)
history::TopSitesDelta delta;
- history::TopSitesImpl::DiffMostVisited(old_list, new_list, &delta);
+ history::TopSitesService::DiffMostVisited(old_list, new_list, &delta);
ASSERT_EQ(2u, delta.added.size());
EXPECT_TRUE(gets_added_1 == delta.added[0].url.url);
@@ -529,7 +531,7 @@ TEST_F(TopSitesImplTest, DiffMostVisitedWithForced) {
AppendMostVisitedURL(&new_list, gets_moved_1);
history::TopSitesDelta delta;
- history::TopSitesImpl::DiffMostVisited(old_list, new_list, &delta);
+ history::TopSitesService::DiffMostVisited(old_list, new_list, &delta);
ASSERT_EQ(2u, delta.added.size());
EXPECT_TRUE(gets_added_1 == delta.added[0].url.url);

Powered by Google App Engine
This is Rietveld 408576698