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

Side by Side Diff: chrome/browser/sync/profile_sync_service_preference_unittest.cc

Issue 8065016: [Sync] Refactor non-frontend DTC to handle new API properly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Try harder trybot (rebase). Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <map> 5 #include <map>
6 #include <string> 6 #include <string>
7 7
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/json/json_value_serializer.h" 9 #include "base/json/json_value_serializer.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 using sync_api::ChangeRecord; 43 using sync_api::ChangeRecord;
44 using testing::_; 44 using testing::_;
45 using testing::Invoke; 45 using testing::Invoke;
46 using testing::Return; 46 using testing::Return;
47 47
48 typedef std::map<const std::string, const Value*> PreferenceValues; 48 typedef std::map<const std::string, const Value*> PreferenceValues;
49 49
50 ACTION_P4(BuildPrefSyncComponents, profile_sync_service, pref_sync_service, 50 ACTION_P4(BuildPrefSyncComponents, profile_sync_service, pref_sync_service,
51 model_associator_ptr, change_processor_ptr) { 51 model_associator_ptr, change_processor_ptr) {
52 sync_api::UserShare* user_share = profile_sync_service->GetUserShare(); 52 sync_api::UserShare* user_share = profile_sync_service->GetUserShare();
53 *change_processor_ptr = new GenericChangeProcessor(pref_sync_service, 53 *change_processor_ptr = new GenericChangeProcessor(
54 profile_sync_service, 54 profile_sync_service,
55 user_share); 55 pref_sync_service->AsWeakPtr(),
56 user_share);
56 *model_associator_ptr = new browser_sync::SyncableServiceAdapter( 57 *model_associator_ptr = new browser_sync::SyncableServiceAdapter(
57 syncable::PREFERENCES, 58 syncable::PREFERENCES,
58 pref_sync_service, 59 pref_sync_service,
59 *change_processor_ptr); 60 *change_processor_ptr);
60 return ProfileSyncFactory::SyncComponents(*model_associator_ptr, 61 return ProfileSyncFactory::SyncComponents(*model_associator_ptr,
61 *change_processor_ptr); 62 *change_processor_ptr);
62 } 63 }
63 64
64 // TODO(zea): Refactor to remove the ProfileSyncService usage. 65 // TODO(zea): Refactor to remove the ProfileSyncService usage.
65 class ProfileSyncServicePreferenceTest 66 class ProfileSyncServicePreferenceTest
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 533
533 // The pref value should still be the one dictated by policy. 534 // The pref value should still be the one dictated by policy.
534 EXPECT_TRUE(managed_value->Equals(&GetPreferenceValue(prefs::kHomePage))); 535 EXPECT_TRUE(managed_value->Equals(&GetPreferenceValue(prefs::kHomePage)));
535 536
536 // Switch kHomePage back to unmanaged. 537 // Switch kHomePage back to unmanaged.
537 profile_->GetTestingPrefService()->RemoveManagedPref(prefs::kHomePage); 538 profile_->GetTestingPrefService()->RemoveManagedPref(prefs::kHomePage);
538 539
539 // Sync value should be picked up. 540 // Sync value should be picked up.
540 EXPECT_TRUE(sync_value->Equals(&GetPreferenceValue(prefs::kHomePage))); 541 EXPECT_TRUE(sync_value->Equals(&GetPreferenceValue(prefs::kHomePage)));
541 } 542 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698