OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "base/scoped_temp_dir.h" | 14 #include "base/scoped_temp_dir.h" |
15 #include "base/string16.h" | 15 #include "base/string16.h" |
16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
17 #include "chrome/browser/bookmarks/bookmark_model.h" | 17 #include "chrome/browser/bookmarks/bookmark_model.h" |
18 #include "chrome/browser/history/archived_database.h" | 18 #include "chrome/browser/history/archived_database.h" |
19 #include "chrome/browser/history/expire_history_backend.h" | 19 #include "chrome/browser/history/expire_history_backend.h" |
20 #include "chrome/browser/history/history_database.h" | 20 #include "chrome/browser/history/history_database.h" |
21 #include "chrome/browser/history/history_notifications.h" | 21 #include "chrome/browser/history/history_notifications.h" |
22 #include "chrome/browser/history/text_database_manager.h" | 22 #include "chrome/browser/history/text_database_manager.h" |
23 #include "chrome/browser/history/thumbnail_database.h" | 23 #include "chrome/browser/history/thumbnail_database.h" |
24 #include "chrome/browser/history/top_sites.h" | 24 #include "chrome/browser/history/top_sites.h" |
25 #include "chrome/common/chrome_notification_types.h" | 25 #include "chrome/common/chrome_notification_types.h" |
26 #include "chrome/common/thumbnail_score.h" | 26 #include "chrome/common/thumbnail_score.h" |
27 #include "chrome/test/base/testing_profile.h" | 27 #include "chrome/test/base/testing_profile.h" |
| 28 #include "chrome/test/testing_browser_process_test.h" |
28 #include "chrome/tools/profiles/thumbnail-inl.h" | 29 #include "chrome/tools/profiles/thumbnail-inl.h" |
29 #include "content/browser/browser_thread.h" | 30 #include "content/browser/browser_thread.h" |
30 #include "testing/gtest/include/gtest/gtest.h" | 31 #include "testing/gtest/include/gtest/gtest.h" |
31 #include "third_party/skia/include/core/SkBitmap.h" | 32 #include "third_party/skia/include/core/SkBitmap.h" |
32 #include "ui/gfx/codec/jpeg_codec.h" | 33 #include "ui/gfx/codec/jpeg_codec.h" |
33 | 34 |
34 using base::Time; | 35 using base::Time; |
35 using base::TimeDelta; | 36 using base::TimeDelta; |
36 using base::TimeTicks; | 37 using base::TimeTicks; |
37 | 38 |
38 // Filename constants. | 39 // Filename constants. |
39 static const FilePath::CharType kHistoryFile[] = FILE_PATH_LITERAL("History"); | 40 static const FilePath::CharType kHistoryFile[] = FILE_PATH_LITERAL("History"); |
40 static const FilePath::CharType kArchivedHistoryFile[] = | 41 static const FilePath::CharType kArchivedHistoryFile[] = |
41 FILE_PATH_LITERAL("Archived History"); | 42 FILE_PATH_LITERAL("Archived History"); |
42 static const FilePath::CharType kThumbnailFile[] = | 43 static const FilePath::CharType kThumbnailFile[] = |
43 FILE_PATH_LITERAL("Thumbnails"); | 44 FILE_PATH_LITERAL("Thumbnails"); |
44 | 45 |
45 // The test must be in the history namespace for the gtest forward declarations | 46 // The test must be in the history namespace for the gtest forward declarations |
46 // to work. It also eliminates a bunch of ugly "history::". | 47 // to work. It also eliminates a bunch of ugly "history::". |
47 namespace history { | 48 namespace history { |
48 | 49 |
49 // ExpireHistoryTest ----------------------------------------------------------- | 50 // ExpireHistoryTest ----------------------------------------------------------- |
50 | 51 |
51 class ExpireHistoryTest : public testing::Test, | 52 class ExpireHistoryTest : public TestingBrowserProcessTest, |
52 public BroadcastNotificationDelegate { | 53 public BroadcastNotificationDelegate { |
53 public: | 54 public: |
54 ExpireHistoryTest() | 55 ExpireHistoryTest() |
55 : bookmark_model_(NULL), | 56 : bookmark_model_(NULL), |
56 ui_thread_(BrowserThread::UI, &message_loop_), | 57 ui_thread_(BrowserThread::UI, &message_loop_), |
57 db_thread_(BrowserThread::DB, &message_loop_), | 58 db_thread_(BrowserThread::DB, &message_loop_), |
58 ALLOW_THIS_IN_INITIALIZER_LIST(expirer_(this, &bookmark_model_)), | 59 ALLOW_THIS_IN_INITIALIZER_LIST(expirer_(this, &bookmark_model_)), |
59 now_(Time::Now()) { | 60 now_(Time::Now()) { |
60 } | 61 } |
61 | 62 |
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 main_db_->GetVisitsForURL(url_id, &archived_visits); | 913 main_db_->GetVisitsForURL(url_id, &archived_visits); |
913 EXPECT_EQ(0U, archived_visits.size()); | 914 EXPECT_EQ(0U, archived_visits.size()); |
914 } | 915 } |
915 | 916 |
916 // TODO(brettw) add some visits with no URL to make sure everything is updated | 917 // TODO(brettw) add some visits with no URL to make sure everything is updated |
917 // properly. Have the visits also refer to nonexistent FTS rows. | 918 // properly. Have the visits also refer to nonexistent FTS rows. |
918 // | 919 // |
919 // Maybe also refer to invalid favicons. | 920 // Maybe also refer to invalid favicons. |
920 | 921 |
921 } // namespace history | 922 } // namespace history |
OLD | NEW |