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

Side by Side Diff: chrome/browser/history/top_sites_unittest.cc

Issue 11280070: Fixed TopSitesTest.Blacklisting issue for Android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « build/android/gtest_filter/unit_tests_disabled ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 EXPECT_TRUE(top_sites()->HasBlacklistedItems()); 1143 EXPECT_TRUE(top_sites()->HasBlacklistedItems());
1144 EXPECT_FALSE(top_sites()->IsBlacklisted(GURL("http://google.com/"))); 1144 EXPECT_FALSE(top_sites()->IsBlacklisted(GURL("http://google.com/")));
1145 1145
1146 // Make sure google is returned now. 1146 // Make sure google is returned now.
1147 { 1147 {
1148 TopSitesQuerier q; 1148 TopSitesQuerier q;
1149 q.QueryTopSites(top_sites(), true); 1149 q.QueryTopSites(top_sites(), true);
1150 ASSERT_EQ(2u + GetPrepopulatePages().size() - 1, q.urls().size()); 1150 ASSERT_EQ(2u + GetPrepopulatePages().size() - 1, q.urls().size());
1151 EXPECT_EQ("http://bbc.com/", q.urls()[0].url.spec()); 1151 EXPECT_EQ("http://bbc.com/", q.urls()[0].url.spec());
1152 EXPECT_EQ("http://google.com/", q.urls()[1].url.spec()); 1152 EXPECT_EQ("http://google.com/", q.urls()[1].url.spec());
1153 EXPECT_NE(prepopulate_url.spec(), q.urls()[2].url.spec()); 1153 // Android has only one prepopulated page which has been blacklisted, so
1154 // only 2 urls are returned.
1155 if (q.urls().size() > 2)
1156 EXPECT_NE(prepopulate_url.spec(), q.urls()[2].url.spec());
1157 else
1158 EXPECT_EQ(1u, GetPrepopulatePages().size());
1154 } 1159 }
1155 1160
1156 // Remove all blacklisted sites. 1161 // Remove all blacklisted sites.
1157 top_sites()->ClearBlacklistedURLs(); 1162 top_sites()->ClearBlacklistedURLs();
1158 EXPECT_FALSE(top_sites()->HasBlacklistedItems()); 1163 EXPECT_FALSE(top_sites()->HasBlacklistedItems());
1159 1164
1160 { 1165 {
1161 TopSitesQuerier q; 1166 TopSitesQuerier q;
1162 q.QueryTopSites(top_sites(), true); 1167 q.QueryTopSites(top_sites(), true);
1163 ASSERT_EQ(2u + GetPrepopulatePages().size(), q.urls().size()); 1168 ASSERT_EQ(2u + GetPrepopulatePages().size(), q.urls().size());
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1249 chrome::NOTIFICATION_TOP_SITES_LOADED, 1254 chrome::NOTIFICATION_TOP_SITES_LOADED,
1250 content::Source<Profile>(profile())); 1255 content::Source<Profile>(profile()));
1251 profile()->CreateTopSites(); 1256 profile()->CreateTopSites();
1252 HistoryServiceFactory::GetForProfile( 1257 HistoryServiceFactory::GetForProfile(
1253 profile(), Profile::EXPLICIT_ACCESS)->UnloadBackend(); 1258 profile(), Profile::EXPLICIT_ACCESS)->UnloadBackend();
1254 profile()->BlockUntilHistoryProcessesPendingRequests(); 1259 profile()->BlockUntilHistoryProcessesPendingRequests();
1255 observer.Wait(); 1260 observer.Wait();
1256 } 1261 }
1257 1262
1258 } // namespace history 1263 } // namespace history
OLDNEW
« no previous file with comments | « build/android/gtest_filter/unit_tests_disabled ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698