| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <string> | 5 #include <string> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 now_(Time::Now()) { | 58 now_(Time::Now()) { |
| 59 } | 59 } |
| 60 | 60 |
| 61 protected: | 61 protected: |
| 62 // Called by individual tests when they want data populated. | 62 // Called by individual tests when they want data populated. |
| 63 void AddExampleData(URLID url_ids[3], Time visit_times[4]); | 63 void AddExampleData(URLID url_ids[3], Time visit_times[4]); |
| 64 // Add visits with source information. | 64 // Add visits with source information. |
| 65 void AddExampleSourceData(const GURL& url, URLID* id); | 65 void AddExampleSourceData(const GURL& url, URLID* id); |
| 66 | 66 |
| 67 // Returns true if the given favicon/thumanil has an entry in the DB. | 67 // Returns true if the given favicon/thumanil has an entry in the DB. |
| 68 bool HasFavIcon(FavIconID favicon_id); | 68 bool HasFavIcon(FaviconID favicon_id); |
| 69 bool HasThumbnail(URLID url_id); | 69 bool HasThumbnail(URLID url_id); |
| 70 | 70 |
| 71 FavIconID GetFavicon(const GURL& page_url, IconType icon_type); | 71 FaviconID GetFavicon(const GURL& page_url, IconType icon_type); |
| 72 | 72 |
| 73 // Returns the number of text matches for the given URL in the example data | 73 // Returns the number of text matches for the given URL in the example data |
| 74 // added by AddExampleData. | 74 // added by AddExampleData. |
| 75 int CountTextMatchesForURL(const GURL& url); | 75 int CountTextMatchesForURL(const GURL& url); |
| 76 | 76 |
| 77 // EXPECTs that each URL-specific history thing (basically, everything but | 77 // EXPECTs that each URL-specific history thing (basically, everything but |
| 78 // favicons) is gone. | 78 // favicons) is gone. |
| 79 void EnsureURLInfoGone(const URLRow& row); | 79 void EnsureURLInfoGone(const URLRow& row); |
| 80 | 80 |
| 81 // Clears the list of notifications received. | 81 // Clears the list of notifications received. |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 return; | 193 return; |
| 194 | 194 |
| 195 // Four times for each visit. | 195 // Four times for each visit. |
| 196 visit_times[3] = Time::Now(); | 196 visit_times[3] = Time::Now(); |
| 197 visit_times[2] = visit_times[3] - TimeDelta::FromDays(1); | 197 visit_times[2] = visit_times[3] - TimeDelta::FromDays(1); |
| 198 visit_times[1] = visit_times[3] - TimeDelta::FromDays(2); | 198 visit_times[1] = visit_times[3] - TimeDelta::FromDays(2); |
| 199 visit_times[0] = visit_times[3] - TimeDelta::FromDays(3); | 199 visit_times[0] = visit_times[3] - TimeDelta::FromDays(3); |
| 200 | 200 |
| 201 // Two favicons. The first two URLs will share the same one, while the last | 201 // Two favicons. The first two URLs will share the same one, while the last |
| 202 // one will have a unique favicon. | 202 // one will have a unique favicon. |
| 203 FavIconID favicon1 = thumb_db_->AddFavIcon(GURL("http://favicon/url1"), | 203 FaviconID favicon1 = thumb_db_->AddFavIcon(GURL("http://favicon/url1"), |
| 204 FAV_ICON); | 204 FAV_ICON); |
| 205 FavIconID favicon2 = thumb_db_->AddFavIcon(GURL("http://favicon/url2"), | 205 FaviconID favicon2 = thumb_db_->AddFavIcon(GURL("http://favicon/url2"), |
| 206 FAV_ICON); | 206 FAV_ICON); |
| 207 | 207 |
| 208 // Three URLs. | 208 // Three URLs. |
| 209 URLRow url_row1(GURL("http://www.google.com/1")); | 209 URLRow url_row1(GURL("http://www.google.com/1")); |
| 210 url_row1.set_last_visit(visit_times[0]); | 210 url_row1.set_last_visit(visit_times[0]); |
| 211 url_row1.set_visit_count(1); | 211 url_row1.set_visit_count(1); |
| 212 url_ids[0] = main_db_->AddURL(url_row1); | 212 url_ids[0] = main_db_->AddURL(url_row1); |
| 213 thumb_db_->AddIconMapping(url_row1.url(), favicon1); | 213 thumb_db_->AddIconMapping(url_row1.url(), favicon1); |
| 214 | 214 |
| 215 URLRow url_row2(GURL("http://www.google.com/2")); | 215 URLRow url_row2(GURL("http://www.google.com/2")); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 main_db_->AddVisit(&visit_row2, SOURCE_BROWSED); | 303 main_db_->AddVisit(&visit_row2, SOURCE_BROWSED); |
| 304 | 304 |
| 305 VisitRow visit_row3(url_id, last_visit_time - TimeDelta::FromDays(2), 0, | 305 VisitRow visit_row3(url_id, last_visit_time - TimeDelta::FromDays(2), 0, |
| 306 PageTransition::TYPED, 0); | 306 PageTransition::TYPED, 0); |
| 307 main_db_->AddVisit(&visit_row3, SOURCE_EXTENSION); | 307 main_db_->AddVisit(&visit_row3, SOURCE_EXTENSION); |
| 308 | 308 |
| 309 VisitRow visit_row4(url_id, last_visit_time, 0, PageTransition::TYPED, 0); | 309 VisitRow visit_row4(url_id, last_visit_time, 0, PageTransition::TYPED, 0); |
| 310 main_db_->AddVisit(&visit_row4, SOURCE_FIREFOX_IMPORTED); | 310 main_db_->AddVisit(&visit_row4, SOURCE_FIREFOX_IMPORTED); |
| 311 } | 311 } |
| 312 | 312 |
| 313 bool ExpireHistoryTest::HasFavIcon(FavIconID favicon_id) { | 313 bool ExpireHistoryTest::HasFavIcon(FaviconID favicon_id) { |
| 314 if (!thumb_db_.get() || favicon_id == 0) | 314 if (!thumb_db_.get() || favicon_id == 0) |
| 315 return false; | 315 return false; |
| 316 Time last_updated; | 316 Time last_updated; |
| 317 std::vector<unsigned char> icon_data_unused; | 317 std::vector<unsigned char> icon_data_unused; |
| 318 GURL icon_url; | 318 GURL icon_url; |
| 319 return thumb_db_->GetFavicon(favicon_id, &last_updated, &icon_data_unused, | 319 return thumb_db_->GetFavicon(favicon_id, &last_updated, &icon_data_unused, |
| 320 &icon_url); | 320 &icon_url); |
| 321 } | 321 } |
| 322 | 322 |
| 323 FavIconID ExpireHistoryTest::GetFavicon(const GURL& page_url, | 323 FaviconID ExpireHistoryTest::GetFavicon(const GURL& page_url, |
| 324 IconType icon_type) { | 324 IconType icon_type) { |
| 325 IconMapping icon_mapping; | 325 IconMapping icon_mapping; |
| 326 thumb_db_->GetIconMappingForPageURL(page_url, icon_type, &icon_mapping); | 326 thumb_db_->GetIconMappingForPageURL(page_url, icon_type, &icon_mapping); |
| 327 return icon_mapping.icon_id; | 327 return icon_mapping.icon_id; |
| 328 } | 328 } |
| 329 | 329 |
| 330 bool ExpireHistoryTest::HasThumbnail(URLID url_id) { | 330 bool ExpireHistoryTest::HasThumbnail(URLID url_id) { |
| 331 // TODO(sky): fix this. This test isn't really valid for TopSites. For | 331 // TODO(sky): fix this. This test isn't really valid for TopSites. For |
| 332 // TopSites we should be checking URL always, not the id. | 332 // TopSites we should be checking URL always, not the id. |
| 333 URLRow info; | 333 URLRow info; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 found_typed_changed_notification = true; | 406 found_typed_changed_notification = true; |
| 407 } | 407 } |
| 408 } | 408 } |
| 409 EXPECT_TRUE(found_delete_notification); | 409 EXPECT_TRUE(found_delete_notification); |
| 410 EXPECT_EQ(row.typed_count() > 0, found_typed_changed_notification); | 410 EXPECT_EQ(row.typed_count() > 0, found_typed_changed_notification); |
| 411 } | 411 } |
| 412 | 412 |
| 413 TEST_F(ExpireHistoryTest, DeleteFaviconsIfPossible) { | 413 TEST_F(ExpireHistoryTest, DeleteFaviconsIfPossible) { |
| 414 // Add a favicon record. | 414 // Add a favicon record. |
| 415 const GURL favicon_url("http://www.google.com/favicon.ico"); | 415 const GURL favicon_url("http://www.google.com/favicon.ico"); |
| 416 FavIconID icon_id = thumb_db_->AddFavIcon(favicon_url, FAV_ICON); | 416 FaviconID icon_id = thumb_db_->AddFavIcon(favicon_url, FAV_ICON); |
| 417 EXPECT_TRUE(icon_id); | 417 EXPECT_TRUE(icon_id); |
| 418 EXPECT_TRUE(HasFavIcon(icon_id)); | 418 EXPECT_TRUE(HasFavIcon(icon_id)); |
| 419 | 419 |
| 420 // The favicon should be deletable with no users. | 420 // The favicon should be deletable with no users. |
| 421 std::set<FavIconID> favicon_set; | 421 std::set<FaviconID> favicon_set; |
| 422 favicon_set.insert(icon_id); | 422 favicon_set.insert(icon_id); |
| 423 expirer_.DeleteFaviconsIfPossible(favicon_set); | 423 expirer_.DeleteFaviconsIfPossible(favicon_set); |
| 424 EXPECT_FALSE(HasFavIcon(icon_id)); | 424 EXPECT_FALSE(HasFavIcon(icon_id)); |
| 425 | 425 |
| 426 // Add back the favicon. | 426 // Add back the favicon. |
| 427 icon_id = thumb_db_->AddFavIcon(favicon_url, TOUCH_ICON); | 427 icon_id = thumb_db_->AddFavIcon(favicon_url, TOUCH_ICON); |
| 428 EXPECT_TRUE(icon_id); | 428 EXPECT_TRUE(icon_id); |
| 429 EXPECT_TRUE(HasFavIcon(icon_id)); | 429 EXPECT_TRUE(HasFavIcon(icon_id)); |
| 430 | 430 |
| 431 // Add a page that references the favicon. | 431 // Add a page that references the favicon. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 453 // should also get deleted. | 453 // should also get deleted. |
| 454 // Fails near end of month. http://crbug.com/43586 | 454 // Fails near end of month. http://crbug.com/43586 |
| 455 TEST_F(ExpireHistoryTest, FLAKY_DeleteURLAndFavicon) { | 455 TEST_F(ExpireHistoryTest, FLAKY_DeleteURLAndFavicon) { |
| 456 URLID url_ids[3]; | 456 URLID url_ids[3]; |
| 457 Time visit_times[4]; | 457 Time visit_times[4]; |
| 458 AddExampleData(url_ids, visit_times); | 458 AddExampleData(url_ids, visit_times); |
| 459 | 459 |
| 460 // Verify things are the way we expect with a URL row, favicon, thumbnail. | 460 // Verify things are the way we expect with a URL row, favicon, thumbnail. |
| 461 URLRow last_row; | 461 URLRow last_row; |
| 462 ASSERT_TRUE(main_db_->GetURLRow(url_ids[2], &last_row)); | 462 ASSERT_TRUE(main_db_->GetURLRow(url_ids[2], &last_row)); |
| 463 FavIconID fav_icon_id = GetFavicon(last_row.url(), FAV_ICON); | 463 FaviconID fav_icon_id = GetFavicon(last_row.url(), FAV_ICON); |
| 464 EXPECT_TRUE(HasFavIcon(fav_icon_id)); | 464 EXPECT_TRUE(HasFavIcon(fav_icon_id)); |
| 465 // TODO(sky): fix this, see comment in HasThumbnail. | 465 // TODO(sky): fix this, see comment in HasThumbnail. |
| 466 // EXPECT_TRUE(HasThumbnail(url_ids[2])); | 466 // EXPECT_TRUE(HasThumbnail(url_ids[2])); |
| 467 | 467 |
| 468 VisitVector visits; | 468 VisitVector visits; |
| 469 main_db_->GetVisitsForURL(url_ids[2], &visits); | 469 main_db_->GetVisitsForURL(url_ids[2], &visits); |
| 470 ASSERT_EQ(1U, visits.size()); | 470 ASSERT_EQ(1U, visits.size()); |
| 471 EXPECT_EQ(1, CountTextMatchesForURL(last_row.url())); | 471 EXPECT_EQ(1, CountTextMatchesForURL(last_row.url())); |
| 472 | 472 |
| 473 // In this test we also make sure that any pending entries in the text | 473 // In this test we also make sure that any pending entries in the text |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 // Deletes a URL with a favicon that other URLs reference, so that the favicon | 517 // Deletes a URL with a favicon that other URLs reference, so that the favicon |
| 518 // should not get deleted. This also tests deleting more than one visit. | 518 // should not get deleted. This also tests deleting more than one visit. |
| 519 TEST_F(ExpireHistoryTest, DeleteURLWithoutFavicon) { | 519 TEST_F(ExpireHistoryTest, DeleteURLWithoutFavicon) { |
| 520 URLID url_ids[3]; | 520 URLID url_ids[3]; |
| 521 Time visit_times[4]; | 521 Time visit_times[4]; |
| 522 AddExampleData(url_ids, visit_times); | 522 AddExampleData(url_ids, visit_times); |
| 523 | 523 |
| 524 // Verify things are the way we expect with a URL row, favicon, thumbnail. | 524 // Verify things are the way we expect with a URL row, favicon, thumbnail. |
| 525 URLRow last_row; | 525 URLRow last_row; |
| 526 ASSERT_TRUE(main_db_->GetURLRow(url_ids[1], &last_row)); | 526 ASSERT_TRUE(main_db_->GetURLRow(url_ids[1], &last_row)); |
| 527 FavIconID fav_icon_id = GetFavicon(last_row.url(), FAV_ICON); | 527 FaviconID fav_icon_id = GetFavicon(last_row.url(), FAV_ICON); |
| 528 EXPECT_TRUE(HasFavIcon(fav_icon_id)); | 528 EXPECT_TRUE(HasFavIcon(fav_icon_id)); |
| 529 // TODO(sky): fix this, see comment in HasThumbnail. | 529 // TODO(sky): fix this, see comment in HasThumbnail. |
| 530 // EXPECT_TRUE(HasThumbnail(url_ids[1])); | 530 // EXPECT_TRUE(HasThumbnail(url_ids[1])); |
| 531 | 531 |
| 532 VisitVector visits; | 532 VisitVector visits; |
| 533 main_db_->GetVisitsForURL(url_ids[1], &visits); | 533 main_db_->GetVisitsForURL(url_ids[1], &visits); |
| 534 EXPECT_EQ(2U, visits.size()); | 534 EXPECT_EQ(2U, visits.size()); |
| 535 EXPECT_EQ(1, CountTextMatchesForURL(last_row.url())); | 535 EXPECT_EQ(1, CountTextMatchesForURL(last_row.url())); |
| 536 | 536 |
| 537 // Delete the URL and its dependencies. | 537 // Delete the URL and its dependencies. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 555 StarURL(url_row.url()); | 555 StarURL(url_row.url()); |
| 556 | 556 |
| 557 // Attempt to delete the url. | 557 // Attempt to delete the url. |
| 558 expirer_.DeleteURL(url_row.url()); | 558 expirer_.DeleteURL(url_row.url()); |
| 559 | 559 |
| 560 // Because the url is starred, it shouldn't be deleted. | 560 // Because the url is starred, it shouldn't be deleted. |
| 561 GURL url = url_row.url(); | 561 GURL url = url_row.url(); |
| 562 ASSERT_TRUE(main_db_->GetRowForURL(url, &url_row)); | 562 ASSERT_TRUE(main_db_->GetRowForURL(url, &url_row)); |
| 563 | 563 |
| 564 // And the favicon should exist. | 564 // And the favicon should exist. |
| 565 FavIconID fav_icon_id = GetFavicon(url_row.url(), FAV_ICON); | 565 FaviconID fav_icon_id = GetFavicon(url_row.url(), FAV_ICON); |
| 566 EXPECT_TRUE(HasFavIcon(fav_icon_id)); | 566 EXPECT_TRUE(HasFavIcon(fav_icon_id)); |
| 567 | 567 |
| 568 // But there should be no fts. | 568 // But there should be no fts. |
| 569 ASSERT_EQ(0, CountTextMatchesForURL(url_row.url())); | 569 ASSERT_EQ(0, CountTextMatchesForURL(url_row.url())); |
| 570 | 570 |
| 571 // And no visits. | 571 // And no visits. |
| 572 VisitVector visits; | 572 VisitVector visits; |
| 573 main_db_->GetVisitsForURL(url_row.id(), &visits); | 573 main_db_->GetVisitsForURL(url_row.id(), &visits); |
| 574 ASSERT_EQ(0U, visits.size()); | 574 ASSERT_EQ(0U, visits.size()); |
| 575 | 575 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 URLRow temp_row; | 625 URLRow temp_row; |
| 626 ASSERT_TRUE(main_db_->GetURLRow(url_ids[1], &temp_row)); | 626 ASSERT_TRUE(main_db_->GetURLRow(url_ids[1], &temp_row)); |
| 627 EXPECT_TRUE(visit_times[2] == url_row1.last_visit()); // Previous value. | 627 EXPECT_TRUE(visit_times[2] == url_row1.last_visit()); // Previous value. |
| 628 EXPECT_TRUE(visit_times[1] == temp_row.last_visit()); // New value. | 628 EXPECT_TRUE(visit_times[1] == temp_row.last_visit()); // New value. |
| 629 EXPECT_EQ(2, url_row1.visit_count()); | 629 EXPECT_EQ(2, url_row1.visit_count()); |
| 630 EXPECT_EQ(1, temp_row.visit_count()); | 630 EXPECT_EQ(1, temp_row.visit_count()); |
| 631 EXPECT_EQ(1, url_row1.typed_count()); | 631 EXPECT_EQ(1, url_row1.typed_count()); |
| 632 EXPECT_EQ(0, temp_row.typed_count()); | 632 EXPECT_EQ(0, temp_row.typed_count()); |
| 633 | 633 |
| 634 // Verify that the middle URL's favicon and thumbnail is still there. | 634 // Verify that the middle URL's favicon and thumbnail is still there. |
| 635 FavIconID fav_icon_id = GetFavicon(url_row1.url(), FAV_ICON); | 635 FaviconID fav_icon_id = GetFavicon(url_row1.url(), FAV_ICON); |
| 636 EXPECT_TRUE(HasFavIcon(fav_icon_id)); | 636 EXPECT_TRUE(HasFavIcon(fav_icon_id)); |
| 637 // TODO(sky): fix this, see comment in HasThumbnail. | 637 // TODO(sky): fix this, see comment in HasThumbnail. |
| 638 // EXPECT_TRUE(HasThumbnail(url_row1.id())); | 638 // EXPECT_TRUE(HasThumbnail(url_row1.id())); |
| 639 | 639 |
| 640 // Verify that the last URL was deleted. | 640 // Verify that the last URL was deleted. |
| 641 FavIconID fav_icon_id2 = GetFavicon(url_row2.url(), FAV_ICON); | 641 FaviconID fav_icon_id2 = GetFavicon(url_row2.url(), FAV_ICON); |
| 642 EnsureURLInfoGone(url_row2); | 642 EnsureURLInfoGone(url_row2); |
| 643 EXPECT_FALSE(HasFavIcon(fav_icon_id2)); | 643 EXPECT_FALSE(HasFavIcon(fav_icon_id2)); |
| 644 } | 644 } |
| 645 | 645 |
| 646 // Expires only a specific URLs more recent than a given time, with no starred | 646 // Expires only a specific URLs more recent than a given time, with no starred |
| 647 // items. Our time threshold is such that the URL should be updated (we delete | 647 // items. Our time threshold is such that the URL should be updated (we delete |
| 648 // one of the two visits). | 648 // one of the two visits). |
| 649 TEST_F(ExpireHistoryTest, FlushRecentURLsUnstarredRestricted) { | 649 TEST_F(ExpireHistoryTest, FlushRecentURLsUnstarredRestricted) { |
| 650 URLID url_ids[3]; | 650 URLID url_ids[3]; |
| 651 Time visit_times[4]; | 651 Time visit_times[4]; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 URLRow temp_row; | 684 URLRow temp_row; |
| 685 ASSERT_TRUE(main_db_->GetURLRow(url_ids[1], &temp_row)); | 685 ASSERT_TRUE(main_db_->GetURLRow(url_ids[1], &temp_row)); |
| 686 EXPECT_TRUE(visit_times[2] == url_row1.last_visit()); // Previous value. | 686 EXPECT_TRUE(visit_times[2] == url_row1.last_visit()); // Previous value. |
| 687 EXPECT_TRUE(visit_times[1] == temp_row.last_visit()); // New value. | 687 EXPECT_TRUE(visit_times[1] == temp_row.last_visit()); // New value. |
| 688 EXPECT_EQ(2, url_row1.visit_count()); | 688 EXPECT_EQ(2, url_row1.visit_count()); |
| 689 EXPECT_EQ(1, temp_row.visit_count()); | 689 EXPECT_EQ(1, temp_row.visit_count()); |
| 690 EXPECT_EQ(1, url_row1.typed_count()); | 690 EXPECT_EQ(1, url_row1.typed_count()); |
| 691 EXPECT_EQ(0, temp_row.typed_count()); | 691 EXPECT_EQ(0, temp_row.typed_count()); |
| 692 | 692 |
| 693 // Verify that the middle URL's favicon and thumbnail is still there. | 693 // Verify that the middle URL's favicon and thumbnail is still there. |
| 694 FavIconID fav_icon_id = GetFavicon(url_row1.url(), FAV_ICON); | 694 FaviconID fav_icon_id = GetFavicon(url_row1.url(), FAV_ICON); |
| 695 EXPECT_TRUE(HasFavIcon(fav_icon_id)); | 695 EXPECT_TRUE(HasFavIcon(fav_icon_id)); |
| 696 // TODO(sky): fix this, see comment in HasThumbnail. | 696 // TODO(sky): fix this, see comment in HasThumbnail. |
| 697 // EXPECT_TRUE(HasThumbnail(url_row1.id())); | 697 // EXPECT_TRUE(HasThumbnail(url_row1.id())); |
| 698 | 698 |
| 699 // Verify that the last URL was not touched. | 699 // Verify that the last URL was not touched. |
| 700 EXPECT_TRUE(main_db_->GetURLRow(url_ids[2], &temp_row)); | 700 EXPECT_TRUE(main_db_->GetURLRow(url_ids[2], &temp_row)); |
| 701 EXPECT_TRUE(HasFavIcon(fav_icon_id)); | 701 EXPECT_TRUE(HasFavIcon(fav_icon_id)); |
| 702 // TODO(sky): fix this, see comment in HasThumbnail. | 702 // TODO(sky): fix this, see comment in HasThumbnail. |
| 703 // EXPECT_TRUE(HasThumbnail(url_row2.id())); | 703 // EXPECT_TRUE(HasThumbnail(url_row2.id())); |
| 704 } | 704 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 733 // Visit/typed count should not be updated for bookmarks. | 733 // Visit/typed count should not be updated for bookmarks. |
| 734 EXPECT_EQ(0, new_url_row1.typed_count()); | 734 EXPECT_EQ(0, new_url_row1.typed_count()); |
| 735 EXPECT_EQ(1, new_url_row1.visit_count()); | 735 EXPECT_EQ(1, new_url_row1.visit_count()); |
| 736 EXPECT_EQ(0, new_url_row2.typed_count()); | 736 EXPECT_EQ(0, new_url_row2.typed_count()); |
| 737 EXPECT_EQ(0, new_url_row2.visit_count()); | 737 EXPECT_EQ(0, new_url_row2.visit_count()); |
| 738 | 738 |
| 739 // Thumbnails and favicons should still exist. Note that we keep thumbnails | 739 // Thumbnails and favicons should still exist. Note that we keep thumbnails |
| 740 // that may have been updated since the time threshold. Since the URL still | 740 // that may have been updated since the time threshold. Since the URL still |
| 741 // exists in history, this should not be a privacy problem, we only update | 741 // exists in history, this should not be a privacy problem, we only update |
| 742 // the visit counts in this case for consistency anyway. | 742 // the visit counts in this case for consistency anyway. |
| 743 FavIconID fav_icon_id = GetFavicon(url_row1.url(), FAV_ICON); | 743 FaviconID fav_icon_id = GetFavicon(url_row1.url(), FAV_ICON); |
| 744 EXPECT_TRUE(HasFavIcon(fav_icon_id)); | 744 EXPECT_TRUE(HasFavIcon(fav_icon_id)); |
| 745 // TODO(sky): fix this, see comment in HasThumbnail. | 745 // TODO(sky): fix this, see comment in HasThumbnail. |
| 746 // EXPECT_TRUE(HasThumbnail(new_url_row1.id())); | 746 // EXPECT_TRUE(HasThumbnail(new_url_row1.id())); |
| 747 fav_icon_id = GetFavicon(url_row1.url(), FAV_ICON); | 747 fav_icon_id = GetFavicon(url_row1.url(), FAV_ICON); |
| 748 EXPECT_TRUE(HasFavIcon(fav_icon_id)); | 748 EXPECT_TRUE(HasFavIcon(fav_icon_id)); |
| 749 // TODO(sky): fix this, see comment in HasThumbnail. | 749 // TODO(sky): fix this, see comment in HasThumbnail. |
| 750 // EXPECT_TRUE(HasThumbnail(new_url_row2.id())); | 750 // EXPECT_TRUE(HasThumbnail(new_url_row2.id())); |
| 751 } | 751 } |
| 752 | 752 |
| 753 TEST_F(ExpireHistoryTest, ArchiveHistoryBeforeUnstarred) { | 753 TEST_F(ExpireHistoryTest, ArchiveHistoryBeforeUnstarred) { |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 main_db_->GetVisitsForURL(url_id, &archived_visits); | 928 main_db_->GetVisitsForURL(url_id, &archived_visits); |
| 929 EXPECT_EQ(0U, archived_visits.size()); | 929 EXPECT_EQ(0U, archived_visits.size()); |
| 930 } | 930 } |
| 931 | 931 |
| 932 // TODO(brettw) add some visits with no URL to make sure everything is updated | 932 // TODO(brettw) add some visits with no URL to make sure everything is updated |
| 933 // properly. Have the visits also refer to nonexistent FTS rows. | 933 // properly. Have the visits also refer to nonexistent FTS rows. |
| 934 // | 934 // |
| 935 // Maybe also refer to invalid favicons. | 935 // Maybe also refer to invalid favicons. |
| 936 | 936 |
| 937 } // namespace history | 937 } // namespace history |
| OLD | NEW |