| 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 // Wait for the backend class to terminate before deleting the files and | 181 // Wait for the backend class to terminate before deleting the files and |
| 182 // moving to the next test. Note: if this never terminates, somebody is | 182 // moving to the next test. Note: if this never terminates, somebody is |
| 183 // probably leaking a reference to the history backend, so it never calls | 183 // probably leaking a reference to the history backend, so it never calls |
| 184 // our destroy task. | 184 // our destroy task. |
| 185 MessageLoop::current()->Run(); | 185 MessageLoop::current()->Run(); |
| 186 } | 186 } |
| 187 | 187 |
| 188 int64 AddDownload(int32 state, const Time& time) { | 188 int64 AddDownload(int32 state, const Time& time) { |
| 189 DownloadPersistentStoreInfo download( | 189 DownloadPersistentStoreInfo download( |
| 190 FilePath(FILE_PATH_LITERAL("foo-path")), | 190 FilePath(FILE_PATH_LITERAL("foo-path")), |
| 191 GURL("foo-url"), | 191 GURL("http://foo-url"), |
| 192 GURL(""), | 192 GURL(""), |
| 193 time, | 193 time, |
| 194 time, | 194 time, |
| 195 0, | 195 0, |
| 196 512, | 196 512, |
| 197 state, | 197 state, |
| 198 0, | 198 0, |
| 199 0); | 199 0); |
| 200 return db_->CreateDownload(download); | 200 return db_->CreateDownload(download); |
| 201 } | 201 } |
| (...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 history_service_ = history; | 956 history_service_ = history; |
| 957 history->ScheduleDBTask(task.get(), &request_consumer); | 957 history->ScheduleDBTask(task.get(), &request_consumer); |
| 958 request_consumer.CancelAllRequests(); | 958 request_consumer.CancelAllRequests(); |
| 959 CleanupHistoryService(); | 959 CleanupHistoryService(); |
| 960 // WARNING: history has now been deleted. | 960 // WARNING: history has now been deleted. |
| 961 history = NULL; | 961 history = NULL; |
| 962 ASSERT_FALSE(task->done_invoked); | 962 ASSERT_FALSE(task->done_invoked); |
| 963 } | 963 } |
| 964 | 964 |
| 965 } // namespace history | 965 } // namespace history |
| OLD | NEW |