| 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 14 matching lines...) Expand all Loading... |
| 25 #include "base/basictypes.h" | 25 #include "base/basictypes.h" |
| 26 #include "base/bind.h" | 26 #include "base/bind.h" |
| 27 #include "base/bind_helpers.h" | 27 #include "base/bind_helpers.h" |
| 28 #include "base/callback.h" | 28 #include "base/callback.h" |
| 29 #include "base/command_line.h" | 29 #include "base/command_line.h" |
| 30 #include "base/file_path.h" | 30 #include "base/file_path.h" |
| 31 #include "base/file_util.h" | 31 #include "base/file_util.h" |
| 32 #include "base/memory/scoped_vector.h" | 32 #include "base/memory/scoped_vector.h" |
| 33 #include "base/message_loop.h" | 33 #include "base/message_loop.h" |
| 34 #include "base/path_service.h" | 34 #include "base/path_service.h" |
| 35 #include "base/pickle.h" |
| 35 #include "base/scoped_temp_dir.h" | 36 #include "base/scoped_temp_dir.h" |
| 36 #include "base/string_util.h" | 37 #include "base/string_util.h" |
| 37 #include "base/task.h" | 38 #include "base/task.h" |
| 38 #include "base/utf_string_conversions.h" | 39 #include "base/utf_string_conversions.h" |
| 39 #include "chrome/browser/history/history.h" | 40 #include "chrome/browser/history/history.h" |
| 40 #include "chrome/browser/history/history_backend.h" | 41 #include "chrome/browser/history/history_backend.h" |
| 41 #include "chrome/browser/history/history_database.h" | 42 #include "chrome/browser/history/history_database.h" |
| 42 #include "chrome/browser/history/history_notifications.h" | 43 #include "chrome/browser/history/history_notifications.h" |
| 43 #include "chrome/browser/history/in_memory_database.h" | 44 #include "chrome/browser/history/in_memory_database.h" |
| 44 #include "chrome/browser/history/in_memory_history_backend.h" | 45 #include "chrome/browser/history/in_memory_history_backend.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 DownloadPersistentStoreInfo download( | 192 DownloadPersistentStoreInfo download( |
| 192 FilePath(FILE_PATH_LITERAL("foo-path")), | 193 FilePath(FILE_PATH_LITERAL("foo-path")), |
| 193 GURL("foo-url"), | 194 GURL("foo-url"), |
| 194 GURL(""), | 195 GURL(""), |
| 195 time, | 196 time, |
| 196 time, | 197 time, |
| 197 0, | 198 0, |
| 198 512, | 199 512, |
| 199 state, | 200 state, |
| 200 0, | 201 0, |
| 201 0); | 202 false, |
| 203 Pickle(), |
| 204 "", |
| 205 "", |
| 206 DOWNLOAD_INTERRUPT_REASON_NONE); |
| 202 return db_->CreateDownload(download); | 207 return db_->CreateDownload(download); |
| 203 } | 208 } |
| 204 | 209 |
| 205 // Fills the query_url_row_ and query_url_visits_ structures with the | 210 // 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 | 211 // 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. | 212 // found, this will return false and those structures will not be changed. |
| 208 bool QueryURL(HistoryService* history, const GURL& url) { | 213 bool QueryURL(HistoryService* history, const GURL& url) { |
| 209 history->QueryURL(url, true, &consumer_, | 214 history->QueryURL(url, true, &consumer_, |
| 210 base::Bind(&HistoryTest::SaveURLAndQuit, | 215 base::Bind(&HistoryTest::SaveURLAndQuit, |
| 211 base::Unretained(this))); | 216 base::Unretained(this))); |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 958 history_service_ = history; | 963 history_service_ = history; |
| 959 history->ScheduleDBTask(task.get(), &request_consumer); | 964 history->ScheduleDBTask(task.get(), &request_consumer); |
| 960 request_consumer.CancelAllRequests(); | 965 request_consumer.CancelAllRequests(); |
| 961 CleanupHistoryService(); | 966 CleanupHistoryService(); |
| 962 // WARNING: history has now been deleted. | 967 // WARNING: history has now been deleted. |
| 963 history = NULL; | 968 history = NULL; |
| 964 ASSERT_FALSE(task->done_invoked); | 969 ASSERT_FALSE(task->done_invoked); |
| 965 } | 970 } |
| 966 | 971 |
| 967 } // namespace history | 972 } // namespace history |
| OLD | NEW |