OLD | NEW |
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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 base::Unretained(&model_load_callback_))); | 144 base::Unretained(&model_load_callback_))); |
145 frontend_dtc_->StartAssociating( | 145 frontend_dtc_->StartAssociating( |
146 base::Bind(&StartCallbackMock::Run, | 146 base::Bind(&StartCallbackMock::Run, |
147 base::Unretained(&start_callback_))); | 147 base::Unretained(&start_callback_))); |
148 } | 148 } |
149 | 149 |
150 void PumpLoop() { | 150 void PumpLoop() { |
151 message_loop_.RunUntilIdle(); | 151 message_loop_.RunUntilIdle(); |
152 } | 152 } |
153 | 153 |
154 MessageLoopForUI message_loop_; | 154 base::MessageLoopForUI message_loop_; |
155 content::TestBrowserThread ui_thread_; | 155 content::TestBrowserThread ui_thread_; |
156 scoped_refptr<FrontendDataTypeControllerFake> frontend_dtc_; | 156 scoped_refptr<FrontendDataTypeControllerFake> frontend_dtc_; |
157 scoped_ptr<ProfileSyncComponentsFactoryMock> profile_sync_factory_; | 157 scoped_ptr<ProfileSyncComponentsFactoryMock> profile_sync_factory_; |
158 scoped_refptr<FrontendDataTypeControllerMock> dtc_mock_; | 158 scoped_refptr<FrontendDataTypeControllerMock> dtc_mock_; |
159 ProfileMock profile_; | 159 ProfileMock profile_; |
160 ProfileSyncServiceMock service_; | 160 ProfileSyncServiceMock service_; |
161 ModelAssociatorMock* model_associator_; | 161 ModelAssociatorMock* model_associator_; |
162 ChangeProcessorMock* change_processor_; | 162 ChangeProcessorMock* change_processor_; |
163 StartCallbackMock start_callback_; | 163 StartCallbackMock start_callback_; |
164 ModelLoadCallbackMock model_load_callback_; | 164 ModelLoadCallbackMock model_load_callback_; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 &FrontendDataTypeController::Stop)); | 267 &FrontendDataTypeController::Stop)); |
268 SetStopExpectations(); | 268 SetStopExpectations(); |
269 EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state()); | 269 EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state()); |
270 Start(); | 270 Start(); |
271 EXPECT_EQ(DataTypeController::RUNNING, frontend_dtc_->state()); | 271 EXPECT_EQ(DataTypeController::RUNNING, frontend_dtc_->state()); |
272 // This should cause frontend_dtc_->Stop() to be called. | 272 // This should cause frontend_dtc_->Stop() to be called. |
273 frontend_dtc_->OnSingleDatatypeUnrecoverableError(FROM_HERE, "Test"); | 273 frontend_dtc_->OnSingleDatatypeUnrecoverableError(FROM_HERE, "Test"); |
274 PumpLoop(); | 274 PumpLoop(); |
275 EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state()); | 275 EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state()); |
276 } | 276 } |
OLD | NEW |