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

Unified Diff: chrome/browser/sync/profile_sync_service_startup_unittest.cc

Issue 11342022: [Sync] Fix up users who were affected by bug 154940 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add test Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync/profile_sync_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/profile_sync_service_startup_unittest.cc
diff --git a/chrome/browser/sync/profile_sync_service_startup_unittest.cc b/chrome/browser/sync/profile_sync_service_startup_unittest.cc
index 010952535438f6f6aad402090c0d47ad358d0b8c..609d82cf1b0563001769d8c3aa9c7787c11ed1c4 100644
--- a/chrome/browser/sync/profile_sync_service_startup_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_startup_unittest.cc
@@ -16,6 +16,7 @@
#include "chrome/browser/sync/glue/data_type_manager_mock.h"
#include "chrome/browser/sync/profile_sync_components_factory_mock.h"
#include "chrome/browser/sync/profile_sync_test_util.h"
+#include "chrome/browser/sync/sync_prefs.h"
#include "chrome/browser/sync/test_profile_sync_service.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/pref_names.h"
@@ -268,6 +269,33 @@ TEST_F(ProfileSyncServiceStartupTest, StartNormal) {
service_->Initialize();
}
+TEST_F(ProfileSyncServiceStartupTest, StartRecoverDatatypePrefs) {
+ DataTypeManagerMock* data_type_manager = SetUpDataTypeManager();
+ EXPECT_CALL(*data_type_manager, Configure(_, _));
+ EXPECT_CALL(*data_type_manager, state()).
+ WillRepeatedly(Return(DataTypeManager::CONFIGURED));
+ EXPECT_CALL(*data_type_manager, Stop()).Times(1);
+
+ EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber());
+
+ // Clear the datatype preference fields (simulating bug 154940).
tim (not reviewing) 2012/10/29 23:25:24 Can you also write a test to cover the case where
Nicolas Zea 2012/10/30 00:05:58 Done (and check that it's true in this test). I re
+ profile_->GetPrefs()->ClearPref(prefs::kSyncKeepEverythingSynced);
+ for (syncer::ModelTypeSet::Iterator iter = syncer::UserTypes().First();
+ iter.Good(); iter.Inc()) {
+ profile_->GetPrefs()->ClearPref(
+ browser_sync::SyncPrefs::GetPrefNameForDataType(iter.Get()));
+ }
+
+ // Pre load the tokens
+ TokenServiceFactory::GetForProfile(profile_.get())->IssueAuthTokenForTest(
+ GaiaConstants::kSyncService, "sync_token");
+ profile_->GetPrefs()->SetString(prefs::kGoogleServicesUsername, "test_user");
+ service_->Initialize();
+
+ EXPECT_TRUE(service_->GetPreferredDataTypes().HasAll(
+ service_->GetRegisteredDataTypes()));
tim (not reviewing) 2012/10/29 23:25:24 nit - indent
Nicolas Zea 2012/10/30 00:05:58 Done.
+}
+
TEST_F(ProfileSyncServiceStartupTest, ManagedStartup) {
// Disable sync through policy.
profile_->GetPrefs()->SetBoolean(prefs::kSyncManaged, true);
« no previous file with comments | « chrome/browser/sync/profile_sync_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698