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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
11 #include "base/utf_string_conversions.h" | |
12 #include "chrome/browser/bookmarks/bookmark_model.h" | 11 #include "chrome/browser/bookmarks/bookmark_model.h" |
13 #include "chrome/browser/history/archived_database.h" | 12 #include "chrome/browser/history/archived_database.h" |
14 #include "chrome/browser/history/expire_history_backend.h" | 13 #include "chrome/browser/history/expire_history_backend.h" |
15 #include "chrome/browser/history/history_database.h" | 14 #include "chrome/browser/history/history_database.h" |
16 #include "chrome/browser/history/history_notifications.h" | 15 #include "chrome/browser/history/history_notifications.h" |
17 #include "chrome/browser/history/text_database_manager.h" | 16 #include "chrome/browser/history/text_database_manager.h" |
18 #include "chrome/browser/history/thumbnail_database.h" | 17 #include "chrome/browser/history/thumbnail_database.h" |
19 #include "chrome/common/notification_service.h" | 18 #include "chrome/common/notification_service.h" |
20 #include "chrome/common/thumbnail_score.h" | 19 #include "chrome/common/thumbnail_score.h" |
21 #include "chrome/tools/profiles/thumbnail-inl.h" | 20 #include "chrome/tools/profiles/thumbnail-inl.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 main_db_->AddVisit(&visit_row3); | 235 main_db_->AddVisit(&visit_row3); |
237 | 236 |
238 VisitRow visit_row4; | 237 VisitRow visit_row4; |
239 visit_row4.url_id = url_ids[2]; | 238 visit_row4.url_id = url_ids[2]; |
240 visit_row4.visit_time = visit_times[3]; | 239 visit_row4.visit_time = visit_times[3]; |
241 visit_row4.is_indexed = true; | 240 visit_row4.is_indexed = true; |
242 main_db_->AddVisit(&visit_row4); | 241 main_db_->AddVisit(&visit_row4); |
243 | 242 |
244 // Full text index for each visit. | 243 // Full text index for each visit. |
245 text_db_->AddPageData(url_row1.url(), visit_row1.url_id, visit_row1.visit_id, | 244 text_db_->AddPageData(url_row1.url(), visit_row1.url_id, visit_row1.visit_id, |
246 visit_row1.visit_time, L"title", UTF8ToUTF16("body")); | 245 visit_row1.visit_time, L"title", L"body"); |
247 | 246 |
248 text_db_->AddPageData(url_row2.url(), visit_row2.url_id, visit_row2.visit_id, | 247 text_db_->AddPageData(url_row2.url(), visit_row2.url_id, visit_row2.visit_id, |
249 visit_row2.visit_time, L"title", UTF8ToUTF16("body")); | 248 visit_row2.visit_time, L"title", L"body"); |
250 text_db_->AddPageData(url_row2.url(), visit_row3.url_id, visit_row3.visit_id, | 249 text_db_->AddPageData(url_row2.url(), visit_row3.url_id, visit_row3.visit_id, |
251 visit_row3.visit_time, L"title", UTF8ToUTF16("body")); | 250 visit_row3.visit_time, L"title", L"body"); |
252 | 251 |
253 // Note the special text in this URL. We'll search the file for this string | 252 // Note the special text in this URL. We'll search the file for this string |
254 // to make sure it doesn't hang around after the delete. | 253 // to make sure it doesn't hang around after the delete. |
255 text_db_->AddPageData(url_row3.url(), visit_row4.url_id, visit_row4.visit_id, | 254 text_db_->AddPageData(url_row3.url(), visit_row4.url_id, visit_row4.visit_id, |
256 visit_row4.visit_time, L"title", | 255 visit_row4.visit_time, L"title", L"goats body"); |
257 UTF8ToUTF16("goats body")); | |
258 } | 256 } |
259 | 257 |
260 bool ExpireHistoryTest::HasFavIcon(FavIconID favicon_id) { | 258 bool ExpireHistoryTest::HasFavIcon(FavIconID favicon_id) { |
261 if (!thumb_db_.get()) | 259 if (!thumb_db_.get()) |
262 return false; | 260 return false; |
263 Time last_updated; | 261 Time last_updated; |
264 std::vector<unsigned char> icon_data_unused; | 262 std::vector<unsigned char> icon_data_unused; |
265 GURL icon_url; | 263 GURL icon_url; |
266 return thumb_db_->GetFavIcon(favicon_id, &last_updated, &icon_data_unused, | 264 return thumb_db_->GetFavIcon(favicon_id, &last_updated, &icon_data_unused, |
267 &icon_url); | 265 &icon_url); |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 EXPECT_TRUE(all->Read(now, main_db_.get(), &visits, 1)); | 797 EXPECT_TRUE(all->Read(now, main_db_.get(), &visits, 1)); |
800 EXPECT_EQ(1U, visits.size()); | 798 EXPECT_EQ(1U, visits.size()); |
801 } | 799 } |
802 | 800 |
803 // TODO(brettw) add some visits with no URL to make sure everything is updated | 801 // TODO(brettw) add some visits with no URL to make sure everything is updated |
804 // properly. Have the visits also refer to nonexistant FTS rows. | 802 // properly. Have the visits also refer to nonexistant FTS rows. |
805 // | 803 // |
806 // Maybe also refer to invalid favicons. | 804 // Maybe also refer to invalid favicons. |
807 | 805 |
808 } // namespace history | 806 } // namespace history |
OLD | NEW |