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

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

Issue 1143343005: chrome/browser: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 6 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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.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/location.h"
10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
11 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/single_thread_task_runner.h"
12 #include "base/thread_task_runner_handle.h" 14 #include "base/thread_task_runner_handle.h"
13 #include "base/tracked_objects.h" 15 #include "base/tracked_objects.h"
14 #include "chrome/browser/sync/glue/frontend_data_type_controller.h" 16 #include "chrome/browser/sync/glue/frontend_data_type_controller.h"
15 #include "chrome/browser/sync/glue/frontend_data_type_controller_mock.h" 17 #include "chrome/browser/sync/glue/frontend_data_type_controller_mock.h"
16 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" 18 #include "chrome/browser/sync/profile_sync_components_factory_mock.h"
17 #include "chrome/browser/sync/profile_sync_service_mock.h" 19 #include "chrome/browser/sync/profile_sync_service_mock.h"
18 #include "chrome/test/base/profile_mock.h" 20 #include "chrome/test/base/profile_mock.h"
19 #include "components/sync_driver/change_processor_mock.h" 21 #include "components/sync_driver/change_processor_mock.h"
20 #include "components/sync_driver/data_type_controller_mock.h" 22 #include "components/sync_driver/data_type_controller_mock.h"
21 #include "components/sync_driver/model_associator_mock.h" 23 #include "components/sync_driver/model_associator_mock.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state()); 182 EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state());
181 Start(); 183 Start();
182 EXPECT_EQ(DataTypeController::RUNNING, frontend_dtc_->state()); 184 EXPECT_EQ(DataTypeController::RUNNING, frontend_dtc_->state());
183 } 185 }
184 186
185 TEST_F(SyncFrontendDataTypeControllerTest, StartStopBeforeAssociation) { 187 TEST_F(SyncFrontendDataTypeControllerTest, StartStopBeforeAssociation) {
186 EXPECT_CALL(*dtc_mock_.get(), StartModels()).WillOnce(Return(true)); 188 EXPECT_CALL(*dtc_mock_.get(), StartModels()).WillOnce(Return(true));
187 EXPECT_CALL(*dtc_mock_.get(), CleanUpState()); 189 EXPECT_CALL(*dtc_mock_.get(), CleanUpState());
188 EXPECT_CALL(model_load_callback_, Run(_, _)); 190 EXPECT_CALL(model_load_callback_, Run(_, _));
189 EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state()); 191 EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state());
190 base::MessageLoop::current()->PostTask( 192 base::ThreadTaskRunnerHandle::Get()->PostTask(
191 FROM_HERE, base::Bind(&FrontendDataTypeController::Stop, frontend_dtc_)); 193 FROM_HERE, base::Bind(&FrontendDataTypeController::Stop, frontend_dtc_));
192 Start(); 194 Start();
193 EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state()); 195 EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state());
194 } 196 }
195 197
196 TEST_F(SyncFrontendDataTypeControllerTest, AbortDuringStartModels) { 198 TEST_F(SyncFrontendDataTypeControllerTest, AbortDuringStartModels) {
197 EXPECT_CALL(*dtc_mock_.get(), StartModels()).WillOnce(Return(false)); 199 EXPECT_CALL(*dtc_mock_.get(), StartModels()).WillOnce(Return(false));
198 EXPECT_CALL(*dtc_mock_.get(), CleanUpState()); 200 EXPECT_CALL(*dtc_mock_.get(), CleanUpState());
199 EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state()); 201 EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state());
200 frontend_dtc_->LoadModels( 202 frontend_dtc_->LoadModels(
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 SetStartExpectations(); 256 SetStartExpectations();
255 SetAssociateExpectations(); 257 SetAssociateExpectations();
256 SetActivateExpectations(DataTypeController::OK); 258 SetActivateExpectations(DataTypeController::OK);
257 SetStopExpectations(); 259 SetStopExpectations();
258 EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state()); 260 EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state());
259 Start(); 261 Start();
260 EXPECT_EQ(DataTypeController::RUNNING, frontend_dtc_->state()); 262 EXPECT_EQ(DataTypeController::RUNNING, frontend_dtc_->state());
261 frontend_dtc_->Stop(); 263 frontend_dtc_->Stop();
262 EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state()); 264 EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state());
263 } 265 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/favicon_cache.cc ('k') | chrome/browser/sync/glue/sync_backend_host_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698