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

Side by Side Diff: chrome/browser/chromeos/policy/enterprise_install_attributes_unittest.cc

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
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/policy/enterprise_install_attributes.h" 5 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 } 227 }
228 228
229 TEST_F(EnterpriseInstallAttributesTest, ReadCacheFile) { 229 TEST_F(EnterpriseInstallAttributesTest, ReadCacheFile) {
230 cryptohome::SerializedInstallAttributes install_attrs_proto; 230 cryptohome::SerializedInstallAttributes install_attrs_proto;
231 SetAttribute(&install_attrs_proto, 231 SetAttribute(&install_attrs_proto,
232 EnterpriseInstallAttributes::kAttrEnterpriseOwned, "true"); 232 EnterpriseInstallAttributes::kAttrEnterpriseOwned, "true");
233 SetAttribute(&install_attrs_proto, 233 SetAttribute(&install_attrs_proto,
234 EnterpriseInstallAttributes::kAttrEnterpriseUser, kTestUser); 234 EnterpriseInstallAttributes::kAttrEnterpriseUser, kTestUser);
235 const std::string blob(install_attrs_proto.SerializeAsString()); 235 const std::string blob(install_attrs_proto.SerializeAsString());
236 ASSERT_EQ(static_cast<int>(blob.size()), 236 ASSERT_EQ(static_cast<int>(blob.size()),
237 file_util::WriteFile(GetTempPath(), blob.c_str(), blob.size())); 237 base::WriteFile(GetTempPath(), blob.c_str(), blob.size()));
238 install_attributes_.ReadCacheFile(GetTempPath()); 238 install_attributes_.ReadCacheFile(GetTempPath());
239 EXPECT_EQ(DEVICE_MODE_ENTERPRISE, install_attributes_.GetMode()); 239 EXPECT_EQ(DEVICE_MODE_ENTERPRISE, install_attributes_.GetMode());
240 EXPECT_EQ(kTestDomain, install_attributes_.GetDomain()); 240 EXPECT_EQ(kTestDomain, install_attributes_.GetDomain());
241 EXPECT_EQ(kTestUser, install_attributes_.GetRegistrationUser()); 241 EXPECT_EQ(kTestUser, install_attributes_.GetRegistrationUser());
242 EXPECT_EQ("", install_attributes_.GetDeviceId()); 242 EXPECT_EQ("", install_attributes_.GetDeviceId());
243 } 243 }
244 244
245 TEST_F(EnterpriseInstallAttributesTest, ReadCacheFileForConsumerKiosk) { 245 TEST_F(EnterpriseInstallAttributesTest, ReadCacheFileForConsumerKiosk) {
246 cryptohome::SerializedInstallAttributes install_attrs_proto; 246 cryptohome::SerializedInstallAttributes install_attrs_proto;
247 SetAttribute(&install_attrs_proto, 247 SetAttribute(&install_attrs_proto,
248 EnterpriseInstallAttributes::kAttrConsumerKioskEnabled, "true"); 248 EnterpriseInstallAttributes::kAttrConsumerKioskEnabled, "true");
249 const std::string blob(install_attrs_proto.SerializeAsString()); 249 const std::string blob(install_attrs_proto.SerializeAsString());
250 ASSERT_EQ(static_cast<int>(blob.size()), 250 ASSERT_EQ(static_cast<int>(blob.size()),
251 file_util::WriteFile(GetTempPath(), blob.c_str(), blob.size())); 251 base::WriteFile(GetTempPath(), blob.c_str(), blob.size()));
252 install_attributes_.ReadCacheFile(GetTempPath()); 252 install_attributes_.ReadCacheFile(GetTempPath());
253 EXPECT_EQ(DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH, 253 EXPECT_EQ(DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH,
254 install_attributes_.GetMode()); 254 install_attributes_.GetMode());
255 EXPECT_EQ("", install_attributes_.GetDomain()); 255 EXPECT_EQ("", install_attributes_.GetDomain());
256 EXPECT_EQ("", install_attributes_.GetRegistrationUser()); 256 EXPECT_EQ("", install_attributes_.GetRegistrationUser());
257 EXPECT_EQ("", install_attributes_.GetDeviceId()); 257 EXPECT_EQ("", install_attributes_.GetDeviceId());
258 } 258 }
259 259
260 } // namespace policy 260 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698