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

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

Issue 53283004: Adding support for forced URLs to TopSites. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed GetAllMostVisited. Created 7 years, 1 month 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 | « chrome/browser/history/top_sites_database.cc ('k') | chrome/browser/history/top_sites_impl.h » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/files/file_path.h" 5 #include "base/files/file_path.h"
6 #include "base/files/scoped_temp_dir.h" 6 #include "base/files/scoped_temp_dir.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/history/top_sites_database.h" 9 #include "chrome/browser/history/top_sites_database.h"
10 #include "chrome/common/chrome_paths.h" 10 #include "chrome/common/chrome_paths.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 212
213 db.GetPageThumbnails(&urls, &thumbnails); 213 db.GetPageThumbnails(&urls, &thumbnails);
214 ASSERT_EQ(6u, urls.size()); 214 ASSERT_EQ(6u, urls.size());
215 ASSERT_EQ(6u, thumbnails.size()); 215 ASSERT_EQ(6u, thumbnails.size());
216 EXPECT_EQ(driveUrl, urls[0].url); 216 EXPECT_EQ(driveUrl, urls[0].url);
217 EXPECT_EQ(mapsUrl, urls[1].url); // Maps moves to second forced URL. 217 EXPECT_EQ(mapsUrl, urls[1].url); // Maps moves to second forced URL.
218 EXPECT_EQ(plusUrl, urls[2].url); 218 EXPECT_EQ(plusUrl, urls[2].url);
219 EXPECT_EQ(kUrl, urls[3].url); 219 EXPECT_EQ(kUrl, urls[3].url);
220 220
221 // Change a forced URL to non-forced using SetPageThumbnail. 221 // Change a forced URL to non-forced using SetPageThumbnail.
222 url3.last_forced_time = base::Time();
222 db.SetPageThumbnail(url3, 1, Images()); 223 db.SetPageThumbnail(url3, 1, Images());
223 224
224 db.GetPageThumbnails(&urls, &thumbnails); 225 db.GetPageThumbnails(&urls, &thumbnails);
225 ASSERT_EQ(6u, urls.size()); 226 ASSERT_EQ(6u, urls.size());
226 ASSERT_EQ(6u, thumbnails.size()); 227 ASSERT_EQ(6u, thumbnails.size());
227 EXPECT_EQ(driveUrl, urls[0].url); 228 EXPECT_EQ(driveUrl, urls[0].url);
228 EXPECT_EQ(mapsUrl, urls[1].url); 229 EXPECT_EQ(mapsUrl, urls[1].url);
229 EXPECT_EQ(kUrl, urls[2].url); 230 EXPECT_EQ(kUrl, urls[2].url);
230 EXPECT_EQ(plusUrl, urls[3].url); // Plus moves to second non-forced URL. 231 EXPECT_EQ(plusUrl, urls[3].url); // Plus moves to second non-forced URL.
231 232
232 // Change a non-forced URL to earlier non-forced using UpdatePageRank. 233 // Change a non-forced URL to earlier non-forced using UpdatePageRank.
233 url3.last_forced_time = base::Time();
234 db.UpdatePageRank(url3, 0); 234 db.UpdatePageRank(url3, 0);
235 235
236 db.GetPageThumbnails(&urls, &thumbnails); 236 db.GetPageThumbnails(&urls, &thumbnails);
237 ASSERT_EQ(6u, urls.size()); 237 ASSERT_EQ(6u, urls.size());
238 ASSERT_EQ(6u, thumbnails.size()); 238 ASSERT_EQ(6u, thumbnails.size());
239 EXPECT_EQ(driveUrl, urls[0].url); 239 EXPECT_EQ(driveUrl, urls[0].url);
240 EXPECT_EQ(mapsUrl, urls[1].url); 240 EXPECT_EQ(mapsUrl, urls[1].url);
241 EXPECT_EQ(plusUrl, urls[2].url); // Plus moves to first non-forced URL. 241 EXPECT_EQ(plusUrl, urls[2].url); // Plus moves to first non-forced URL.
242 EXPECT_EQ(kUrl, urls[3].url); 242 EXPECT_EQ(kUrl, urls[3].url);
243 243
(...skipping 22 matching lines...) Expand all
266 db.RemoveURL(url2); 266 db.RemoveURL(url2);
267 267
268 db.GetPageThumbnails(&urls, &thumbnails); 268 db.GetPageThumbnails(&urls, &thumbnails);
269 ASSERT_EQ(4u, urls.size()); 269 ASSERT_EQ(4u, urls.size());
270 ASSERT_EQ(4u, thumbnails.size()); 270 ASSERT_EQ(4u, thumbnails.size());
271 EXPECT_EQ(mapsUrl, urls[0].url); 271 EXPECT_EQ(mapsUrl, urls[0].url);
272 EXPECT_EQ(kUrl, urls[1].url); 272 EXPECT_EQ(kUrl, urls[1].url);
273 } 273 }
274 274
275 } // namespace history 275 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/top_sites_database.cc ('k') | chrome/browser/history/top_sites_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698