summaryrefslogtreecommitdiffstats
path: root/sync/internal_api/test
diff options
context:
space:
mode:
authorrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-10 00:37:14 +0000
committerrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-10 00:37:14 +0000
commit2331b1a15f827f23891e1707894e855652a3e713 (patch)
treea56476e1c88d2ba48c0bbf514d7a2cfcbd4a9db7 /sync/internal_api/test
parentd5ae7bab3f47042751ba1c2f2026d65ea3b16a51 (diff)
downloadchromium_src-2331b1a15f827f23891e1707894e855652a3e713.zip
chromium_src-2331b1a15f827f23891e1707894e855652a3e713.tar.gz
chromium_src-2331b1a15f827f23891e1707894e855652a3e713.tar.bz2
Retry: Clean up TestProfileSyncService tests
This is a retry of r238348, which was reverted in r238368. I believe the build failure that led to the revert, though related to my change, was a flake caused by stale object files on the build bot. 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/102513002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239615 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/internal_api/test')
-rw-r--r--sync/internal_api/test/sync_manager_factory_for_profile_sync_test.cc9
-rw-r--r--sync/internal_api/test/sync_manager_for_profile_sync_test.cc24
-rw-r--r--sync/internal_api/test/sync_manager_for_profile_sync_test.h4
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