OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 std::back_inserter(thumbnail_data_)); | 131 std::back_inserter(thumbnail_data_)); |
132 } | 132 } |
133 MessageLoop::current()->Quit(); | 133 MessageLoop::current()->Quit(); |
134 } | 134 } |
135 | 135 |
136 // Creates the HistoryBackend and HistoryDatabase on the current thread, | 136 // Creates the HistoryBackend and HistoryDatabase on the current thread, |
137 // assigning the values to backend_ and db_. | 137 // assigning the values to backend_ and db_. |
138 void CreateBackendAndDatabase() { | 138 void CreateBackendAndDatabase() { |
139 backend_ = | 139 backend_ = |
140 new HistoryBackend(history_dir_, new BackendDelegate(this), NULL); | 140 new HistoryBackend(history_dir_, new BackendDelegate(this), NULL); |
141 backend_->Init(); | 141 backend_->Init(false); |
142 db_ = backend_->db_.get(); | 142 db_ = backend_->db_.get(); |
143 DCHECK(in_mem_backend_.get()) << "Mem backend should have been set by " | 143 DCHECK(in_mem_backend_.get()) << "Mem backend should have been set by " |
144 "HistoryBackend::Init"; | 144 "HistoryBackend::Init"; |
145 } | 145 } |
146 | 146 |
147 void OnSegmentUsageAvailable(CancelableRequestProvider::Handle handle, | 147 void OnSegmentUsageAvailable(CancelableRequestProvider::Handle handle, |
148 std::vector<PageUsageData*>* data) { | 148 std::vector<PageUsageData*>* data) { |
149 page_usage_data_->swap(*data); | 149 page_usage_data_->swap(*data); |
150 MessageLoop::current()->Quit(); | 150 MessageLoop::current()->Quit(); |
151 } | 151 } |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 history_service_ = history; | 834 history_service_ = history; |
835 history->ScheduleDBTask(task.get(), &request_consumer); | 835 history->ScheduleDBTask(task.get(), &request_consumer); |
836 request_consumer.CancelAllRequests(); | 836 request_consumer.CancelAllRequests(); |
837 CleanupHistoryService(); | 837 CleanupHistoryService(); |
838 // WARNING: history has now been deleted. | 838 // WARNING: history has now been deleted. |
839 history = NULL; | 839 history = NULL; |
840 ASSERT_FALSE(task->done_invoked); | 840 ASSERT_FALSE(task->done_invoked); |
841 } | 841 } |
842 | 842 |
843 } // namespace history | 843 } // namespace history |
OLD | NEW |