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

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

Issue 10802066: Adds support for saving favicon size into history database. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changes as requested by Sky and stevenjb Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
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 <algorithm> 5 #include <algorithm>
6 #include <string> 6 #include <string>
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 main_db_->AddVisit(&visit_row3, SOURCE_EXTENSION); 312 main_db_->AddVisit(&visit_row3, SOURCE_EXTENSION);
313 313
314 VisitRow visit_row4( 314 VisitRow visit_row4(
315 url_id, last_visit_time, 0, content::PAGE_TRANSITION_TYPED, 0); 315 url_id, last_visit_time, 0, content::PAGE_TRANSITION_TYPED, 0);
316 main_db_->AddVisit(&visit_row4, SOURCE_FIREFOX_IMPORTED); 316 main_db_->AddVisit(&visit_row4, SOURCE_FIREFOX_IMPORTED);
317 } 317 }
318 318
319 bool ExpireHistoryTest::HasFavicon(FaviconID favicon_id) { 319 bool ExpireHistoryTest::HasFavicon(FaviconID favicon_id) {
320 if (!thumb_db_.get() || favicon_id == 0) 320 if (!thumb_db_.get() || favicon_id == 0)
321 return false; 321 return false;
322 Time last_updated; 322 return thumb_db_->GetFaviconHeader(favicon_id, NULL, NULL, NULL);
323 scoped_refptr<base::RefCountedMemory> icon_data_unused;
324 GURL icon_url;
325 return thumb_db_->GetFavicon(favicon_id, &last_updated, &icon_data_unused,
326 &icon_url, NULL);
327 } 323 }
328 324
329 FaviconID ExpireHistoryTest::GetFavicon(const GURL& page_url, 325 FaviconID ExpireHistoryTest::GetFavicon(const GURL& page_url,
330 IconType icon_type) { 326 IconType icon_type) {
331 IconMapping icon_mapping; 327 std::vector<IconMapping> icon_mappings;
332 thumb_db_->GetIconMappingForPageURL(page_url, icon_type, &icon_mapping); 328 if (thumb_db_->GetIconMappingsForPageURL(page_url, icon_type,
333 return icon_mapping.icon_id; 329 &icon_mappings)) {
330 return icon_mappings[0].icon_id;
331 }
332 return 0;
334 } 333 }
335 334
336 bool ExpireHistoryTest::HasThumbnail(URLID url_id) { 335 bool ExpireHistoryTest::HasThumbnail(URLID url_id) {
337 // TODO(sky): fix this. This test isn't really valid for TopSites. For 336 // TODO(sky): fix this. This test isn't really valid for TopSites. For
338 // TopSites we should be checking URL always, not the id. 337 // TopSites we should be checking URL always, not the id.
339 URLRow info; 338 URLRow info;
340 if (!main_db_->GetURLRow(url_id, &info)) 339 if (!main_db_->GetURLRow(url_id, &info))
341 return false; 340 return false;
342 GURL url = info.url(); 341 GURL url = info.url();
343 scoped_refptr<base::RefCountedMemory> data; 342 scoped_refptr<base::RefCountedMemory> data;
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 main_db_->GetVisitsForURL(url_id, &archived_visits); 955 main_db_->GetVisitsForURL(url_id, &archived_visits);
957 EXPECT_EQ(0U, archived_visits.size()); 956 EXPECT_EQ(0U, archived_visits.size());
958 } 957 }
959 958
960 // TODO(brettw) add some visits with no URL to make sure everything is updated 959 // TODO(brettw) add some visits with no URL to make sure everything is updated
961 // properly. Have the visits also refer to nonexistent FTS rows. 960 // properly. Have the visits also refer to nonexistent FTS rows.
962 // 961 //
963 // Maybe also refer to invalid favicons. 962 // Maybe also refer to invalid favicons.
964 963
965 } // namespace history 964 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698