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 27 matching lines...) Expand all Loading... |
38 #include "chrome/browser/history/download_history_info.h" | 38 #include "chrome/browser/history/download_history_info.h" |
39 #include "chrome/browser/history/history.h" | 39 #include "chrome/browser/history/history.h" |
40 #include "chrome/browser/history/history_backend.h" | 40 #include "chrome/browser/history/history_backend.h" |
41 #include "chrome/browser/history/history_database.h" | 41 #include "chrome/browser/history/history_database.h" |
42 #include "chrome/browser/history/history_notifications.h" | 42 #include "chrome/browser/history/history_notifications.h" |
43 #include "chrome/browser/history/in_memory_database.h" | 43 #include "chrome/browser/history/in_memory_database.h" |
44 #include "chrome/browser/history/in_memory_history_backend.h" | 44 #include "chrome/browser/history/in_memory_history_backend.h" |
45 #include "chrome/browser/history/page_usage_data.h" | 45 #include "chrome/browser/history/page_usage_data.h" |
46 #include "chrome/common/chrome_paths.h" | 46 #include "chrome/common/chrome_paths.h" |
47 #include "chrome/common/thumbnail_score.h" | 47 #include "chrome/common/thumbnail_score.h" |
| 48 #include "chrome/test/testing_browser_process_test.h" |
48 #include "chrome/tools/profiles/thumbnail-inl.h" | 49 #include "chrome/tools/profiles/thumbnail-inl.h" |
49 #include "content/common/notification_details.h" | 50 #include "content/common/notification_details.h" |
50 #include "content/common/notification_source.h" | 51 #include "content/common/notification_source.h" |
51 #include "sql/connection.h" | 52 #include "sql/connection.h" |
52 #include "sql/statement.h" | 53 #include "sql/statement.h" |
53 #include "testing/gtest/include/gtest/gtest.h" | 54 #include "testing/gtest/include/gtest/gtest.h" |
54 #include "third_party/skia/include/core/SkBitmap.h" | 55 #include "third_party/skia/include/core/SkBitmap.h" |
55 #include "ui/gfx/codec/jpeg_codec.h" | 56 #include "ui/gfx/codec/jpeg_codec.h" |
56 | 57 |
57 using base::Time; | 58 using base::Time; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 virtual void BroadcastNotifications(int type, | 94 virtual void BroadcastNotifications(int type, |
94 HistoryDetails* details) OVERRIDE; | 95 HistoryDetails* details) OVERRIDE; |
95 virtual void DBLoaded() OVERRIDE {} | 96 virtual void DBLoaded() OVERRIDE {} |
96 virtual void StartTopSitesMigration() OVERRIDE {} | 97 virtual void StartTopSitesMigration() OVERRIDE {} |
97 private: | 98 private: |
98 HistoryTest* history_test_; | 99 HistoryTest* history_test_; |
99 }; | 100 }; |
100 | 101 |
101 // This must be outside the anonymous namespace for the friend statement in | 102 // This must be outside the anonymous namespace for the friend statement in |
102 // HistoryBackend to work. | 103 // HistoryBackend to work. |
103 class HistoryTest : public testing::Test { | 104 class HistoryTest : public TestingBrowserProcessTest { |
104 public: | 105 public: |
105 HistoryTest() | 106 HistoryTest() |
106 : history_service_(NULL), | 107 : history_service_(NULL), |
107 got_thumbnail_callback_(false), | 108 got_thumbnail_callback_(false), |
108 redirect_query_success_(false), | 109 redirect_query_success_(false), |
109 query_url_success_(false), | 110 query_url_success_(false), |
110 db_(NULL) { | 111 db_(NULL) { |
111 } | 112 } |
112 ~HistoryTest() { | 113 ~HistoryTest() { |
113 } | 114 } |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 history_service_ = history; | 856 history_service_ = history; |
856 history->ScheduleDBTask(task.get(), &request_consumer); | 857 history->ScheduleDBTask(task.get(), &request_consumer); |
857 request_consumer.CancelAllRequests(); | 858 request_consumer.CancelAllRequests(); |
858 CleanupHistoryService(); | 859 CleanupHistoryService(); |
859 // WARNING: history has now been deleted. | 860 // WARNING: history has now been deleted. |
860 history = NULL; | 861 history = NULL; |
861 ASSERT_FALSE(task->done_invoked); | 862 ASSERT_FALSE(task->done_invoked); |
862 } | 863 } |
863 | 864 |
864 } // namespace history | 865 } // namespace history |
OLD | NEW |