Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Side by Side Diff: chrome/browser/history/history_unittest.cc

Issue 9316109: Move Ownership of IMUI to HistoryService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 redirect_query_success_(false), 107 redirect_query_success_(false),
108 query_url_success_(false), 108 query_url_success_(false),
109 db_(NULL) { 109 db_(NULL) {
110 } 110 }
111 ~HistoryTest() { 111 ~HistoryTest() {
112 } 112 }
113 113
114 // Creates the HistoryBackend and HistoryDatabase on the current thread, 114 // Creates the HistoryBackend and HistoryDatabase on the current thread,
115 // assigning the values to backend_ and db_. 115 // assigning the values to backend_ and db_.
116 void CreateBackendAndDatabase() { 116 void CreateBackendAndDatabase() {
117 backend_ = 117 backend_ = new HistoryBackend(history_dir_, 0, new BackendDelegate(this),
118 new HistoryBackend(history_dir_, 0, new BackendDelegate(this), NULL); 118 NULL);
Peter Kasting 2012/02/04 02:20:31 Nit: Either way is fine with me, honestly
119 backend_->Init(std::string(), false); 119 backend_->Init(std::string(), false);
120 db_ = backend_->db_.get(); 120 db_ = backend_->db_.get();
121 DCHECK(in_mem_backend_.get()) << "Mem backend should have been set by " 121 DCHECK(in_mem_backend_.get()) << "Mem backend should have been set by "
122 "HistoryBackend::Init"; 122 "HistoryBackend::Init";
123 } 123 }
124 124
125 void OnSegmentUsageAvailable(CancelableRequestProvider::Handle handle, 125 void OnSegmentUsageAvailable(CancelableRequestProvider::Handle handle,
126 std::vector<PageUsageData*>* data) { 126 std::vector<PageUsageData*>* data) {
127 page_usage_data_->swap(*data); 127 page_usage_data_->swap(*data);
128 MessageLoop::current()->Quit(); 128 MessageLoop::current()->Quit();
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 history_service_ = history; 953 history_service_ = history;
954 history->ScheduleDBTask(task.get(), &request_consumer); 954 history->ScheduleDBTask(task.get(), &request_consumer);
955 request_consumer.CancelAllRequests(); 955 request_consumer.CancelAllRequests();
956 CleanupHistoryService(); 956 CleanupHistoryService();
957 // WARNING: history has now been deleted. 957 // WARNING: history has now been deleted.
958 history = NULL; 958 history = NULL;
959 ASSERT_FALSE(task->done_invoked); 959 ASSERT_FALSE(task->done_invoked);
960 } 960 }
961 961
962 } // namespace history 962 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698