| 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 // 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 DownloadPersistentStoreInfo download( | 191 DownloadPersistentStoreInfo download( |
| 192 FilePath(FILE_PATH_LITERAL("foo-path")), | 192 FilePath(FILE_PATH_LITERAL("foo-path")), |
| 193 GURL("foo-url"), | 193 GURL("foo-url"), |
| 194 GURL(""), | 194 GURL(""), |
| 195 time, | 195 time, |
| 196 time, | 196 time, |
| 197 0, | 197 0, |
| 198 512, | 198 512, |
| 199 state, | 199 state, |
| 200 0, | 200 0, |
| 201 0); | 201 false, |
| 202 "", |
| 203 "", |
| 204 "", |
| 205 DOWNLOAD_INTERRUPT_REASON_NONE); |
| 202 return db_->CreateDownload(download); | 206 return db_->CreateDownload(download); |
| 203 } | 207 } |
| 204 | 208 |
| 205 // Fills the query_url_row_ and query_url_visits_ structures with the | 209 // 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 | 210 // 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. | 211 // found, this will return false and those structures will not be changed. |
| 208 bool QueryURL(HistoryService* history, const GURL& url) { | 212 bool QueryURL(HistoryService* history, const GURL& url) { |
| 209 history->QueryURL(url, true, &consumer_, | 213 history->QueryURL(url, true, &consumer_, |
| 210 base::Bind(&HistoryTest::SaveURLAndQuit, | 214 base::Bind(&HistoryTest::SaveURLAndQuit, |
| 211 base::Unretained(this))); | 215 base::Unretained(this))); |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 958 history_service_ = history; | 962 history_service_ = history; |
| 959 history->ScheduleDBTask(task.get(), &request_consumer); | 963 history->ScheduleDBTask(task.get(), &request_consumer); |
| 960 request_consumer.CancelAllRequests(); | 964 request_consumer.CancelAllRequests(); |
| 961 CleanupHistoryService(); | 965 CleanupHistoryService(); |
| 962 // WARNING: history has now been deleted. | 966 // WARNING: history has now been deleted. |
| 963 history = NULL; | 967 history = NULL; |
| 964 ASSERT_FALSE(task->done_invoked); | 968 ASSERT_FALSE(task->done_invoked); |
| 965 } | 969 } |
| 966 | 970 |
| 967 } // namespace history | 971 } // namespace history |
| OLD | NEW |