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

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

Issue 10050016: Removes pinning code from TopSites as we no longer need it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove printfs Created 8 years, 8 months 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
« no previous file with comments | « chrome/browser/history/top_sites.cc ('k') | chrome/browser/ui/webui/ntp/most_visited_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/top_sites_unittest.cc
diff --git a/chrome/browser/history/top_sites_unittest.cc b/chrome/browser/history/top_sites_unittest.cc
index a5e9eee453dcc0706edc707d6641da296fe7db6a..1fe773ec8a940b8ba8714fb66556a32a6ad0faed 100644
--- a/chrome/browser/history/top_sites_unittest.cc
+++ b/chrome/browser/history/top_sites_unittest.cc
@@ -858,59 +858,6 @@ TEST_F(TopSitesTest, DeleteNotifications) {
}
}
-TEST_F(TopSitesTest, PinnedURLsDeleted) {
- GURL google1_url("http://google.com");
- GURL google2_url("http://google.com/redirect");
- GURL google3_url("http://www.google.com");
- string16 google_title(ASCIIToUTF16("Google"));
- GURL news_url("http://news.google.com");
- string16 news_title(ASCIIToUTF16("Google News"));
-
- AddPageToHistory(google1_url, google_title);
- AddPageToHistory(news_url, news_title);
-
- RefreshTopSitesAndRecreate();
-
- {
- TopSitesQuerier querier;
- querier.QueryTopSites(top_sites(), false);
-
- // Take into account prepopulated URLs.
- ASSERT_EQ(GetPrepopulatePages().size() + 2, querier.urls().size());
- }
-
- top_sites()->AddPinnedURL(news_url, 3);
- EXPECT_TRUE(top_sites()->IsURLPinned(news_url));
-
- DeleteURL(news_url);
- WaitForHistory();
-
- {
- TopSitesQuerier querier;
- querier.QueryTopSites(top_sites(), false);
-
- // Take into account prepopulated URLs.
- ASSERT_EQ(GetPrepopulatePages().size() + 1, querier.urls().size());
- EXPECT_FALSE(top_sites()->IsURLPinned(news_url));
- }
-
- history_service()->ExpireHistoryBetween(
- std::set<GURL>(), base::Time(), base::Time(),
- consumer(), base::Bind(&TopSitesTest::EmptyCallback,
- base::Unretained(this))),
- WaitForHistory();
-
- {
- TopSitesQuerier querier;
- querier.QueryTopSites(top_sites(), false);
-
- // Take into account prepopulated URLs.
- ASSERT_EQ(GetPrepopulatePages().size(), querier.urls().size());
- EXPECT_FALSE(top_sites()->IsURLPinned(google1_url));
- ASSERT_NO_FATAL_FAILURE(ContainsPrepopulatePages(querier, 0));
- }
-}
-
// Makes sure GetUpdateDelay is updated appropriately.
TEST_F(TopSitesTest, GetUpdateDelay) {
SetLastNumUrlsChanged(0);
@@ -1207,104 +1154,6 @@ TEST_F(TopSitesTest, Blacklisting) {
}
}
-// Tests variations of pinning/unpinning urls.
-TEST_F(TopSitesTest, PinnedURLs) {
- MostVisitedURLList pages;
- MostVisitedURL url, url1;
- url.url = GURL("http://bbc.com/");
- url.redirects.push_back(url.url);
- pages.push_back(url);
- url1.url = GURL("http://google.com/");
- url1.redirects.push_back(url1.url);
- pages.push_back(url1);
-
- SetTopSites(pages);
-
- EXPECT_FALSE(top_sites()->IsURLPinned(GURL("http://bbc.com/")));
-
- {
- TopSitesQuerier q;
- q.QueryTopSites(top_sites(), true);
- ASSERT_EQ(2u + GetPrepopulatePages().size(), q.urls().size());
- EXPECT_EQ("http://bbc.com/", q.urls()[0].url.spec());
- EXPECT_EQ("http://google.com/", q.urls()[1].url.spec());
- ASSERT_NO_FATAL_FAILURE(ContainsPrepopulatePages(q, 2));
- }
-
- top_sites()->AddPinnedURL(GURL("http://google.com/"), 3);
- EXPECT_FALSE(top_sites()->IsURLPinned(GURL("http://bbc.com/")));
- EXPECT_FALSE(top_sites()->IsURLPinned(GetPrepopulatePages()[0].url));
-
- {
- TopSitesQuerier q;
- q.QueryTopSites(top_sites(), true);
- ASSERT_EQ(4u, q.urls().size());
- EXPECT_EQ("http://bbc.com/", q.urls()[0].url.spec());
- ASSERT_NO_FATAL_FAILURE(ContainsPrepopulatePages(q, 1));
- EXPECT_EQ("http://google.com/", q.urls()[3].url.spec());
- }
-
- top_sites()->RemovePinnedURL(GURL("http://google.com/"));
- EXPECT_FALSE(top_sites()->IsURLPinned(GURL("http://google.com/")));
- {
- TopSitesQuerier q;
- q.QueryTopSites(top_sites(), true);
-
- ASSERT_EQ(2u + GetPrepopulatePages().size(), q.urls().size());
- EXPECT_EQ("http://bbc.com/", q.urls()[0].url.spec());
- EXPECT_EQ("http://google.com/", q.urls()[1].url.spec());
- ASSERT_NO_FATAL_FAILURE(ContainsPrepopulatePages(q, 2));
- }
-
- GURL prepopulate_url = GetPrepopulatePages()[0].url;
- top_sites()->AddPinnedURL(GURL("http://bbc.com"), 1);
- top_sites()->AddPinnedURL(prepopulate_url, 0);
- {
- TopSitesQuerier q;
- q.QueryTopSites(top_sites(), true);
-
- ASSERT_EQ(3u + GetPrepopulatePages().size() - 1, q.urls().size());
- EXPECT_EQ(prepopulate_url, q.urls()[0].url);
- EXPECT_EQ("http://bbc.com/", q.urls()[1].url.spec());
- EXPECT_EQ("http://google.com/", q.urls()[2].url.spec());
- if (GetPrepopulatePages().size() > 1)
- EXPECT_EQ(GetPrepopulatePages()[1].url, q.urls()[3].url);
- }
-
- // Recreate and make sure state remains the same.
- RecreateTopSitesAndBlock();
- {
- TopSitesQuerier q;
- q.QueryTopSites(top_sites(), true);
-
- ASSERT_EQ(3u + GetPrepopulatePages().size() - 1, q.urls().size());
- EXPECT_EQ(prepopulate_url, q.urls()[0].url);
- EXPECT_EQ("http://bbc.com/", q.urls()[1].url.spec());
- EXPECT_EQ("http://google.com/", q.urls()[2].url.spec());
- if (GetPrepopulatePages().size() > 1)
- EXPECT_EQ(GetPrepopulatePages()[1].url, q.urls()[3].url);
- }
-}
-
-// Tests blacklisting and pinning.
-TEST_F(TopSitesTest, BlacklistingAndPinnedURLs) {
- MostVisitedURLList prepopulate_urls = GetPrepopulatePages();
- if (prepopulate_urls.size() < 2)
- return;
-
- top_sites()->AddPinnedURL(prepopulate_urls[0].url, 1);
- top_sites()->AddBlacklistedURL(prepopulate_urls[1].url);
-
- {
- TopSitesQuerier q;
- q.QueryTopSites(top_sites(), true);
-
- ASSERT_LE(2u, q.urls().size());
- EXPECT_EQ(GURL(), q.urls()[0].url);
- EXPECT_EQ(prepopulate_urls[0].url, q.urls()[1].url);
- }
-}
-
// Makes sure prepopulated pages exist.
TEST_F(TopSitesTest, AddPrepopulatedPages) {
TopSitesQuerier q;
« no previous file with comments | « chrome/browser/history/top_sites.cc ('k') | chrome/browser/ui/webui/ntp/most_visited_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698