| 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. |
| 11 // | 11 // |
| 12 // 2. The simpler style is to create a history backend on this thread and | 12 // 2. The simpler style is to create a history backend on this thread and |
| 13 // access it directly without a HistoryService object. This is much simpler | 13 // access it directly without a HistoryService object. This is much simpler |
| 14 // because communication is synchronous. Generally, sets should go through | 14 // because communication is synchronous. Generally, sets should go through |
| 15 // the history backend (since there is a lot of logic) but gets can come | 15 // the history backend (since there is a lot of logic) but gets can come |
| 16 // directly from the HistoryDatabase. This is because the backend generally | 16 // directly from the HistoryDatabase. This is because the backend generally |
| 17 // has no logic in the getter except threading stuff, which we don't want | 17 // has no logic in the getter except threading stuff, which we don't want |
| 18 // to run. | 18 // to run. |
| 19 | 19 |
| 20 #include <time.h> | 20 #include <time.h> |
| 21 |
| 21 #include <algorithm> | 22 #include <algorithm> |
| 23 #include <string> |
| 22 | 24 |
| 23 #include "app/sql/connection.h" | 25 #include "app/sql/connection.h" |
| 24 #include "app/sql/statement.h" | 26 #include "app/sql/statement.h" |
| 25 #include "base/basictypes.h" | 27 #include "base/basictypes.h" |
| 26 #include "base/callback.h" | 28 #include "base/callback.h" |
| 27 #include "base/command_line.h" | 29 #include "base/command_line.h" |
| 28 #include "base/file_path.h" | 30 #include "base/file_path.h" |
| 29 #include "base/file_util.h" | 31 #include "base/file_util.h" |
| 30 #include "base/message_loop.h" | 32 #include "base/message_loop.h" |
| 31 #include "base/path_service.h" | 33 #include "base/path_service.h" |
| 32 #include "base/scoped_temp_dir.h" | 34 #include "base/scoped_temp_dir.h" |
| 33 #include "base/scoped_vector.h" | 35 #include "base/scoped_vector.h" |
| 34 #include "base/string_util.h" | 36 #include "base/string_util.h" |
| 35 #include "base/task.h" | 37 #include "base/task.h" |
| 36 #include "base/utf_string_conversions.h" | 38 #include "base/utf_string_conversions.h" |
| 37 #include "chrome/browser/browser_process.h" | |
| 38 #include "chrome/browser/download/download_item.h" | 39 #include "chrome/browser/download/download_item.h" |
| 39 #include "chrome/browser/history/download_create_info.h" | 40 #include "chrome/browser/history/download_create_info.h" |
| 40 #include "chrome/browser/history/history.h" | 41 #include "chrome/browser/history/history.h" |
| 41 #include "chrome/browser/history/history_backend.h" | 42 #include "chrome/browser/history/history_backend.h" |
| 42 #include "chrome/browser/history/history_database.h" | 43 #include "chrome/browser/history/history_database.h" |
| 43 #include "chrome/browser/history/history_notifications.h" | 44 #include "chrome/browser/history/history_notifications.h" |
| 44 #include "chrome/browser/history/in_memory_database.h" | 45 #include "chrome/browser/history/in_memory_database.h" |
| 45 #include "chrome/browser/history/in_memory_history_backend.h" | 46 #include "chrome/browser/history/in_memory_history_backend.h" |
| 46 #include "chrome/browser/history/page_usage_data.h" | 47 #include "chrome/browser/history/page_usage_data.h" |
| 47 #include "chrome/browser/history/top_sites.h" | 48 #include "chrome/browser/history/top_sites.h" |
| (...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 history_service_ = history; | 932 history_service_ = history; |
| 932 history->ScheduleDBTask(task.get(), &request_consumer); | 933 history->ScheduleDBTask(task.get(), &request_consumer); |
| 933 request_consumer.CancelAllRequests(); | 934 request_consumer.CancelAllRequests(); |
| 934 CleanupHistoryService(); | 935 CleanupHistoryService(); |
| 935 // WARNING: history has now been deleted. | 936 // WARNING: history has now been deleted. |
| 936 history = NULL; | 937 history = NULL; |
| 937 ASSERT_FALSE(task->done_invoked); | 938 ASSERT_FALSE(task->done_invoked); |
| 938 } | 939 } |
| 939 | 940 |
| 940 } // namespace history | 941 } // namespace history |
| OLD | NEW |