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

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

Issue 342048: Show a warning when the history files can't be read correctly.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 } // namespace 90 } // namespace
91 91
92 // Delegate class for when we create a backend without a HistoryService. 92 // Delegate class for when we create a backend without a HistoryService.
93 class BackendDelegate : public HistoryBackend::Delegate { 93 class BackendDelegate : public HistoryBackend::Delegate {
94 public: 94 public:
95 explicit BackendDelegate(HistoryTest* history_test) 95 explicit BackendDelegate(HistoryTest* history_test)
96 : history_test_(history_test) { 96 : history_test_(history_test) {
97 } 97 }
98 98
99 virtual void NotifyTooNew(); 99 virtual void NotifyProfileError(int message_id);
100 virtual void SetInMemoryBackend(InMemoryHistoryBackend* backend); 100 virtual void SetInMemoryBackend(InMemoryHistoryBackend* backend);
101 virtual void BroadcastNotifications(NotificationType type, 101 virtual void BroadcastNotifications(NotificationType type,
102 HistoryDetails* details); 102 HistoryDetails* details);
103 virtual void DBLoaded() {} 103 virtual void DBLoaded() {}
104 104
105 private: 105 private:
106 HistoryTest* history_test_; 106 HistoryTest* history_test_;
107 }; 107 };
108 108
109 // This must be outside the anonymous namespace for the friend statement in 109 // This must be outside the anonymous namespace for the friend statement in
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 bool query_url_success_; 287 bool query_url_success_;
288 URLRow query_url_row_; 288 URLRow query_url_row_;
289 VisitVector query_url_visits_; 289 VisitVector query_url_visits_;
290 290
291 // Created via CreateBackendAndDatabase. 291 // Created via CreateBackendAndDatabase.
292 scoped_refptr<HistoryBackend> backend_; 292 scoped_refptr<HistoryBackend> backend_;
293 scoped_ptr<InMemoryHistoryBackend> in_mem_backend_; 293 scoped_ptr<InMemoryHistoryBackend> in_mem_backend_;
294 HistoryDatabase* db_; // Cached reference to the backend's database. 294 HistoryDatabase* db_; // Cached reference to the backend's database.
295 }; 295 };
296 296
297 void BackendDelegate::NotifyTooNew() { 297 void BackendDelegate::NotifyProfileError(int message_id) {
298 } 298 }
299 299
300 void BackendDelegate::SetInMemoryBackend(InMemoryHistoryBackend* backend) { 300 void BackendDelegate::SetInMemoryBackend(InMemoryHistoryBackend* backend) {
301 // Save the in-memory backend to the history test object, this happens 301 // Save the in-memory backend to the history test object, this happens
302 // synchronously, so we don't have to do anything fancy. 302 // synchronously, so we don't have to do anything fancy.
303 history_test_->in_mem_backend_.reset(backend); 303 history_test_->in_mem_backend_.reset(backend);
304 } 304 }
305 305
306 void BackendDelegate::BroadcastNotifications(NotificationType type, 306 void BackendDelegate::BroadcastNotifications(NotificationType type,
307 HistoryDetails* details) { 307 HistoryDetails* details) {
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 history_service_ = history; 834 history_service_ = history;
835 history->ScheduleDBTask(task.get(), &request_consumer); 835 history->ScheduleDBTask(task.get(), &request_consumer);
836 request_consumer.CancelAllRequests(); 836 request_consumer.CancelAllRequests();
837 CleanupHistoryService(); 837 CleanupHistoryService();
838 // WARNING: history has now been deleted. 838 // WARNING: history has now been deleted.
839 history = NULL; 839 history = NULL;
840 ASSERT_FALSE(task->done_invoked); 840 ASSERT_FALSE(task->done_invoked);
841 } 841 }
842 842
843 } // namespace history 843 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698