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