| 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. |
| 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 #include <algorithm> | 21 #include <algorithm> |
| 22 | 22 |
| 23 #include "base/basictypes.h" | 23 #include "base/basictypes.h" |
| 24 #include "base/file_util.h" | 24 #include "base/file_util.h" |
| 25 #include "base/message_loop.h" | 25 #include "base/message_loop.h" |
| 26 #include "base/path_service.h" | 26 #include "base/path_service.h" |
| 27 #include "base/string_util.h" | 27 #include "base/string_util.h" |
| 28 #include "base/task.h" | 28 #include "base/task.h" |
| 29 #include "chrome/browser/browser_process.h" | 29 #include "chrome/browser/browser_process.h" |
| 30 #include "chrome/browser/download_manager.h" | 30 #include "chrome/browser/download/download_manager.h" |
| 31 #include "chrome/browser/history/history.h" | 31 #include "chrome/browser/history/history.h" |
| 32 #include "chrome/browser/history/history_backend.h" | 32 #include "chrome/browser/history/history_backend.h" |
| 33 #include "chrome/browser/history/history_database.h" | 33 #include "chrome/browser/history/history_database.h" |
| 34 #include "chrome/browser/history/in_memory_database.h" | 34 #include "chrome/browser/history/in_memory_database.h" |
| 35 #include "chrome/browser/history/in_memory_history_backend.h" | 35 #include "chrome/browser/history/in_memory_history_backend.h" |
| 36 #include "chrome/browser/history/page_usage_data.h" | 36 #include "chrome/browser/history/page_usage_data.h" |
| 37 #include "chrome/common/chrome_paths.h" | 37 #include "chrome/common/chrome_paths.h" |
| 38 #include "chrome/common/jpeg_codec.h" | 38 #include "chrome/common/jpeg_codec.h" |
| 39 #include "chrome/common/notification_service.h" | 39 #include "chrome/common/notification_service.h" |
| 40 #include "chrome/common/sqlite_utils.h" | 40 #include "chrome/common/sqlite_utils.h" |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 history->ScheduleDBTask(task.get(), &request_consumer); | 824 history->ScheduleDBTask(task.get(), &request_consumer); |
| 825 request_consumer.CancelAllRequests(); | 825 request_consumer.CancelAllRequests(); |
| 826 CleanupHistoryService(); | 826 CleanupHistoryService(); |
| 827 // WARNING: history has now been deleted. | 827 // WARNING: history has now been deleted. |
| 828 history = NULL; | 828 history = NULL; |
| 829 ASSERT_FALSE(task->done_invoked); | 829 ASSERT_FALSE(task->done_invoked); |
| 830 } | 830 } |
| 831 | 831 |
| 832 } // namespace history | 832 } // namespace history |
| 833 | 833 |
| OLD | NEW |