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

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

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 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 | 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 #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/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 } 183 }
184 184
185 void WaitForDTC() { 185 void WaitForDTC() {
186 WaitableEvent done(true, false); 186 WaitableEvent done(true, false);
187 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, 187 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE,
188 base::Bind(&SyncNonFrontendDataTypeControllerTest::SignalDone, &done)); 188 base::Bind(&SyncNonFrontendDataTypeControllerTest::SignalDone, &done));
189 done.TimedWait(TestTimeouts::action_timeout()); 189 done.TimedWait(TestTimeouts::action_timeout());
190 if (!done.IsSignaled()) { 190 if (!done.IsSignaled()) {
191 ADD_FAILURE() << "Timed out waiting for DB thread to finish."; 191 ADD_FAILURE() << "Timed out waiting for DB thread to finish.";
192 } 192 }
193 MessageLoop::current()->RunUntilIdle(); 193 base::MessageLoop::current()->RunUntilIdle();
194 } 194 }
195 195
196 void Start() { 196 void Start() {
197 non_frontend_dtc_->LoadModels( 197 non_frontend_dtc_->LoadModels(
198 base::Bind(&ModelLoadCallbackMock::Run, 198 base::Bind(&ModelLoadCallbackMock::Run,
199 base::Unretained(&model_load_callback_))); 199 base::Unretained(&model_load_callback_)));
200 non_frontend_dtc_->StartAssociating( 200 non_frontend_dtc_->StartAssociating(
201 base::Bind(&StartCallbackMock::Run, 201 base::Bind(&StartCallbackMock::Run,
202 base::Unretained(&start_callback_))); 202 base::Unretained(&start_callback_)));
203 } 203 }
204 204
205 MessageLoopForUI message_loop_; 205 base::MessageLoopForUI message_loop_;
206 content::TestBrowserThread ui_thread_; 206 content::TestBrowserThread ui_thread_;
207 content::TestBrowserThread db_thread_; 207 content::TestBrowserThread db_thread_;
208 scoped_refptr<NonFrontendDataTypeControllerFake> non_frontend_dtc_; 208 scoped_refptr<NonFrontendDataTypeControllerFake> non_frontend_dtc_;
209 scoped_ptr<ProfileSyncComponentsFactoryMock> profile_sync_factory_; 209 scoped_ptr<ProfileSyncComponentsFactoryMock> profile_sync_factory_;
210 scoped_refptr<NonFrontendDataTypeControllerMock> dtc_mock_; 210 scoped_refptr<NonFrontendDataTypeControllerMock> dtc_mock_;
211 ProfileMock profile_; 211 ProfileMock profile_;
212 ProfileSyncServiceMock service_; 212 ProfileSyncServiceMock service_;
213 ModelAssociatorMock* model_associator_; 213 ModelAssociatorMock* model_associator_;
214 ChangeProcessorMock* change_processor_; 214 ChangeProcessorMock* change_processor_;
215 StartCallbackMock start_callback_; 215 StartCallbackMock start_callback_;
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 EXPECT_EQ(DataTypeController::RUNNING, non_frontend_dtc_->state()); 379 EXPECT_EQ(DataTypeController::RUNNING, non_frontend_dtc_->state());
380 // This should cause non_frontend_dtc_->Stop() to be called. 380 // This should cause non_frontend_dtc_->Stop() to be called.
381 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, base::Bind( 381 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, base::Bind(
382 &NonFrontendDataTypeControllerFake::OnSingleDatatypeUnrecoverableError, 382 &NonFrontendDataTypeControllerFake::OnSingleDatatypeUnrecoverableError,
383 non_frontend_dtc_.get(), 383 non_frontend_dtc_.get(),
384 FROM_HERE, 384 FROM_HERE,
385 std::string("Test"))); 385 std::string("Test")));
386 WaitForDTC(); 386 WaitForDTC();
387 EXPECT_EQ(DataTypeController::NOT_RUNNING, non_frontend_dtc_->state()); 387 EXPECT_EQ(DataTypeController::NOT_RUNNING, non_frontend_dtc_->state());
388 } 388 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698