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 // History unit tests come in two flavors: | 5 // History unit tests come in two flavors: |
6 // | 6 // |
7 // 1. The more complicated style is that the unit test creates a full history | 7 // 1. The more complicated style is that the unit test creates a full history |
8 // service. This spawns a background thread for the history backend, and | 8 // service. This spawns a background thread for the history backend, and |
9 // all communication is asynchronous. This is useful for testing more | 9 // all communication is asynchronous. This is useful for testing more |
10 // complicated things or end-to-end behavior. | 10 // complicated things or end-to-end behavior. |
(...skipping 28 matching lines...) Expand all Loading... |
39 #include "base/strings/string_util.h" | 39 #include "base/strings/string_util.h" |
40 #include "base/strings/stringprintf.h" | 40 #include "base/strings/stringprintf.h" |
41 #include "base/strings/utf_string_conversions.h" | 41 #include "base/strings/utf_string_conversions.h" |
42 #include "base/task/cancelable_task_tracker.h" | 42 #include "base/task/cancelable_task_tracker.h" |
43 #include "base/threading/platform_thread.h" | 43 #include "base/threading/platform_thread.h" |
44 #include "base/time/time.h" | 44 #include "base/time/time.h" |
45 #include "chrome/browser/history/download_row.h" | 45 #include "chrome/browser/history/download_row.h" |
46 #include "chrome/browser/history/history_backend.h" | 46 #include "chrome/browser/history/history_backend.h" |
47 #include "chrome/browser/history/history_database.h" | 47 #include "chrome/browser/history/history_database.h" |
48 #include "chrome/browser/history/history_db_task.h" | 48 #include "chrome/browser/history/history_db_task.h" |
49 #include "chrome/browser/history/history_notifications.h" | |
50 #include "chrome/browser/history/history_service.h" | 49 #include "chrome/browser/history/history_service.h" |
51 #include "chrome/browser/history/history_unittest_base.h" | 50 #include "chrome/browser/history/history_unittest_base.h" |
52 #include "chrome/browser/history/in_memory_history_backend.h" | 51 #include "chrome/browser/history/in_memory_history_backend.h" |
53 #include "chrome/common/chrome_constants.h" | 52 #include "chrome/common/chrome_constants.h" |
54 #include "chrome/common/chrome_paths.h" | 53 #include "chrome/common/chrome_paths.h" |
55 #include "chrome/tools/profiles/thumbnail-inl.h" | 54 #include "chrome/tools/profiles/thumbnail-inl.h" |
56 #include "components/history/core/browser/history_constants.h" | 55 #include "components/history/core/browser/history_constants.h" |
57 #include "components/history/core/browser/in_memory_database.h" | 56 #include "components/history/core/browser/in_memory_database.h" |
58 #include "components/history/core/browser/page_usage_data.h" | 57 #include "components/history/core/browser/page_usage_data.h" |
59 #include "components/history/core/common/thumbnail_score.h" | 58 #include "components/history/core/common/thumbnail_score.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 95 |
97 void NotifyProfileError(sql::InitStatus init_status) override {} | 96 void NotifyProfileError(sql::InitStatus init_status) override {} |
98 void SetInMemoryBackend(scoped_ptr<InMemoryHistoryBackend> backend) override; | 97 void SetInMemoryBackend(scoped_ptr<InMemoryHistoryBackend> backend) override; |
99 void NotifyAddVisit(const BriefVisitInfo& info) override {} | 98 void NotifyAddVisit(const BriefVisitInfo& info) override {} |
100 void NotifyFaviconChanged(const std::set<GURL>& url) override {} | 99 void NotifyFaviconChanged(const std::set<GURL>& url) override {} |
101 void NotifyURLVisited(ui::PageTransition transition, | 100 void NotifyURLVisited(ui::PageTransition transition, |
102 const URLRow& row, | 101 const URLRow& row, |
103 const RedirectList& redirects, | 102 const RedirectList& redirects, |
104 base::Time visit_time) override {} | 103 base::Time visit_time) override {} |
105 void NotifyURLsModified(const URLRows& changed_urls) override {} | 104 void NotifyURLsModified(const URLRows& changed_urls) override {} |
| 105 void NotifyURLsDeleted(bool all_history, |
| 106 bool expired, |
| 107 const URLRows& deleted_rows, |
| 108 const std::set<GURL>& favicon_urls) override {} |
106 void BroadcastNotifications(int type, | 109 void BroadcastNotifications(int type, |
107 scoped_ptr<HistoryDetails> details) override; | 110 scoped_ptr<HistoryDetails> details) override; |
108 void DBLoaded() override {} | 111 void DBLoaded() override {} |
109 | 112 |
110 private: | 113 private: |
111 HistoryBackendDBTest* history_test_; | 114 HistoryBackendDBTest* history_test_; |
112 }; | 115 }; |
113 | 116 |
114 // This must be outside the anonymous namespace for the friend statement in | 117 // This must be outside the anonymous namespace for the friend statement in |
115 // HistoryBackend to work. | 118 // HistoryBackend to work. |
(...skipping 1747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1863 std::vector<PageUsageData*> results; | 1866 std::vector<PageUsageData*> results; |
1864 db_->QuerySegmentUsage(segment_time, 10, &results); | 1867 db_->QuerySegmentUsage(segment_time, 10, &results); |
1865 ASSERT_EQ(1u, results.size()); | 1868 ASSERT_EQ(1u, results.size()); |
1866 EXPECT_EQ(url, results[0]->GetURL()); | 1869 EXPECT_EQ(url, results[0]->GetURL()); |
1867 EXPECT_EQ(segment_id, results[0]->GetID()); | 1870 EXPECT_EQ(segment_id, results[0]->GetID()); |
1868 EXPECT_EQ(title, results[0]->GetTitle()); | 1871 EXPECT_EQ(title, results[0]->GetTitle()); |
1869 STLDeleteElements(&results); | 1872 STLDeleteElements(&results); |
1870 } | 1873 } |
1871 | 1874 |
1872 } // namespace history | 1875 } // namespace history |
OLD | NEW |