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/file_path.h" | 5 #include "base/file_path.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/ref_counted.h" | 8 #include "base/ref_counted.h" |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "base/utf_string_conversions.h" | |
11 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
12 #include "chrome/browser/history/history_backend.h" | 11 #include "chrome/browser/history/history_backend.h" |
13 #include "chrome/browser/history/history_notifications.h" | 12 #include "chrome/browser/history/history_notifications.h" |
14 #include "chrome/browser/history/in_memory_history_backend.h" | 13 #include "chrome/browser/history/in_memory_history_backend.h" |
15 #include "chrome/browser/history/in_memory_database.h" | 14 #include "chrome/browser/history/in_memory_database.h" |
16 #include "chrome/common/notification_service.h" | 15 #include "chrome/common/notification_service.h" |
17 #include "chrome/common/thumbnail_score.h" | 16 #include "chrome/common/thumbnail_score.h" |
18 #include "chrome/tools/profiles/thumbnail-inl.h" | 17 #include "chrome/tools/profiles/thumbnail-inl.h" |
19 #include "gfx/codec/jpeg_codec.h" | 18 #include "gfx/codec/jpeg_codec.h" |
20 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 backend_->thumbnail_db_->SetPageThumbnail(gurl, row2_id, *weewar_bitmap, | 242 backend_->thumbnail_db_->SetPageThumbnail(gurl, row2_id, *weewar_bitmap, |
244 score, time); | 243 score, time); |
245 | 244 |
246 // Star row1. | 245 // Star row1. |
247 bookmark_model_.AddURL( | 246 bookmark_model_.AddURL( |
248 bookmark_model_.GetBookmarkBarNode(), 0, std::wstring(), row1.url()); | 247 bookmark_model_.GetBookmarkBarNode(), 0, std::wstring(), row1.url()); |
249 | 248 |
250 // Set full text index for each one. | 249 // Set full text index for each one. |
251 backend_->text_database_->AddPageData(row1.url(), row1_id, visit1_id, | 250 backend_->text_database_->AddPageData(row1.url(), row1_id, visit1_id, |
252 row1.last_visit(), | 251 row1.last_visit(), |
253 L"Title 1", UTF8ToUTF16("Body 1")); | 252 L"Title 1", L"Body 1"); |
254 backend_->text_database_->AddPageData(row2.url(), row2_id, visit2_id, | 253 backend_->text_database_->AddPageData(row2.url(), row2_id, visit2_id, |
255 row2.last_visit(), | 254 row2.last_visit(), |
256 L"Title 2", UTF8ToUTF16("Body 2")); | 255 L"Title 2", L"Body 2"); |
257 | 256 |
258 // Now finally clear all history. | 257 // Now finally clear all history. |
259 backend_->DeleteAllHistory(); | 258 backend_->DeleteAllHistory(); |
260 | 259 |
261 // The first URL should be preserved but the time should be cleared. | 260 // The first URL should be preserved but the time should be cleared. |
262 EXPECT_TRUE(backend_->db_->GetRowForURL(row1.url(), &outrow1)); | 261 EXPECT_TRUE(backend_->db_->GetRowForURL(row1.url(), &outrow1)); |
263 EXPECT_EQ(0, outrow1.visit_count()); | 262 EXPECT_EQ(0, outrow1.visit_count()); |
264 EXPECT_EQ(0, outrow1.typed_count()); | 263 EXPECT_EQ(0, outrow1.typed_count()); |
265 EXPECT_TRUE(Time() == outrow1.last_visit()); | 264 EXPECT_TRUE(Time() == outrow1.last_visit()); |
266 | 265 |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 // Fetch the row information about stripped url from history db. | 582 // Fetch the row information about stripped url from history db. |
584 VisitVector visits; | 583 VisitVector visits; |
585 URLID row_id = backend_->db_->GetRowForURL(stripped_url, NULL); | 584 URLID row_id = backend_->db_->GetRowForURL(stripped_url, NULL); |
586 backend_->db_->GetVisitsForURL(row_id, &visits); | 585 backend_->db_->GetVisitsForURL(row_id, &visits); |
587 | 586 |
588 // Check if stripped url is stored in database. | 587 // Check if stripped url is stored in database. |
589 ASSERT_EQ(1U, visits.size()); | 588 ASSERT_EQ(1U, visits.size()); |
590 } | 589 } |
591 | 590 |
592 } // namespace history | 591 } // namespace history |
OLD | NEW |