diff options
author | rlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-03 11:28:49 +0000 |
---|---|---|
committer | rlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-03 11:28:49 +0000 |
commit | f4d2de015994146bddd599d7e8bf79f5cbac7fd7 (patch) | |
tree | bb5b2f17aa74dfd8b0f4c95ee8d8369feb6dd7c0 /sync/internal_api/test | |
parent | 9f05f012951b73116c0cd50191b0d63871437a95 (diff) | |
download | chromium_src-f4d2de015994146bddd599d7e8bf79f5cbac7fd7.zip chromium_src-f4d2de015994146bddd599d7e8bf79f5cbac7fd7.tar.gz chromium_src-f4d2de015994146bddd599d7e8bf79f5cbac7fd7.tar.bz2 |
Clean up TestProfileSyncService and related tests
This CL refactors many of the tests in profile_sync_service_unittest.cc.
It continues the refactoring work begun in r233533, r235661, and
r235854.
The JsController tests have been deleted. There is not much point in
testing the JsController here; it can be more easily tested on its own
in sync_js_controller_uniittest.cc. The SyncJsController unit tests
have been updated so they now cover the few cases that were formerly
only exercised in the ProfileSyncService unit tests.
It converts all remaining uncoverted tests from relying on the
TestProfileSyncService to using a real ProfileSyncService with an
injected backend. The injected backend makes it easier to create the
scenarios we want to test. We can inject a specially crafted SBH rather
than fiddling with "synchronous init" and "fail initial download" flags.
Since the TestProfileSyncService no longer needs to support the wide
variety of test scenarios required by the tests in
profile_sync_service_unittest.cc, we can greatly simplify its
implementation. Many of its parameters and associated code have been
removed.
BUG=140354,312994
Review URL: https://codereview.chromium.org/67683005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238348 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/internal_api/test')
3 files changed, 13 insertions, 24 deletions
diff --git a/sync/internal_api/test/sync_manager_factory_for_profile_sync_test.cc b/sync/internal_api/test/sync_manager_factory_for_profile_sync_test.cc index df4073b..34289c4 100644 --- a/sync/internal_api/test/sync_manager_factory_for_profile_sync_test.cc +++ b/sync/internal_api/test/sync_manager_factory_for_profile_sync_test.cc @@ -9,10 +9,8 @@ namespace syncer { SyncManagerFactoryForProfileSyncTest::SyncManagerFactoryForProfileSyncTest( - base::Closure init_callback, - bool set_initial_sync_ended) - : init_callback_(init_callback), - set_initial_sync_ended_(set_initial_sync_ended) { + base::Closure init_callback) + : init_callback_(init_callback) { } SyncManagerFactoryForProfileSyncTest::~SyncManagerFactoryForProfileSyncTest() {} @@ -22,8 +20,7 @@ SyncManagerFactoryForProfileSyncTest::CreateSyncManager(std::string name) { return scoped_ptr<syncer::SyncManager>( new SyncManagerForProfileSyncTest( name, - init_callback_, - set_initial_sync_ended_)); + init_callback_)); } } // namespace syncer diff --git a/sync/internal_api/test/sync_manager_for_profile_sync_test.cc b/sync/internal_api/test/sync_manager_for_profile_sync_test.cc index aaa6c8d..e552c2f 100644 --- a/sync/internal_api/test/sync_manager_for_profile_sync_test.cc +++ b/sync/internal_api/test/sync_manager_for_profile_sync_test.cc @@ -12,11 +12,9 @@ namespace syncer { SyncManagerForProfileSyncTest::SyncManagerForProfileSyncTest( std::string name, - base::Closure init_callback, - bool set_initial_sync_ended) + base::Closure init_callback) : SyncManagerImpl(name), - init_callback_(init_callback), - set_initial_sync_ended_(set_initial_sync_ended) {} + init_callback_(init_callback) {} SyncManagerForProfileSyncTest::~SyncManagerForProfileSyncTest() {} @@ -27,18 +25,14 @@ void SyncManagerForProfileSyncTest::NotifyInitializationSuccess() { if (!init_callback_.is_null()) init_callback_.Run(); - if (set_initial_sync_ended_) { - ModelTypeSet early_download_types; - early_download_types.PutAll(ControlTypes()); - early_download_types.PutAll(PriorityUserTypes()); - for (ModelTypeSet::Iterator it = early_download_types.First(); - it.Good(); it.Inc()) { - if (!directory->InitialSyncEndedForType(it.Get())) { - syncer::TestUserShare::CreateRoot(it.Get(), user_share); - } + ModelTypeSet early_download_types; + early_download_types.PutAll(ControlTypes()); + early_download_types.PutAll(PriorityUserTypes()); + for (ModelTypeSet::Iterator it = early_download_types.First(); + it.Good(); it.Inc()) { + if (!directory->InitialSyncEndedForType(it.Get())) { + syncer::TestUserShare::CreateRoot(it.Get(), user_share); } - } else { - VLOG(2) << "Skipping directory init"; } SyncManagerImpl::NotifyInitializationSuccess(); diff --git a/sync/internal_api/test/sync_manager_for_profile_sync_test.h b/sync/internal_api/test/sync_manager_for_profile_sync_test.h index c9af22d..8493386 100644 --- a/sync/internal_api/test/sync_manager_for_profile_sync_test.h +++ b/sync/internal_api/test/sync_manager_for_profile_sync_test.h @@ -19,14 +19,12 @@ class SyncManagerForProfileSyncTest : public syncer::SyncManagerImpl { public: SyncManagerForProfileSyncTest(std::string name, - base::Closure init_callback, - bool set_initial_sync_ended); + base::Closure init_callback); virtual ~SyncManagerForProfileSyncTest(); virtual void NotifyInitializationSuccess() OVERRIDE; private: base::Closure init_callback_; - bool set_initial_sync_ended_; }; } // namespace syncer |