OLD | NEW |
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 "chrome/browser/history/history_backend.h" | 5 #include "chrome/browser/history/history_backend.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
18 #include "base/path_service.h" | 18 #include "base/path_service.h" |
19 #include "base/run_loop.h" | 19 #include "base/run_loop.h" |
20 #include "base/strings/string16.h" | 20 #include "base/strings/string16.h" |
21 #include "base/strings/string_number_conversions.h" | 21 #include "base/strings/string_number_conversions.h" |
22 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
23 #include "chrome/browser/bookmarks/bookmark_model.h" | 23 #include "chrome/browser/bookmarks/bookmark_model.h" |
24 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 24 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
25 #include "chrome/browser/bookmarks/bookmark_test_helpers.h" | 25 #include "chrome/browser/bookmarks/bookmark_test_helpers.h" |
26 #include "chrome/browser/bookmarks/bookmark_utils.h" | 26 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 27 #include "chrome/browser/bookmarks/test_bookmark_client.h" |
27 #include "chrome/browser/chrome_notification_types.h" | 28 #include "chrome/browser/chrome_notification_types.h" |
28 #include "chrome/browser/history/history_notifications.h" | 29 #include "chrome/browser/history/history_notifications.h" |
29 #include "chrome/browser/history/history_service.h" | 30 #include "chrome/browser/history/history_service.h" |
30 #include "chrome/browser/history/history_service_factory.h" | 31 #include "chrome/browser/history/history_service_factory.h" |
31 #include "chrome/browser/history/in_memory_database.h" | 32 #include "chrome/browser/history/in_memory_database.h" |
32 #include "chrome/browser/history/in_memory_history_backend.h" | 33 #include "chrome/browser/history/in_memory_history_backend.h" |
33 #include "chrome/browser/history/visit_filter.h" | 34 #include "chrome/browser/history/visit_filter.h" |
34 #include "chrome/common/chrome_constants.h" | 35 #include "chrome/common/chrome_constants.h" |
35 #include "chrome/common/chrome_paths.h" | 36 #include "chrome/common/chrome_paths.h" |
36 #include "chrome/common/importer/imported_favicon_usage.h" | 37 #include "chrome/common/importer/imported_favicon_usage.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 AddRequest(request, this); | 109 AddRequest(request, this); |
109 return request->handle(); | 110 return request->handle(); |
110 } | 111 } |
111 }; | 112 }; |
112 | 113 |
113 class HistoryBackendTestBase : public testing::Test { | 114 class HistoryBackendTestBase : public testing::Test { |
114 public: | 115 public: |
115 typedef std::vector<std::pair<int, HistoryDetails*> > NotificationList; | 116 typedef std::vector<std::pair<int, HistoryDetails*> > NotificationList; |
116 | 117 |
117 HistoryBackendTestBase() | 118 HistoryBackendTestBase() |
118 : bookmark_model_(NULL, false), | 119 : bookmark_model_(bookmark_client_.CreateModel(false)), |
119 loaded_(false), | 120 loaded_(false), |
120 ui_thread_(content::BrowserThread::UI, &message_loop_) { | 121 ui_thread_(content::BrowserThread::UI, &message_loop_) {} |
121 } | |
122 | 122 |
123 virtual ~HistoryBackendTestBase() { | 123 virtual ~HistoryBackendTestBase() { |
124 STLDeleteValues(&broadcasted_notifications_); | 124 STLDeleteValues(&broadcasted_notifications_); |
125 } | 125 } |
126 | 126 |
127 protected: | 127 protected: |
128 int num_broadcasted_notifications() const { | 128 int num_broadcasted_notifications() const { |
129 return broadcasted_notifications_.size(); | 129 return broadcasted_notifications_.size(); |
130 } | 130 } |
131 | 131 |
(...skipping 13 matching lines...) Expand all Loading... |
145 // Send the notifications directly to the in-memory database. | 145 // Send the notifications directly to the in-memory database. |
146 content::Details<HistoryDetails> det(details.get()); | 146 content::Details<HistoryDetails> det(details.get()); |
147 mem_backend_->Observe( | 147 mem_backend_->Observe( |
148 type, content::Source<HistoryBackendTestBase>(NULL), det); | 148 type, content::Source<HistoryBackendTestBase>(NULL), det); |
149 | 149 |
150 // The backend passes ownership of the details pointer to us. | 150 // The backend passes ownership of the details pointer to us. |
151 broadcasted_notifications_.push_back( | 151 broadcasted_notifications_.push_back( |
152 std::make_pair(type, details.release())); | 152 std::make_pair(type, details.release())); |
153 } | 153 } |
154 | 154 |
| 155 test::TestBookmarkClient bookmark_client_; |
155 scoped_refptr<HistoryBackend> backend_; // Will be NULL on init failure. | 156 scoped_refptr<HistoryBackend> backend_; // Will be NULL on init failure. |
156 scoped_ptr<InMemoryHistoryBackend> mem_backend_; | 157 scoped_ptr<InMemoryHistoryBackend> mem_backend_; |
157 BookmarkModel bookmark_model_; | 158 scoped_ptr<BookmarkModel> bookmark_model_; |
158 bool loaded_; | 159 bool loaded_; |
159 | 160 |
160 private: | 161 private: |
161 friend class HistoryBackendTestDelegate; | 162 friend class HistoryBackendTestDelegate; |
162 | 163 |
163 // testing::Test | 164 // testing::Test |
164 virtual void SetUp() { | 165 virtual void SetUp() { |
165 if (!base::CreateNewTempDirectory(FILE_PATH_LITERAL("BackendTest"), | 166 if (!base::CreateNewTempDirectory(FILE_PATH_LITERAL("BackendTest"), |
166 &test_dir_)) | 167 &test_dir_)) |
167 return; | 168 return; |
168 backend_ = new HistoryBackend(test_dir_, | 169 backend_ = new HistoryBackend( |
169 new HistoryBackendTestDelegate(this), | 170 test_dir_, new HistoryBackendTestDelegate(this), bookmark_model_.get()); |
170 &bookmark_model_); | |
171 backend_->Init(std::string(), false); | 171 backend_->Init(std::string(), false); |
172 } | 172 } |
173 | 173 |
174 virtual void TearDown() { | 174 virtual void TearDown() { |
175 if (backend_.get()) | 175 if (backend_.get()) |
176 backend_->Closing(); | 176 backend_->Closing(); |
177 backend_ = NULL; | 177 backend_ = NULL; |
178 mem_backend_.reset(); | 178 mem_backend_.reset(); |
179 base::DeleteFile(test_dir_, true); | 179 base::DeleteFile(test_dir_, true); |
180 base::RunLoop().RunUntilIdle(); | 180 base::RunLoop().RunUntilIdle(); |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 backend_->db_->GetVisitsForURL(row2_id, &visits); | 604 backend_->db_->GetVisitsForURL(row2_id, &visits); |
605 ASSERT_EQ(1U, visits.size()); | 605 ASSERT_EQ(1U, visits.size()); |
606 | 606 |
607 // The in-memory backend should have been set and it should have gotten the | 607 // The in-memory backend should have been set and it should have gotten the |
608 // typed URL. | 608 // typed URL. |
609 ASSERT_TRUE(mem_backend_.get()); | 609 ASSERT_TRUE(mem_backend_.get()); |
610 URLRow outrow1; | 610 URLRow outrow1; |
611 EXPECT_TRUE(mem_backend_->db_->GetRowForURL(row1.url(), NULL)); | 611 EXPECT_TRUE(mem_backend_->db_->GetRowForURL(row1.url(), NULL)); |
612 | 612 |
613 // Star row1. | 613 // Star row1. |
614 bookmark_model_.AddURL( | 614 bookmark_model_->AddURL( |
615 bookmark_model_.bookmark_bar_node(), 0, base::string16(), row1.url()); | 615 bookmark_model_->bookmark_bar_node(), 0, base::string16(), row1.url()); |
616 | 616 |
617 // Now finally clear all history. | 617 // Now finally clear all history. |
618 ClearBroadcastedNotifications(); | 618 ClearBroadcastedNotifications(); |
619 backend_->DeleteAllHistory(); | 619 backend_->DeleteAllHistory(); |
620 | 620 |
621 // The first URL should be preserved but the time should be cleared. | 621 // The first URL should be preserved but the time should be cleared. |
622 EXPECT_TRUE(backend_->db_->GetRowForURL(row1.url(), &outrow1)); | 622 EXPECT_TRUE(backend_->db_->GetRowForURL(row1.url(), &outrow1)); |
623 EXPECT_EQ(row1.url(), outrow1.url()); | 623 EXPECT_EQ(row1.url(), outrow1.url()); |
624 EXPECT_EQ(0, outrow1.visit_count()); | 624 EXPECT_EQ(0, outrow1.visit_count()); |
625 EXPECT_EQ(0, outrow1.typed_count()); | 625 EXPECT_EQ(0, outrow1.typed_count()); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 | 669 |
670 // The remaining URL should still reference the same favicon, even if its | 670 // The remaining URL should still reference the same favicon, even if its |
671 // ID has changed. | 671 // ID has changed. |
672 std::vector<IconMapping> mappings; | 672 std::vector<IconMapping> mappings; |
673 EXPECT_TRUE(backend_->thumbnail_db_->GetIconMappingsForPageURL( | 673 EXPECT_TRUE(backend_->thumbnail_db_->GetIconMappingsForPageURL( |
674 outrow1.url(), favicon_base::FAVICON, &mappings)); | 674 outrow1.url(), favicon_base::FAVICON, &mappings)); |
675 EXPECT_EQ(1u, mappings.size()); | 675 EXPECT_EQ(1u, mappings.size()); |
676 EXPECT_EQ(out_favicon1, mappings[0].icon_id); | 676 EXPECT_EQ(out_favicon1, mappings[0].icon_id); |
677 | 677 |
678 // The first URL should still be bookmarked. | 678 // The first URL should still be bookmarked. |
679 EXPECT_TRUE(bookmark_model_.IsBookmarked(row1.url())); | 679 EXPECT_TRUE(bookmark_model_->IsBookmarked(row1.url())); |
680 | 680 |
681 // Check that we fire the notification about all history having been deleted. | 681 // Check that we fire the notification about all history having been deleted. |
682 ASSERT_EQ(1u, broadcasted_notifications().size()); | 682 ASSERT_EQ(1u, broadcasted_notifications().size()); |
683 ASSERT_EQ(chrome::NOTIFICATION_HISTORY_URLS_DELETED, | 683 ASSERT_EQ(chrome::NOTIFICATION_HISTORY_URLS_DELETED, |
684 broadcasted_notifications()[0].first); | 684 broadcasted_notifications()[0].first); |
685 const URLsDeletedDetails* details = static_cast<const URLsDeletedDetails*>( | 685 const URLsDeletedDetails* details = static_cast<const URLsDeletedDetails*>( |
686 broadcasted_notifications()[0].second); | 686 broadcasted_notifications()[0].second); |
687 EXPECT_TRUE(details->all_history); | 687 EXPECT_TRUE(details->all_history); |
688 EXPECT_FALSE(details->archived); | 688 EXPECT_FALSE(details->archived); |
689 } | 689 } |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 | 767 |
768 URLRows rows; | 768 URLRows rows; |
769 rows.push_back(row2); // Reversed order for the same reason as favicons. | 769 rows.push_back(row2); // Reversed order for the same reason as favicons. |
770 rows.push_back(row1); | 770 rows.push_back(row1); |
771 backend_->AddPagesWithDetails(rows, history::SOURCE_BROWSED); | 771 backend_->AddPagesWithDetails(rows, history::SOURCE_BROWSED); |
772 | 772 |
773 URLID row1_id = backend_->db_->GetRowForURL(row1.url(), NULL); | 773 URLID row1_id = backend_->db_->GetRowForURL(row1.url(), NULL); |
774 URLID row2_id = backend_->db_->GetRowForURL(row2.url(), NULL); | 774 URLID row2_id = backend_->db_->GetRowForURL(row2.url(), NULL); |
775 | 775 |
776 // Star the two URLs. | 776 // Star the two URLs. |
777 bookmark_utils::AddIfNotBookmarked(&bookmark_model_, row1.url(), | 777 bookmark_utils::AddIfNotBookmarked( |
778 base::string16()); | 778 bookmark_model_.get(), row1.url(), base::string16()); |
779 bookmark_utils::AddIfNotBookmarked(&bookmark_model_, row2.url(), | 779 bookmark_utils::AddIfNotBookmarked( |
780 base::string16()); | 780 bookmark_model_.get(), row2.url(), base::string16()); |
781 | 781 |
782 // Delete url 2. Because url 2 is starred this won't delete the URL, only | 782 // Delete url 2. Because url 2 is starred this won't delete the URL, only |
783 // the visits. | 783 // the visits. |
784 backend_->expirer_.DeleteURL(row2.url()); | 784 backend_->expirer_.DeleteURL(row2.url()); |
785 | 785 |
786 // Make sure url 2 is still valid, but has no visits. | 786 // Make sure url 2 is still valid, but has no visits. |
787 URLRow tmp_url_row; | 787 URLRow tmp_url_row; |
788 EXPECT_EQ(row2_id, backend_->db_->GetRowForURL(row2.url(), NULL)); | 788 EXPECT_EQ(row2_id, backend_->db_->GetRowForURL(row2.url(), NULL)); |
789 VisitVector visits; | 789 VisitVector visits; |
790 backend_->db_->GetVisitsForURL(row2_id, &visits); | 790 backend_->db_->GetVisitsForURL(row2_id, &visits); |
791 EXPECT_EQ(0U, visits.size()); | 791 EXPECT_EQ(0U, visits.size()); |
792 // The favicon should still be valid. | 792 // The favicon should still be valid. |
793 EXPECT_EQ(favicon2, | 793 EXPECT_EQ(favicon2, |
794 backend_->thumbnail_db_->GetFaviconIDForFaviconURL( | 794 backend_->thumbnail_db_->GetFaviconIDForFaviconURL( |
795 favicon_url2, favicon_base::FAVICON, NULL)); | 795 favicon_url2, favicon_base::FAVICON, NULL)); |
796 | 796 |
797 // Unstar row2. | 797 // Unstar row2. |
798 bookmark_utils::RemoveAllBookmarks(&bookmark_model_, row2.url()); | 798 bookmark_utils::RemoveAllBookmarks(bookmark_model_.get(), row2.url()); |
799 | 799 |
800 // Tell the backend it was unstarred. We have to explicitly do this as | 800 // Tell the backend it was unstarred. We have to explicitly do this as |
801 // BookmarkModel isn't wired up to the backend during testing. | 801 // BookmarkModel isn't wired up to the backend during testing. |
802 std::set<GURL> unstarred_urls; | 802 std::set<GURL> unstarred_urls; |
803 unstarred_urls.insert(row2.url()); | 803 unstarred_urls.insert(row2.url()); |
804 backend_->URLsNoLongerBookmarked(unstarred_urls); | 804 backend_->URLsNoLongerBookmarked(unstarred_urls); |
805 | 805 |
806 // The URL should no longer exist. | 806 // The URL should no longer exist. |
807 EXPECT_FALSE(backend_->db_->GetRowForURL(row2.url(), &tmp_url_row)); | 807 EXPECT_FALSE(backend_->db_->GetRowForURL(row2.url(), &tmp_url_row)); |
808 // And the favicon should be deleted. | 808 // And the favicon should be deleted. |
809 EXPECT_EQ(0, | 809 EXPECT_EQ(0, |
810 backend_->thumbnail_db_->GetFaviconIDForFaviconURL( | 810 backend_->thumbnail_db_->GetFaviconIDForFaviconURL( |
811 favicon_url2, favicon_base::FAVICON, NULL)); | 811 favicon_url2, favicon_base::FAVICON, NULL)); |
812 | 812 |
813 // Unstar row 1. | 813 // Unstar row 1. |
814 bookmark_utils::RemoveAllBookmarks(&bookmark_model_, row1.url()); | 814 bookmark_utils::RemoveAllBookmarks(bookmark_model_.get(), row1.url()); |
815 // Tell the backend it was unstarred. We have to explicitly do this as | 815 // Tell the backend it was unstarred. We have to explicitly do this as |
816 // BookmarkModel isn't wired up to the backend during testing. | 816 // BookmarkModel isn't wired up to the backend during testing. |
817 unstarred_urls.clear(); | 817 unstarred_urls.clear(); |
818 unstarred_urls.insert(row1.url()); | 818 unstarred_urls.insert(row1.url()); |
819 backend_->URLsNoLongerBookmarked(unstarred_urls); | 819 backend_->URLsNoLongerBookmarked(unstarred_urls); |
820 | 820 |
821 // The URL should still exist (because there were visits). | 821 // The URL should still exist (because there were visits). |
822 EXPECT_EQ(row1_id, backend_->db_->GetRowForURL(row1.url(), NULL)); | 822 EXPECT_EQ(row1_id, backend_->db_->GetRowForURL(row1.url(), NULL)); |
823 | 823 |
824 // There should still be visits. | 824 // There should still be visits. |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 favicons.clear(); | 1076 favicons.clear(); |
1077 favicon.favicon_url = GURL("http://mail.google.com/favicon.ico"); | 1077 favicon.favicon_url = GURL("http://mail.google.com/favicon.ico"); |
1078 favicon.png_data.push_back('3'); | 1078 favicon.png_data.push_back('3'); |
1079 favicon.urls.insert(url3); | 1079 favicon.urls.insert(url3); |
1080 favicons.push_back(favicon); | 1080 favicons.push_back(favicon); |
1081 backend_->SetImportedFavicons(favicons); | 1081 backend_->SetImportedFavicons(favicons); |
1082 URLRow url_row3; | 1082 URLRow url_row3; |
1083 EXPECT_TRUE(backend_->db_->GetRowForURL(url3, &url_row3) == 0); | 1083 EXPECT_TRUE(backend_->db_->GetRowForURL(url3, &url_row3) == 0); |
1084 | 1084 |
1085 // If the URL is bookmarked, it should get added to history with 0 visits. | 1085 // If the URL is bookmarked, it should get added to history with 0 visits. |
1086 bookmark_model_.AddURL(bookmark_model_.bookmark_bar_node(), 0, | 1086 bookmark_model_->AddURL( |
1087 base::string16(), url3); | 1087 bookmark_model_->bookmark_bar_node(), 0, base::string16(), url3); |
1088 backend_->SetImportedFavicons(favicons); | 1088 backend_->SetImportedFavicons(favicons); |
1089 EXPECT_FALSE(backend_->db_->GetRowForURL(url3, &url_row3) == 0); | 1089 EXPECT_FALSE(backend_->db_->GetRowForURL(url3, &url_row3) == 0); |
1090 EXPECT_TRUE(url_row3.visit_count() == 0); | 1090 EXPECT_TRUE(url_row3.visit_count() == 0); |
1091 } | 1091 } |
1092 | 1092 |
1093 TEST_F(HistoryBackendTest, StripUsernamePasswordTest) { | 1093 TEST_F(HistoryBackendTest, StripUsernamePasswordTest) { |
1094 ASSERT_TRUE(backend_.get()); | 1094 ASSERT_TRUE(backend_.get()); |
1095 | 1095 |
1096 GURL url("http://anyuser:anypass@www.google.com"); | 1096 GURL url("http://anyuser:anypass@www.google.com"); |
1097 GURL stripped_url("http://www.google.com"); | 1097 GURL stripped_url("http://www.google.com"); |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1479 // in Teardown. | 1479 // in Teardown. |
1480 base::FilePath new_history_path(test_dir()); | 1480 base::FilePath new_history_path(test_dir()); |
1481 base::DeleteFile(new_history_path, true); | 1481 base::DeleteFile(new_history_path, true); |
1482 base::CreateDirectory(new_history_path); | 1482 base::CreateDirectory(new_history_path); |
1483 base::FilePath new_history_file = | 1483 base::FilePath new_history_file = |
1484 new_history_path.Append(chrome::kHistoryFilename); | 1484 new_history_path.Append(chrome::kHistoryFilename); |
1485 ASSERT_TRUE(base::CopyFile(old_history_path, new_history_file)); | 1485 ASSERT_TRUE(base::CopyFile(old_history_path, new_history_file)); |
1486 | 1486 |
1487 backend_ = new HistoryBackend(new_history_path, | 1487 backend_ = new HistoryBackend(new_history_path, |
1488 new HistoryBackendTestDelegate(this), | 1488 new HistoryBackendTestDelegate(this), |
1489 &bookmark_model_); | 1489 bookmark_model_.get()); |
1490 backend_->Init(std::string(), false); | 1490 backend_->Init(std::string(), false); |
1491 backend_->Closing(); | 1491 backend_->Closing(); |
1492 backend_ = NULL; | 1492 backend_ = NULL; |
1493 | 1493 |
1494 // Now the database should already be migrated. | 1494 // Now the database should already be migrated. |
1495 // Check version first. | 1495 // Check version first. |
1496 int cur_version = HistoryDatabase::GetCurrentVersion(); | 1496 int cur_version = HistoryDatabase::GetCurrentVersion(); |
1497 sql::Connection db; | 1497 sql::Connection db; |
1498 ASSERT_TRUE(db.Open(new_history_file)); | 1498 ASSERT_TRUE(db.Open(new_history_file)); |
1499 sql::Statement s(db.GetUniqueStatement( | 1499 sql::Statement s(db.GetUniqueStatement( |
(...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2882 base::CreateDirectory(new_history_path); | 2882 base::CreateDirectory(new_history_path); |
2883 base::FilePath new_history_file = | 2883 base::FilePath new_history_file = |
2884 new_history_path.Append(chrome::kHistoryFilename); | 2884 new_history_path.Append(chrome::kHistoryFilename); |
2885 base::FilePath new_archived_file = | 2885 base::FilePath new_archived_file = |
2886 new_history_path.Append(chrome::kArchivedHistoryFilename); | 2886 new_history_path.Append(chrome::kArchivedHistoryFilename); |
2887 ASSERT_TRUE(base::CopyFile(old_history, new_history_file)); | 2887 ASSERT_TRUE(base::CopyFile(old_history, new_history_file)); |
2888 ASSERT_TRUE(base::CopyFile(old_archived, new_archived_file)); | 2888 ASSERT_TRUE(base::CopyFile(old_archived, new_archived_file)); |
2889 | 2889 |
2890 backend_ = new HistoryBackend(new_history_path, | 2890 backend_ = new HistoryBackend(new_history_path, |
2891 new HistoryBackendTestDelegate(this), | 2891 new HistoryBackendTestDelegate(this), |
2892 &bookmark_model_); | 2892 bookmark_model_.get()); |
2893 backend_->Init(std::string(), false); | 2893 backend_->Init(std::string(), false); |
2894 backend_->Closing(); | 2894 backend_->Closing(); |
2895 backend_ = NULL; | 2895 backend_ = NULL; |
2896 | 2896 |
2897 // Now both history and archived_history databases should already be migrated. | 2897 // Now both history and archived_history databases should already be migrated. |
2898 | 2898 |
2899 // Check version in history database first. | 2899 // Check version in history database first. |
2900 int cur_version = HistoryDatabase::GetCurrentVersion(); | 2900 int cur_version = HistoryDatabase::GetCurrentVersion(); |
2901 sql::Connection db; | 2901 sql::Connection db; |
2902 ASSERT_TRUE(db.Open(new_history_file)); | 2902 ASSERT_TRUE(db.Open(new_history_file)); |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3384 // Verify that the second term is no longer returned as result, and also check | 3384 // Verify that the second term is no longer returned as result, and also check |
3385 // at the low level that it is gone for good. The term corresponding to the | 3385 // at the low level that it is gone for good. The term corresponding to the |
3386 // first URLRow should not be affected. | 3386 // first URLRow should not be affected. |
3387 EXPECT_EQ(1u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term1)); | 3387 EXPECT_EQ(1u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term1)); |
3388 EXPECT_EQ(0u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term2)); | 3388 EXPECT_EQ(0u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term2)); |
3389 EXPECT_TRUE(mem_backend_->db()->GetKeywordSearchTermRow(row1.id(), NULL)); | 3389 EXPECT_TRUE(mem_backend_->db()->GetKeywordSearchTermRow(row1.id(), NULL)); |
3390 EXPECT_FALSE(mem_backend_->db()->GetKeywordSearchTermRow(row2.id(), NULL)); | 3390 EXPECT_FALSE(mem_backend_->db()->GetKeywordSearchTermRow(row2.id(), NULL)); |
3391 } | 3391 } |
3392 | 3392 |
3393 } // namespace history | 3393 } // namespace history |
OLD | NEW |