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/chromeos/settings/cros_settings_unittest.cc

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase Created 3 years, 9 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/settings/cros_settings.h" 5 #include "chrome/browser/chromeos/settings/cros_settings.h"
6 6
7 #include <map> 7 #include <map>
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 base::MakeUnique<base::Value>(false)); 126 base::MakeUnique<base::Value>(false));
127 AddExpectation(kAccountsPrefUsers, whitelist.CreateDeepCopy()); 127 AddExpectation(kAccountsPrefUsers, whitelist.CreateDeepCopy());
128 SetPref(kAccountsPrefUsers, &whitelist); 128 SetPref(kAccountsPrefUsers, &whitelist);
129 FetchPref(kAccountsPrefAllowNewUser); 129 FetchPref(kAccountsPrefAllowNewUser);
130 FetchPref(kAccountsPrefUsers); 130 FetchPref(kAccountsPrefUsers);
131 } 131 }
132 132
133 TEST_F(CrosSettingsTest, SetWhitelistWithListOps) { 133 TEST_F(CrosSettingsTest, SetWhitelistWithListOps) {
134 std::unique_ptr<base::ListValue> whitelist = 134 std::unique_ptr<base::ListValue> whitelist =
135 base::MakeUnique<base::ListValue>(); 135 base::MakeUnique<base::ListValue>();
136 base::StringValue hacky_user("h@xxor"); 136 base::Value hacky_user("h@xxor");
137 whitelist->Append(hacky_user.CreateDeepCopy()); 137 whitelist->Append(hacky_user.CreateDeepCopy());
138 AddExpectation(kAccountsPrefAllowNewUser, 138 AddExpectation(kAccountsPrefAllowNewUser,
139 base::MakeUnique<base::Value>(false)); 139 base::MakeUnique<base::Value>(false));
140 AddExpectation(kAccountsPrefUsers, std::move(whitelist)); 140 AddExpectation(kAccountsPrefUsers, std::move(whitelist));
141 // Add some user to the whitelist. 141 // Add some user to the whitelist.
142 settings_.AppendToList(kAccountsPrefUsers, &hacky_user); 142 settings_.AppendToList(kAccountsPrefUsers, &hacky_user);
143 FetchPref(kAccountsPrefAllowNewUser); 143 FetchPref(kAccountsPrefAllowNewUser);
144 FetchPref(kAccountsPrefUsers); 144 FetchPref(kAccountsPrefUsers);
145 } 145 }
146 146
147 TEST_F(CrosSettingsTest, SetWhitelistWithListOps2) { 147 TEST_F(CrosSettingsTest, SetWhitelistWithListOps2) {
148 base::ListValue whitelist; 148 base::ListValue whitelist;
149 base::StringValue hacky_user("h@xxor"); 149 base::Value hacky_user("h@xxor");
150 base::StringValue lamy_user("l@mer"); 150 base::Value lamy_user("l@mer");
151 whitelist.Append(hacky_user.CreateDeepCopy()); 151 whitelist.Append(hacky_user.CreateDeepCopy());
152 std::unique_ptr<base::ListValue> expected_list = whitelist.CreateDeepCopy(); 152 std::unique_ptr<base::ListValue> expected_list = whitelist.CreateDeepCopy();
153 whitelist.Append(lamy_user.CreateDeepCopy()); 153 whitelist.Append(lamy_user.CreateDeepCopy());
154 AddExpectation(kAccountsPrefAllowNewUser, 154 AddExpectation(kAccountsPrefAllowNewUser,
155 base::MakeUnique<base::Value>(false)); 155 base::MakeUnique<base::Value>(false));
156 AddExpectation(kAccountsPrefUsers, whitelist.CreateDeepCopy()); 156 AddExpectation(kAccountsPrefUsers, whitelist.CreateDeepCopy());
157 SetPref(kAccountsPrefUsers, &whitelist); 157 SetPref(kAccountsPrefUsers, &whitelist);
158 FetchPref(kAccountsPrefAllowNewUser); 158 FetchPref(kAccountsPrefAllowNewUser);
159 FetchPref(kAccountsPrefUsers); 159 FetchPref(kAccountsPrefUsers);
160 ASSERT_TRUE(expected_props_.empty()); 160 ASSERT_TRUE(expected_props_.empty());
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 EXPECT_TRUE(wildcard_match); 267 EXPECT_TRUE(wildcard_match);
268 EXPECT_TRUE(cs->FindEmailInList( 268 EXPECT_TRUE(cs->FindEmailInList(
269 kAccountsPrefUsers, "user@example.com", &wildcard_match)); 269 kAccountsPrefUsers, "user@example.com", &wildcard_match));
270 EXPECT_FALSE(wildcard_match); 270 EXPECT_FALSE(wildcard_match);
271 EXPECT_TRUE(cs->FindEmailInList( 271 EXPECT_TRUE(cs->FindEmailInList(
272 kAccountsPrefUsers, "*@example.com", &wildcard_match)); 272 kAccountsPrefUsers, "*@example.com", &wildcard_match));
273 EXPECT_TRUE(wildcard_match); 273 EXPECT_TRUE(wildcard_match);
274 } 274 }
275 275
276 } // namespace chromeos 276 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698