| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 history_service_ = NULL; | 186 history_service_ = NULL; |
| 187 | 187 |
| 188 // Wait for the backend class to terminate before deleting the files and | 188 // Wait for the backend class to terminate before deleting the files and |
| 189 // moving to the next test. Note: if this never terminates, somebody is | 189 // moving to the next test. Note: if this never terminates, somebody is |
| 190 // probably leaking a reference to the history backend, so it never calls | 190 // probably leaking a reference to the history backend, so it never calls |
| 191 // our destroy task. | 191 // our destroy task. |
| 192 MessageLoop::current()->Run(); | 192 MessageLoop::current()->Run(); |
| 193 } | 193 } |
| 194 | 194 |
| 195 int64 AddDownload(int32 state, const Time& time) { | 195 int64 AddDownload(int32 state, const Time& time) { |
| 196 DownloadCreateInfo download(FilePath(FILE_PATH_LITERAL("foo-path")), | 196 DownloadCreateInfo download(L"foo-path", L"foo-url", time, |
| 197 L"foo-url", time, 0, 512, state, 0); | 197 0, 512, state, 0); |
| 198 return db_->CreateDownload(download); | 198 return db_->CreateDownload(download); |
| 199 } | 199 } |
| 200 | 200 |
| 201 // Fills the query_url_row_ and query_url_visits_ structures with the | 201 // Fills the query_url_row_ and query_url_visits_ structures with the |
| 202 // information about the given URL and returns true. If the URL was not | 202 // information about the given URL and returns true. If the URL was not |
| 203 // found, this will return false and those structures will not be changed. | 203 // found, this will return false and those structures will not be changed. |
| 204 bool QueryURL(HistoryService* history, const GURL& url) { | 204 bool QueryURL(HistoryService* history, const GURL& url) { |
| 205 history->QueryURL(url, true, &consumer_, | 205 history->QueryURL(url, true, &consumer_, |
| 206 NewCallback(this, &HistoryTest::SaveURLAndQuit)); | 206 NewCallback(this, &HistoryTest::SaveURLAndQuit)); |
| 207 MessageLoop::current()->Run(); // Will be exited in SaveURLAndQuit. | 207 MessageLoop::current()->Run(); // Will be exited in SaveURLAndQuit. |
| (...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 history->ScheduleDBTask(task.get(), &request_consumer); | 827 history->ScheduleDBTask(task.get(), &request_consumer); |
| 828 request_consumer.CancelAllRequests(); | 828 request_consumer.CancelAllRequests(); |
| 829 CleanupHistoryService(); | 829 CleanupHistoryService(); |
| 830 // WARNING: history has now been deleted. | 830 // WARNING: history has now been deleted. |
| 831 history = NULL; | 831 history = NULL; |
| 832 ASSERT_FALSE(task->done_invoked); | 832 ASSERT_FALSE(task->done_invoked); |
| 833 } | 833 } |
| 834 | 834 |
| 835 } // namespace history | 835 } // namespace history |
| 836 | 836 |
| OLD | NEW |