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

Side by Side Diff: chrome/browser/supervised_user/supervised_user_shared_settings_service_unittest.cc

Issue 615493005: c/b/supervised_user: Use range-based for where appropriate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix CrOS Created 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <string>
6
5 #include "base/bind.h" 7 #include "base/bind.h"
6 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
7 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/supervised_user/supervised_user_shared_settings_service .h" 10 #include "chrome/browser/supervised_user/supervised_user_shared_settings_service .h"
9 #include "chrome/common/pref_names.h" 11 #include "chrome/common/pref_names.h"
10 #include "chrome/test/base/testing_profile.h" 12 #include "chrome/test/base/testing_profile.h"
11 #include "sync/api/fake_sync_change_processor.h" 13 #include "sync/api/fake_sync_change_processor.h"
12 #include "sync/api/sync_change.h" 14 #include "sync/api/sync_change.h"
13 #include "sync/api/sync_change_processor_wrapper_for_test.h" 15 #include "sync/api/sync_change_processor_wrapper_for_test.h"
14 #include "sync/api/sync_error_factory_mock.h" 16 #include "sync/api/sync_error_factory_mock.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 EXPECT_FALSE(result.error().IsSet()); 96 EXPECT_FALSE(result.error().IsSet());
95 } 97 }
96 98
97 const base::DictionaryValue* GetAllSettings() { 99 const base::DictionaryValue* GetAllSettings() {
98 return profile_.GetPrefs()->GetDictionary( 100 return profile_.GetPrefs()->GetDictionary(
99 prefs::kSupervisedUserSharedSettings); 101 prefs::kSupervisedUserSharedSettings);
100 } 102 }
101 103
102 void VerifySyncChangesAndClear() { 104 void VerifySyncChangesAndClear() {
103 SyncChangeList& changes = sync_processor_->changes(); 105 SyncChangeList& changes = sync_processor_->changes();
104 for (SyncChangeList::const_iterator it = changes.begin(); 106 for (const SyncChange& sync_change : changes) {
105 it != changes.end();
106 ++it) {
107 const sync_pb::ManagedUserSharedSettingSpecifics& setting = 107 const sync_pb::ManagedUserSharedSettingSpecifics& setting =
108 it->sync_data().GetSpecifics().managed_user_shared_setting(); 108 sync_change.sync_data().GetSpecifics().managed_user_shared_setting();
109 EXPECT_EQ( 109 EXPECT_EQ(
110 setting.value(), 110 setting.value(),
111 ToJson(settings_service_.GetValue(setting.mu_id(), setting.key()))); 111 ToJson(settings_service_.GetValue(setting.mu_id(), setting.key())));
112 } 112 }
113 changes.clear(); 113 changes.clear();
114 } 114 }
115 115
116 // testing::Test overrides: 116 // testing::Test overrides:
117 virtual void SetUp() OVERRIDE { 117 virtual void SetUp() OVERRIDE {
118 subscription_ = settings_service_.Subscribe( 118 subscription_ = settings_service_.Subscribe(
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 settings_service_.GetAllSyncData(SUPERVISED_USER_SHARED_SETTINGS).size()); 263 settings_service_.GetAllSyncData(SUPERVISED_USER_SHARED_SETTINGS).size());
264 EXPECT_EQ(ToJson(&name), 264 EXPECT_EQ(ToJson(&name),
265 ToJson(settings_service_.GetValue(kIdA, "name"))); 265 ToJson(settings_service_.GetValue(kIdA, "name")));
266 EXPECT_EQ(ToJson(&age), ToJson(settings_service_.GetValue(kIdA, "age"))); 266 EXPECT_EQ(ToJson(&age), ToJson(settings_service_.GetValue(kIdA, "age")));
267 EXPECT_EQ(ToJson(&bar), ToJson(settings_service_.GetValue(kIdB, "foo"))); 267 EXPECT_EQ(ToJson(&bar), ToJson(settings_service_.GetValue(kIdB, "foo")));
268 EXPECT_EQ(ToJson(&blurp), ToJson(settings_service_.GetValue(kIdC, "baz"))); 268 EXPECT_EQ(ToJson(&blurp), ToJson(settings_service_.GetValue(kIdC, "baz")));
269 EXPECT_FALSE(settings_service_.GetValue(kIdA, "foo")); 269 EXPECT_FALSE(settings_service_.GetValue(kIdA, "foo"));
270 EXPECT_FALSE(settings_service_.GetValue(kIdB, "name")); 270 EXPECT_FALSE(settings_service_.GetValue(kIdB, "name"));
271 EXPECT_FALSE(settings_service_.GetValue(kIdC, "name")); 271 EXPECT_FALSE(settings_service_.GetValue(kIdC, "name"));
272 } 272 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698