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

Side by Side Diff: chrome/browser/chromeos/settings/install_attributes_unittest.cc

Issue 2403053003: Remove unused email from install attributes and add support for AD. (Closed)
Patch Set: Address Maksim's comments. Created 4 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 (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/install_attributes.h" 5 #include "chrome/browser/chromeos/settings/install_attributes.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 16 matching lines...) Expand all
27 27
28 void CopyLockResult(base::RunLoop* loop, 28 void CopyLockResult(base::RunLoop* loop,
29 InstallAttributes::LockResult* out, 29 InstallAttributes::LockResult* out,
30 InstallAttributes::LockResult result) { 30 InstallAttributes::LockResult result) {
31 *out = result; 31 *out = result;
32 loop->Quit(); 32 loop->Quit();
33 } 33 }
34 34
35 } // namespace 35 } // namespace
36 36
37 static const char kTestUser[] = "test@example.com";
38 static const char kTestUserCanonicalize[] = "UPPER.CASE@example.com";
39 static const char kTestDomain[] = "example.com"; 37 static const char kTestDomain[] = "example.com";
38 static const char kTestRealm[] = "realm.example.com";
40 static const char kTestDeviceId[] = "133750519"; 39 static const char kTestDeviceId[] = "133750519";
40 static const char kTestUserDeprecated[] = "test@example.com";
41 41
42 class InstallAttributesTest : public testing::Test { 42 class InstallAttributesTest : public testing::Test {
43 protected: 43 protected:
44 InstallAttributesTest() {} 44 InstallAttributesTest() {}
45 45
46 void SetUp() override { 46 void SetUp() override {
47 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 47 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
48 ASSERT_TRUE(PathService::OverrideAndCreateIfNeeded( 48 ASSERT_TRUE(PathService::OverrideAndCreateIfNeeded(
49 FILE_INSTALL_ATTRIBUTES, GetTempPath(), true, false)); 49 FILE_INSTALL_ATTRIBUTES, GetTempPath(), true, false));
50 DBusThreadManager::Initialize(); 50 DBusThreadManager::Initialize();
(...skipping 16 matching lines...) Expand all
67 attribute = install_attrs_proto->add_attributes(); 67 attribute = install_attrs_proto->add_attributes();
68 attribute->set_name(name); 68 attribute->set_name(name);
69 attribute->set_value(value); 69 attribute->set_value(value);
70 } 70 }
71 71
72 base::MessageLoopForUI message_loop_; 72 base::MessageLoopForUI message_loop_;
73 base::ScopedTempDir temp_dir_; 73 base::ScopedTempDir temp_dir_;
74 std::unique_ptr<InstallAttributes> install_attributes_; 74 std::unique_ptr<InstallAttributes> install_attributes_;
75 75
76 InstallAttributes::LockResult LockDeviceAndWaitForResult( 76 InstallAttributes::LockResult LockDeviceAndWaitForResult(
77 const std::string& user,
78 policy::DeviceMode device_mode, 77 policy::DeviceMode device_mode,
78 const std::string& domain,
79 const std::string& realm,
79 const std::string& device_id) { 80 const std::string& device_id) {
80 base::RunLoop loop; 81 base::RunLoop loop;
81 InstallAttributes::LockResult result; 82 InstallAttributes::LockResult result;
82 install_attributes_->LockDevice( 83 install_attributes_->LockDevice(
83 user,
84 device_mode, 84 device_mode,
85 domain,
86 realm,
85 device_id, 87 device_id,
86 base::Bind(&CopyLockResult, &loop, &result)); 88 base::Bind(&CopyLockResult, &loop, &result));
87 loop.Run(); 89 loop.Run();
88 return result; 90 return result;
89 } 91 }
90 }; 92 };
91 93
92 TEST_F(InstallAttributesTest, Lock) { 94 TEST_F(InstallAttributesTest, Lock) {
93 EXPECT_EQ(InstallAttributes::LOCK_SUCCESS, 95 EXPECT_EQ(InstallAttributes::LOCK_SUCCESS,
94 LockDeviceAndWaitForResult(kTestUser, 96 LockDeviceAndWaitForResult(policy::DEVICE_MODE_ENTERPRISE,
95 policy::DEVICE_MODE_ENTERPRISE, 97 kTestDomain,
98 std::string(), // realm
96 kTestDeviceId)); 99 kTestDeviceId));
97 100
98 // Locking an already locked device should succeed if the parameters match. 101 // Locking an already locked device should succeed if the parameters match.
99 EXPECT_EQ(InstallAttributes::LOCK_SUCCESS, 102 EXPECT_EQ(InstallAttributes::LOCK_SUCCESS,
100 LockDeviceAndWaitForResult(kTestUser, 103 LockDeviceAndWaitForResult(policy::DEVICE_MODE_ENTERPRISE,
101 policy::DEVICE_MODE_ENTERPRISE, 104 kTestDomain,
102 kTestDeviceId)); 105 std::string(), // realm
103
104 // Another user from the same domain should also succeed.
105 EXPECT_EQ(InstallAttributes::LOCK_SUCCESS,
106 LockDeviceAndWaitForResult("test1@example.com",
107 policy::DEVICE_MODE_ENTERPRISE,
108 kTestDeviceId)); 106 kTestDeviceId));
109 107
110 // But another domain should fail. 108 // But another domain should fail.
111 EXPECT_EQ(InstallAttributes::LOCK_WRONG_DOMAIN, 109 EXPECT_EQ(InstallAttributes::LOCK_WRONG_DOMAIN,
112 LockDeviceAndWaitForResult("test@bluebears.com", 110 LockDeviceAndWaitForResult(policy::DEVICE_MODE_ENTERPRISE,
113 policy::DEVICE_MODE_ENTERPRISE, 111 "anotherexample.com",
112 std::string(), // realm
114 kTestDeviceId)); 113 kTestDeviceId));
115 114
116 // A non-matching mode should fail as well. 115 // A non-matching mode should fail as well.
117 EXPECT_EQ(InstallAttributes::LOCK_WRONG_MODE, 116 EXPECT_EQ(InstallAttributes::LOCK_WRONG_MODE,
118 LockDeviceAndWaitForResult(kTestUser, policy::DEVICE_MODE_CONSUMER, 117 LockDeviceAndWaitForResult(
119 kTestDeviceId)); 118 policy::DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH,
119 std::string(), // domain
120 std::string(), // realm
121 std::string())); // device id
120 } 122 }
121 123
122 TEST_F(InstallAttributesTest, LockCanonicalize) { 124 TEST_F(InstallAttributesTest, IsEnterpriseDeviceCloud) {
123 EXPECT_EQ(InstallAttributes::LOCK_SUCCESS,
124 LockDeviceAndWaitForResult(
125 kTestUserCanonicalize,
126 policy::DEVICE_MODE_ENTERPRISE,
127 kTestDeviceId));
128 EXPECT_EQ(gaia::CanonicalizeEmail(kTestUserCanonicalize),
129 install_attributes_->GetRegistrationUser());
130 }
131
132 TEST_F(InstallAttributesTest, IsEnterpriseDevice) {
133 install_attributes_->Init(GetTempPath()); 125 install_attributes_->Init(GetTempPath());
134 EXPECT_FALSE(install_attributes_->IsEnterpriseDevice()); 126 EXPECT_FALSE(install_attributes_->IsEnterpriseDevice());
135 ASSERT_EQ(InstallAttributes::LOCK_SUCCESS, 127 ASSERT_EQ(InstallAttributes::LOCK_SUCCESS,
136 LockDeviceAndWaitForResult( 128 LockDeviceAndWaitForResult(
137 kTestUser,
138 policy::DEVICE_MODE_ENTERPRISE, 129 policy::DEVICE_MODE_ENTERPRISE,
130 kTestDomain,
131 std::string(), // realm
139 kTestDeviceId)); 132 kTestDeviceId));
140 EXPECT_TRUE(install_attributes_->IsEnterpriseDevice()); 133 EXPECT_TRUE(install_attributes_->IsEnterpriseDevice());
141 } 134 }
142 135
143 TEST_F(InstallAttributesTest, GetDomain) { 136 TEST_F(InstallAttributesTest, IsEnterpriseDeviceRealm) {
144 install_attributes_->Init(GetTempPath()); 137 install_attributes_->Init(GetTempPath());
145 EXPECT_EQ(std::string(), install_attributes_->GetDomain()); 138 EXPECT_FALSE(install_attributes_->IsEnterpriseDevice());
146 ASSERT_EQ(InstallAttributes::LOCK_SUCCESS, 139 ASSERT_EQ(InstallAttributes::LOCK_SUCCESS,
147 LockDeviceAndWaitForResult( 140 LockDeviceAndWaitForResult(
148 kTestUser, 141 policy::DEVICE_MODE_ENTERPRISE_AD,
149 policy::DEVICE_MODE_ENTERPRISE, 142 std::string(), // domain
143 kTestRealm,
150 kTestDeviceId)); 144 kTestDeviceId));
151 EXPECT_EQ(kTestDomain, install_attributes_->GetDomain()); 145 EXPECT_TRUE(install_attributes_->IsEnterpriseDevice());
152 } 146 }
153 147
154 TEST_F(InstallAttributesTest, GetRegistrationUser) { 148 TEST_F(InstallAttributesTest, GettersCloud) {
155 install_attributes_->Init(GetTempPath()); 149 install_attributes_->Init(GetTempPath());
156 EXPECT_EQ(std::string(), install_attributes_->GetRegistrationUser()); 150 EXPECT_EQ(policy::DEVICE_MODE_PENDING, install_attributes_->GetMode());
157 ASSERT_EQ(InstallAttributes::LOCK_SUCCESS, 151 EXPECT_EQ(std::string(), install_attributes_->GetDomain());
158 LockDeviceAndWaitForResult( 152 EXPECT_EQ(std::string(), install_attributes_->GetRealm());
159 kTestUser,
160 policy::DEVICE_MODE_ENTERPRISE,
161 kTestDeviceId));
162 EXPECT_EQ(kTestUser, install_attributes_->GetRegistrationUser());
163 }
164
165 TEST_F(InstallAttributesTest, GetDeviceId) {
166 install_attributes_->Init(GetTempPath());
167 EXPECT_EQ(std::string(), install_attributes_->GetDeviceId()); 153 EXPECT_EQ(std::string(), install_attributes_->GetDeviceId());
168 ASSERT_EQ(InstallAttributes::LOCK_SUCCESS, 154 ASSERT_EQ(InstallAttributes::LOCK_SUCCESS,
169 LockDeviceAndWaitForResult( 155 LockDeviceAndWaitForResult(
170 kTestUser,
171 policy::DEVICE_MODE_ENTERPRISE, 156 policy::DEVICE_MODE_ENTERPRISE,
157 kTestDomain,
158 std::string(), // realm
172 kTestDeviceId)); 159 kTestDeviceId));
160 EXPECT_EQ(policy::DEVICE_MODE_ENTERPRISE, install_attributes_->GetMode());
161 EXPECT_EQ(kTestDomain, install_attributes_->GetDomain());
162 EXPECT_EQ(std::string(), install_attributes_->GetRealm());
173 EXPECT_EQ(kTestDeviceId, install_attributes_->GetDeviceId()); 163 EXPECT_EQ(kTestDeviceId, install_attributes_->GetDeviceId());
174 } 164 }
175 165
176 TEST_F(InstallAttributesTest, GetMode) { 166 TEST_F(InstallAttributesTest, GettersAD) {
177 install_attributes_->Init(GetTempPath()); 167 install_attributes_->Init(GetTempPath());
178 EXPECT_EQ(policy::DEVICE_MODE_PENDING, install_attributes_->GetMode()); 168 EXPECT_EQ(policy::DEVICE_MODE_PENDING, install_attributes_->GetMode());
169 EXPECT_EQ(std::string(), install_attributes_->GetDomain());
170 EXPECT_EQ(std::string(), install_attributes_->GetRealm());
171 EXPECT_EQ(std::string(), install_attributes_->GetDeviceId());
179 ASSERT_EQ(InstallAttributes::LOCK_SUCCESS, 172 ASSERT_EQ(InstallAttributes::LOCK_SUCCESS,
180 LockDeviceAndWaitForResult(kTestUser, 173 LockDeviceAndWaitForResult(
181 policy::DEVICE_MODE_ENTERPRISE, 174 policy::DEVICE_MODE_ENTERPRISE_AD,
182 kTestDeviceId)); 175 std::string(), // domain
183 EXPECT_EQ(policy::DEVICE_MODE_ENTERPRISE, install_attributes_->GetMode()); 176 kTestRealm,
177 kTestDeviceId));
178 EXPECT_EQ(policy::DEVICE_MODE_ENTERPRISE_AD, install_attributes_->GetMode());
179 EXPECT_EQ(std::string(), install_attributes_->GetDomain());
180 EXPECT_EQ(kTestRealm, install_attributes_->GetRealm());
181 EXPECT_EQ(kTestDeviceId, install_attributes_->GetDeviceId());
184 } 182 }
185 183
186 TEST_F(InstallAttributesTest, ConsumerDevice) { 184 TEST_F(InstallAttributesTest, ConsumerDevice) {
187 install_attributes_->Init(GetTempPath()); 185 install_attributes_->Init(GetTempPath());
188 EXPECT_EQ(policy::DEVICE_MODE_PENDING, install_attributes_->GetMode()); 186 EXPECT_EQ(policy::DEVICE_MODE_PENDING, install_attributes_->GetMode());
189 // Lock the attributes empty. 187 // Lock the attributes empty.
190 ASSERT_TRUE(cryptohome_util::InstallAttributesFinalize()); 188 ASSERT_TRUE(cryptohome_util::InstallAttributesFinalize());
191 base::RunLoop loop; 189 base::RunLoop loop;
192 install_attributes_->ReadImmutableAttributes(loop.QuitClosure()); 190 install_attributes_->ReadImmutableAttributes(loop.QuitClosure());
193 loop.Run(); 191 loop.Run();
194 192
195 ASSERT_FALSE(cryptohome_util::InstallAttributesIsFirstInstall()); 193 ASSERT_FALSE(cryptohome_util::InstallAttributesIsFirstInstall());
196 EXPECT_EQ(policy::DEVICE_MODE_CONSUMER, install_attributes_->GetMode()); 194 EXPECT_EQ(policy::DEVICE_MODE_CONSUMER, install_attributes_->GetMode());
195 EXPECT_EQ(std::string(), install_attributes_->GetDomain());
196 EXPECT_EQ(std::string(), install_attributes_->GetRealm());
197 EXPECT_EQ(std::string(), install_attributes_->GetDeviceId());
197 } 198 }
198 199
199 TEST_F(InstallAttributesTest, ConsumerKioskDevice) { 200 TEST_F(InstallAttributesTest, ConsumerKioskDevice) {
200 install_attributes_->Init(GetTempPath()); 201 install_attributes_->Init(GetTempPath());
201 EXPECT_EQ(policy::DEVICE_MODE_PENDING, install_attributes_->GetMode()); 202 EXPECT_EQ(policy::DEVICE_MODE_PENDING, install_attributes_->GetMode());
202 // Lock the attributes for consumer kiosk. 203 // Lock the attributes for consumer kiosk.
203 ASSERT_EQ(InstallAttributes::LOCK_SUCCESS, 204 ASSERT_EQ(InstallAttributes::LOCK_SUCCESS,
204 LockDeviceAndWaitForResult( 205 LockDeviceAndWaitForResult(
206 policy::DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH,
205 std::string(), 207 std::string(),
206 policy::DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH, 208 std::string(),
207 std::string())); 209 std::string()));
208 210
209 ASSERT_FALSE(cryptohome_util::InstallAttributesIsFirstInstall()); 211 ASSERT_FALSE(cryptohome_util::InstallAttributesIsFirstInstall());
210 EXPECT_EQ(policy::DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH, 212 EXPECT_EQ(policy::DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH,
211 install_attributes_->GetMode()); 213 install_attributes_->GetMode());
214 EXPECT_EQ(std::string(), install_attributes_->GetDomain());
215 EXPECT_EQ(std::string(), install_attributes_->GetRealm());
216 EXPECT_EQ(std::string(), install_attributes_->GetDeviceId());
212 ASSERT_TRUE(install_attributes_->IsConsumerKioskDeviceWithAutoLaunch()); 217 ASSERT_TRUE(install_attributes_->IsConsumerKioskDeviceWithAutoLaunch());
213 } 218 }
214 219
215 TEST_F(InstallAttributesTest, DeviceLockedFromOlderVersion) { 220 TEST_F(InstallAttributesTest, DeviceLockedFromOlderVersion) {
216 install_attributes_->Init(GetTempPath()); 221 install_attributes_->Init(GetTempPath());
217 EXPECT_EQ(policy::DEVICE_MODE_PENDING, install_attributes_->GetMode()); 222 EXPECT_EQ(policy::DEVICE_MODE_PENDING, install_attributes_->GetMode());
218 // Lock the attributes as if it was done from older Chrome version. 223 // Lock the attributes as if it was done from older Chrome version.
219 ASSERT_TRUE(cryptohome_util::InstallAttributesSet( 224 ASSERT_TRUE(cryptohome_util::InstallAttributesSet(
220 InstallAttributes::kAttrEnterpriseOwned, "true")); 225 InstallAttributes::kAttrEnterpriseOwned, "true"));
221 ASSERT_TRUE(cryptohome_util::InstallAttributesSet( 226 ASSERT_TRUE(cryptohome_util::InstallAttributesSet(
222 InstallAttributes::kAttrEnterpriseUser, kTestUser)); 227 InstallAttributes::kAttrEnterpriseUser, kTestUserDeprecated));
223 ASSERT_TRUE(cryptohome_util::InstallAttributesFinalize()); 228 ASSERT_TRUE(cryptohome_util::InstallAttributesFinalize());
224 base::RunLoop loop; 229 base::RunLoop loop;
225 install_attributes_->ReadImmutableAttributes(loop.QuitClosure()); 230 install_attributes_->ReadImmutableAttributes(loop.QuitClosure());
226 loop.Run(); 231 loop.Run();
227 232
228 ASSERT_FALSE(cryptohome_util::InstallAttributesIsFirstInstall()); 233 ASSERT_FALSE(cryptohome_util::InstallAttributesIsFirstInstall());
229 EXPECT_EQ(policy::DEVICE_MODE_ENTERPRISE, install_attributes_->GetMode()); 234 EXPECT_EQ(policy::DEVICE_MODE_ENTERPRISE, install_attributes_->GetMode());
230 EXPECT_EQ(kTestDomain, install_attributes_->GetDomain()); 235 EXPECT_EQ(kTestDomain, install_attributes_->GetDomain());
231 EXPECT_EQ(kTestUser, install_attributes_->GetRegistrationUser()); 236 EXPECT_EQ(std::string(), install_attributes_->GetRealm());
232 EXPECT_EQ("", install_attributes_->GetDeviceId()); 237 EXPECT_EQ(std::string(), install_attributes_->GetDeviceId());
233 } 238 }
234 239
235 TEST_F(InstallAttributesTest, Init) { 240 TEST_F(InstallAttributesTest, Init) {
236 cryptohome::SerializedInstallAttributes install_attrs_proto; 241 cryptohome::SerializedInstallAttributes install_attrs_proto;
237 SetAttribute(&install_attrs_proto, 242 SetAttribute(&install_attrs_proto,
238 InstallAttributes::kAttrEnterpriseOwned, "true"); 243 InstallAttributes::kAttrEnterpriseOwned, "true");
239 SetAttribute(&install_attrs_proto, 244 SetAttribute(&install_attrs_proto,
240 InstallAttributes::kAttrEnterpriseUser, kTestUser); 245 InstallAttributes::kAttrEnterpriseUser, kTestUserDeprecated);
241 const std::string blob(install_attrs_proto.SerializeAsString()); 246 const std::string blob(install_attrs_proto.SerializeAsString());
242 ASSERT_EQ(static_cast<int>(blob.size()), 247 ASSERT_EQ(static_cast<int>(blob.size()),
243 base::WriteFile(GetTempPath(), blob.c_str(), blob.size())); 248 base::WriteFile(GetTempPath(), blob.c_str(), blob.size()));
244 install_attributes_->Init(GetTempPath()); 249 install_attributes_->Init(GetTempPath());
245 EXPECT_EQ(policy::DEVICE_MODE_ENTERPRISE, install_attributes_->GetMode()); 250 EXPECT_EQ(policy::DEVICE_MODE_ENTERPRISE, install_attributes_->GetMode());
246 EXPECT_EQ(kTestDomain, install_attributes_->GetDomain()); 251 EXPECT_EQ(kTestDomain, install_attributes_->GetDomain());
247 EXPECT_EQ(kTestUser, install_attributes_->GetRegistrationUser()); 252 EXPECT_EQ(std::string(), install_attributes_->GetRealm());
248 EXPECT_EQ("", install_attributes_->GetDeviceId()); 253 EXPECT_EQ(std::string(), install_attributes_->GetDeviceId());
249 } 254 }
250 255
251 TEST_F(InstallAttributesTest, InitForConsumerKiosk) { 256 TEST_F(InstallAttributesTest, InitForConsumerKiosk) {
252 cryptohome::SerializedInstallAttributes install_attrs_proto; 257 cryptohome::SerializedInstallAttributes install_attrs_proto;
253 SetAttribute(&install_attrs_proto, 258 SetAttribute(&install_attrs_proto,
254 InstallAttributes::kAttrConsumerKioskEnabled, "true"); 259 InstallAttributes::kAttrConsumerKioskEnabled, "true");
255 const std::string blob(install_attrs_proto.SerializeAsString()); 260 const std::string blob(install_attrs_proto.SerializeAsString());
256 ASSERT_EQ(static_cast<int>(blob.size()), 261 ASSERT_EQ(static_cast<int>(blob.size()),
257 base::WriteFile(GetTempPath(), blob.c_str(), blob.size())); 262 base::WriteFile(GetTempPath(), blob.c_str(), blob.size()));
258 install_attributes_->Init(GetTempPath()); 263 install_attributes_->Init(GetTempPath());
259 EXPECT_EQ(policy::DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH, 264 EXPECT_EQ(policy::DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH,
260 install_attributes_->GetMode()); 265 install_attributes_->GetMode());
261 EXPECT_EQ("", install_attributes_->GetDomain()); 266 EXPECT_EQ(std::string(), install_attributes_->GetDomain());
262 EXPECT_EQ("", install_attributes_->GetRegistrationUser()); 267 EXPECT_EQ(std::string(), install_attributes_->GetRealm());
263 EXPECT_EQ("", install_attributes_->GetDeviceId()); 268 EXPECT_EQ(std::string(), install_attributes_->GetDeviceId());
264 } 269 }
265 270
266 TEST_F(InstallAttributesTest, VerifyFakeInstallAttributesCache) { 271 TEST_F(InstallAttributesTest, VerifyFakeInstallAttributesCache) {
267 // This test verifies that FakeCryptohomeClient::InstallAttributesFinalize 272 // This test verifies that FakeCryptohomeClient::InstallAttributesFinalize
268 // writes a cache that InstallAttributes::Init accepts. 273 // writes a cache that InstallAttributes::Init accepts.
269 274
270 // Verify that no attributes are initially set. 275 // Verify that no attributes are initially set.
271 install_attributes_->Init(GetTempPath()); 276 install_attributes_->Init(GetTempPath());
272 EXPECT_EQ("", install_attributes_->GetRegistrationUser()); 277 EXPECT_EQ(policy::DEVICE_MODE_PENDING, install_attributes_->GetMode());
273 278
274 // Write test values. 279 // Write test values.
275 ASSERT_TRUE(cryptohome_util::InstallAttributesSet( 280 ASSERT_TRUE(cryptohome_util::InstallAttributesSet(
276 InstallAttributes::kAttrEnterpriseOwned, "true")); 281 InstallAttributes::kAttrEnterpriseOwned, "true"));
277 ASSERT_TRUE(cryptohome_util::InstallAttributesSet( 282 ASSERT_TRUE(cryptohome_util::InstallAttributesSet(
278 InstallAttributes::kAttrEnterpriseUser, kTestUser)); 283 InstallAttributes::kAttrEnterpriseUser, kTestUserDeprecated));
279 ASSERT_TRUE(cryptohome_util::InstallAttributesFinalize()); 284 ASSERT_TRUE(cryptohome_util::InstallAttributesFinalize());
280 285
281 // Verify that InstallAttributes correctly decodes the stub cache file. 286 // Verify that InstallAttributes correctly decodes the stub cache file.
282 install_attributes_->Init(GetTempPath()); 287 install_attributes_->Init(GetTempPath());
283 EXPECT_EQ(kTestUser, install_attributes_->GetRegistrationUser()); 288 EXPECT_EQ(policy::DEVICE_MODE_ENTERPRISE, install_attributes_->GetMode());
289 EXPECT_EQ(kTestDomain, install_attributes_->GetDomain());
290 EXPECT_EQ(std::string(), install_attributes_->GetRealm());
291 EXPECT_EQ(std::string(), install_attributes_->GetDeviceId());
284 } 292 }
285 293
286 } // namespace chromeos 294 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/settings/install_attributes.cc ('k') | chrome/browser/chromeos/settings/stub_install_attributes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698