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 // 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 191 |
192 // Wait for the backend class to terminate before deleting the files and | 192 // Wait for the backend class to terminate before deleting the files and |
193 // moving to the next test. Note: if this never terminates, somebody is | 193 // moving to the next test. Note: if this never terminates, somebody is |
194 // probably leaking a reference to the history backend, so it never calls | 194 // probably leaking a reference to the history backend, so it never calls |
195 // our destroy task. | 195 // our destroy task. |
196 MessageLoop::current()->Run(); | 196 MessageLoop::current()->Run(); |
197 } | 197 } |
198 | 198 |
199 int64 AddDownload(int32 state, const Time& time) { | 199 int64 AddDownload(int32 state, const Time& time) { |
200 DownloadCreateInfo download(FilePath(FILE_PATH_LITERAL("foo-path")), | 200 DownloadCreateInfo download(FilePath(FILE_PATH_LITERAL("foo-path")), |
201 GURL("foo-url"), time, 0, 512, state, 0); | 201 GURL("foo-url"), time, 0, 512, state, 0, false); |
202 return db_->CreateDownload(download); | 202 return db_->CreateDownload(download); |
203 } | 203 } |
204 | 204 |
205 // Fills the query_url_row_ and query_url_visits_ structures with the | 205 // Fills the query_url_row_ and query_url_visits_ structures with the |
206 // information about the given URL and returns true. If the URL was not | 206 // information about the given URL and returns true. If the URL was not |
207 // found, this will return false and those structures will not be changed. | 207 // found, this will return false and those structures will not be changed. |
208 bool QueryURL(HistoryService* history, const GURL& url) { | 208 bool QueryURL(HistoryService* history, const GURL& url) { |
209 history->QueryURL(url, true, &consumer_, | 209 history->QueryURL(url, true, &consumer_, |
210 NewCallback(this, &HistoryTest::SaveURLAndQuit)); | 210 NewCallback(this, &HistoryTest::SaveURLAndQuit)); |
211 MessageLoop::current()->Run(); // Will be exited in SaveURLAndQuit. | 211 MessageLoop::current()->Run(); // Will be exited in SaveURLAndQuit. |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 history_service_ = history; | 931 history_service_ = history; |
932 history->ScheduleDBTask(task.get(), &request_consumer); | 932 history->ScheduleDBTask(task.get(), &request_consumer); |
933 request_consumer.CancelAllRequests(); | 933 request_consumer.CancelAllRequests(); |
934 CleanupHistoryService(); | 934 CleanupHistoryService(); |
935 // WARNING: history has now been deleted. | 935 // WARNING: history has now been deleted. |
936 history = NULL; | 936 history = NULL; |
937 ASSERT_FALSE(task->done_invoked); | 937 ASSERT_FALSE(task->done_invoked); |
938 } | 938 } |
939 | 939 |
940 } // namespace history | 940 } // namespace history |
OLD | NEW |