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

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: 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 GURL icon_url; 322 return thumb_db_->GetFaviconHeader(favicon_id, NULL, NULL, NULL);
323 return thumb_db_->GetFaviconHeader(favicon_id, &icon_url, NULL, NULL);
324 } 323 }
325 324
326 FaviconID ExpireHistoryTest::GetFavicon(const GURL& page_url, 325 FaviconID ExpireHistoryTest::GetFavicon(const GURL& page_url,
327 IconType icon_type) { 326 IconType icon_type) {
328 IconMapping icon_mapping; 327 std::vector<IconMapping> icon_mappings;
329 thumb_db_->GetIconMappingForPageURL(page_url, icon_type, &icon_mapping); 328 if (thumb_db_->GetIconMappingsForPageURL(page_url, icon_type,
330 return icon_mapping.icon_id; 329 &icon_mappings)) {
330 return icon_mappings[0].icon_id;
331 }
332 return 0;
331 } 333 }
332 334
333 bool ExpireHistoryTest::HasThumbnail(URLID url_id) { 335 bool ExpireHistoryTest::HasThumbnail(URLID url_id) {
334 // 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
335 // TopSites we should be checking URL always, not the id. 337 // TopSites we should be checking URL always, not the id.
336 URLRow info; 338 URLRow info;
337 if (!main_db_->GetURLRow(url_id, &info)) 339 if (!main_db_->GetURLRow(url_id, &info))
338 return false; 340 return false;
339 GURL url = info.url(); 341 GURL url = info.url();
340 scoped_refptr<base::RefCountedMemory> data; 342 scoped_refptr<base::RefCountedMemory> data;
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 main_db_->GetVisitsForURL(url_id, &archived_visits); 955 main_db_->GetVisitsForURL(url_id, &archived_visits);
954 EXPECT_EQ(0U, archived_visits.size()); 956 EXPECT_EQ(0U, archived_visits.size());
955 } 957 }
956 958
957 // 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
958 // properly. Have the visits also refer to nonexistent FTS rows. 960 // properly. Have the visits also refer to nonexistent FTS rows.
959 // 961 //
960 // Maybe also refer to invalid favicons. 962 // Maybe also refer to invalid favicons.
961 963
962 } // namespace history 964 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698