diff options
author | Ben Murdoch <benm@google.com> | 2013-07-24 10:36:34 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2013-07-24 10:36:34 +0100 |
commit | a3f7b4e666c476898878fa745f637129375cd889 (patch) | |
tree | 1d78b48780e4c8603c226fd88d8f4b786f00bb81 /chrome/browser/sync/glue | |
parent | d4336a7d5c149891bede0c3201c8e831520067af (diff) | |
download | chromium_org-a3f7b4e666c476898878fa745f637129375cd889.tar.gz |
Merge from Chromium at DEPS revision r213371
This commit was generated by merge_to_master.py.
Change-Id: I35a74205de4bff52a2dd6b15330f8a002a39efaf
Diffstat (limited to 'chrome/browser/sync/glue')
3 files changed, 26 insertions, 31 deletions
diff --git a/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc b/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc index 2660d57bf9..696f5f1597 100644 --- a/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc +++ b/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc @@ -7,7 +7,6 @@ #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" -#include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/sync/glue/autofill_data_type_controller.h" @@ -24,7 +23,7 @@ #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" -#include "content/public/test/test_browser_thread.h" +#include "content/public/test/test_browser_thread_bundle.h" #include "sync/api/sync_error.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -153,10 +152,9 @@ class MockWebDataServiceWrapperSyncable : public MockWebDataServiceWrapper { class SyncAutofillDataTypeControllerTest : public testing::Test { public: SyncAutofillDataTypeControllerTest() - : weak_ptr_factory_(this), - ui_thread_(BrowserThread::UI, &message_loop_), - db_thread_(BrowserThread::DB), - last_start_result_(DataTypeController::OK) {} + : thread_bundle_(content::TestBrowserThreadBundle::REAL_DB_THREAD), + last_start_result_(DataTypeController::OK), + weak_ptr_factory_(this) {} virtual ~SyncAutofillDataTypeControllerTest() {} @@ -174,8 +172,6 @@ class SyncAutofillDataTypeControllerTest : public testing::Test { new AutofillDataTypeController(&profile_sync_factory_, &profile_, &service_); - - db_thread_.Start(); } // Passed to AutofillDTC::Start(). @@ -204,10 +200,7 @@ class SyncAutofillDataTypeControllerTest : public testing::Test { } protected: - base::WeakPtrFactory<SyncAutofillDataTypeControllerTest> weak_ptr_factory_; - base::MessageLoopForUI message_loop_; - content::TestBrowserThread ui_thread_; - content::TestBrowserThread db_thread_; + content::TestBrowserThreadBundle thread_bundle_; scoped_refptr<NiceMock<SharedChangeProcessorMock> > change_processor_; ProfileSyncComponentsFactoryMock profile_sync_factory_; @@ -218,6 +211,7 @@ class SyncAutofillDataTypeControllerTest : public testing::Test { // Stores arguments of most recent call of OnStartFinished(). DataTypeController::StartResult last_start_result_; syncer::SyncError last_start_error_; + base::WeakPtrFactory<SyncAutofillDataTypeControllerTest> weak_ptr_factory_; }; // Load the WDS's database, then start the Autofill DTC. It should diff --git a/chrome/browser/sync/glue/search_engine_data_type_controller_unittest.cc b/chrome/browser/sync/glue/search_engine_data_type_controller_unittest.cc index ec8ba1ffe4..3f95b14342 100644 --- a/chrome/browser/sync/glue/search_engine_data_type_controller_unittest.cc +++ b/chrome/browser/sync/glue/search_engine_data_type_controller_unittest.cc @@ -6,6 +6,7 @@ #include "base/bind_helpers.h" #include "base/callback.h" #include "base/memory/scoped_ptr.h" +#include "base/run_loop.h" #include "base/tracked_objects.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/search_engines/template_url_service_factory.h" @@ -143,7 +144,7 @@ TEST_F(SyncSearchEngineDataTypeControllerTest, StartURLServiceNotReady) { EXPECT_EQ(DataTypeController::MODEL_LOADED, search_engine_dtc_->state()); // Wait until WebDB is loaded before we shut it down. - test_util_.BlockTillServiceProcessesRequests(); + base::RunLoop().RunUntilIdle(); } TEST_F(SyncSearchEngineDataTypeControllerTest, StartFirstRun) { @@ -222,7 +223,7 @@ TEST_F(SyncSearchEngineDataTypeControllerTest, Start(); // This should cause search_engine_dtc_->Stop() to be called. search_engine_dtc_->OnSingleDatatypeUnrecoverableError(FROM_HERE, "Test"); - test_util_.PumpLoop(); + base::RunLoop().RunUntilIdle(); EXPECT_EQ(DataTypeController::NOT_RUNNING, search_engine_dtc_->state()); EXPECT_FALSE(syncable_service_.syncing()); } diff --git a/chrome/browser/sync/glue/sync_backend_host_unittest.cc b/chrome/browser/sync/glue/sync_backend_host_unittest.cc index 5c2f62e508..90eadee3ec 100644 --- a/chrome/browser/sync/glue/sync_backend_host_unittest.cc +++ b/chrome/browser/sync/glue/sync_backend_host_unittest.cc @@ -20,7 +20,8 @@ #include "chrome/test/base/testing_profile.h" #include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/notification_service.h" -#include "content/public/test/test_browser_thread.h" +#include "content/public/test/test_browser_thread_bundle.h" +#include "content/public/test/test_utils.h" #include "google/cacheinvalidation/include/types.h" #include "net/url_request/test_url_fetcher_factory.h" #include "sync/internal_api/public/base/model_type.h" @@ -135,16 +136,13 @@ class FakeSyncManagerFactory : public syncer::SyncManagerFactory { class SyncBackendHostTest : public testing::Test { protected: SyncBackendHostTest() - : ui_thread_(BrowserThread::UI, &ui_loop_), - io_thread_(BrowserThread::IO), + : thread_bundle_(content::TestBrowserThreadBundle::REAL_IO_THREAD), fake_manager_(NULL) {} virtual ~SyncBackendHostTest() {} virtual void SetUp() OVERRIDE { - io_thread_.StartIOThread(); profile_.reset(new TestingProfile()); - profile_->CreateRequestContext(); sync_prefs_.reset(new SyncPrefs(profile_->GetPrefs())); backend_.reset(new SyncBackendHost( profile_->GetDebugName(), @@ -178,10 +176,10 @@ class SyncBackendHostTest : public testing::Test { profile_.reset(); // Pump messages posted by the sync thread (which may end up // posting on the IO thread). - ui_loop_.RunUntilIdle(); - io_thread_.Stop(); + base::RunLoop().RunUntilIdle(); + content::RunAllPendingInMessageLoop(BrowserThread::IO); // Pump any messages posted by the IO thread. - ui_loop_.RunUntilIdle(); + base::RunLoop().RunUntilIdle(); } // Synchronously initializes the backend. @@ -196,9 +194,11 @@ class SyncBackendHostTest : public testing::Test { &fake_manager_factory_, &handler_, NULL); - ui_loop_.PostDelayedTask(FROM_HERE, - ui_loop_.QuitClosure(), TestTimeouts::action_timeout()); - ui_loop_.Run(); + base::RunLoop run_loop; + BrowserThread::PostDelayedTask(BrowserThread::UI, FROM_HERE, + run_loop.QuitClosure(), + TestTimeouts::action_timeout()); + run_loop.Run(); // |fake_manager_factory_|'s fake_manager() is set on the sync // thread, but we can rely on the message loop barriers to // guarantee that we see the updated value. @@ -226,9 +226,11 @@ class SyncBackendHostTest : public testing::Test { base::Unretained(this)), base::Bind(&SyncBackendHostTest::OnDownloadRetry, base::Unretained(this))); - ui_loop_.PostDelayedTask(FROM_HERE, - ui_loop_.QuitClosure(), TestTimeouts::action_timeout()); - ui_loop_.Run(); + base::RunLoop run_loop; + BrowserThread::PostDelayedTask(BrowserThread::UI, FROM_HERE, + run_loop.QuitClosure(), + TestTimeouts::action_timeout()); + run_loop.Run(); } void IssueRefreshRequest(syncer::ModelTypeSet types) { @@ -250,9 +252,7 @@ class SyncBackendHostTest : public testing::Test { NOTIMPLEMENTED(); } - base::MessageLoop ui_loop_; - content::TestBrowserThread ui_thread_; - content::TestBrowserThread io_thread_; + content::TestBrowserThreadBundle thread_bundle_; StrictMock<MockSyncFrontend> mock_frontend_; syncer::SyncCredentials credentials_; syncer::TestUnrecoverableErrorHandler handler_; |