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

Side by Side Diff: chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc

Issue 573553004: Eliminate NOTIFICATION_HISTORY_LOADED notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
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 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" 5 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 223
224 bookmark_dtc_->LoadModels( 224 bookmark_dtc_->LoadModels(
225 base::Bind(&ModelLoadCallbackMock::Run, 225 base::Bind(&ModelLoadCallbackMock::Run,
226 base::Unretained(&model_load_callback_))); 226 base::Unretained(&model_load_callback_)));
227 227
228 EXPECT_EQ(DataTypeController::MODEL_STARTING, bookmark_dtc_->state()); 228 EXPECT_EQ(DataTypeController::MODEL_STARTING, bookmark_dtc_->state());
229 testing::Mock::VerifyAndClearExpectations(history_service_); 229 testing::Mock::VerifyAndClearExpectations(history_service_);
230 EXPECT_CALL(*history_service_, BackendLoaded()).WillRepeatedly(Return(true)); 230 EXPECT_CALL(*history_service_, BackendLoaded()).WillRepeatedly(Return(true));
231 231
232 // Send the notification that the history service has finished loading the db. 232 // Send the notification that the history service has finished loading the db.
233 content::NotificationService::current()->Notify( 233 history_service_->NotifyHistoryServiceLoaded();
234 chrome::NOTIFICATION_HISTORY_LOADED,
235 content::Source<Profile>(&profile_),
236 content::NotificationService::NoDetails());
237 EXPECT_EQ(DataTypeController::MODEL_LOADED, bookmark_dtc_->state()); 234 EXPECT_EQ(DataTypeController::MODEL_LOADED, bookmark_dtc_->state());
238 } 235 }
239 236
240 TEST_F(SyncBookmarkDataTypeControllerTest, StartFirstRun) { 237 TEST_F(SyncBookmarkDataTypeControllerTest, StartFirstRun) {
241 CreateBookmarkModel(LOAD_MODEL); 238 CreateBookmarkModel(LOAD_MODEL);
242 SetStartExpectations(); 239 SetStartExpectations();
243 SetAssociateExpectations(); 240 SetAssociateExpectations();
244 EXPECT_CALL(*model_associator_, SyncModelHasUserCreatedNodes(_)). 241 EXPECT_CALL(*model_associator_, SyncModelHasUserCreatedNodes(_)).
245 WillRepeatedly(DoAll(SetArgumentPointee<0>(false), Return(true))); 242 WillRepeatedly(DoAll(SetArgumentPointee<0>(false), Return(true)));
246 EXPECT_CALL(start_callback_, Run(DataTypeController::OK_FIRST_RUN, _, _)); 243 EXPECT_CALL(start_callback_, Run(DataTypeController::OK_FIRST_RUN, _, _));
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 SetStopExpectations(); 325 SetStopExpectations();
329 326
330 EXPECT_EQ(DataTypeController::NOT_RUNNING, bookmark_dtc_->state()); 327 EXPECT_EQ(DataTypeController::NOT_RUNNING, bookmark_dtc_->state());
331 328
332 EXPECT_CALL(start_callback_, Run(DataTypeController::OK, _, _)); 329 EXPECT_CALL(start_callback_, Run(DataTypeController::OK, _, _));
333 Start(); 330 Start();
334 EXPECT_EQ(DataTypeController::RUNNING, bookmark_dtc_->state()); 331 EXPECT_EQ(DataTypeController::RUNNING, bookmark_dtc_->state());
335 bookmark_dtc_->Stop(); 332 bookmark_dtc_->Stop();
336 EXPECT_EQ(DataTypeController::NOT_RUNNING, bookmark_dtc_->state()); 333 EXPECT_EQ(DataTypeController::NOT_RUNNING, bookmark_dtc_->state());
337 } 334 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698