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

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

Issue 2486813002: Add DeviceADPolicyManager to provide AD policy. (Closed)
Patch Set: Address Bernhard's comments Created 4 years, 1 month 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 114
115 // A non-matching mode should fail as well. 115 // A non-matching mode should fail as well.
116 EXPECT_EQ(InstallAttributes::LOCK_WRONG_MODE, 116 EXPECT_EQ(InstallAttributes::LOCK_WRONG_MODE,
117 LockDeviceAndWaitForResult( 117 LockDeviceAndWaitForResult(
118 policy::DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH, 118 policy::DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH,
119 std::string(), // domain 119 std::string(), // domain
120 std::string(), // realm 120 std::string(), // realm
121 std::string())); // device id 121 std::string())); // device id
122 } 122 }
123 123
124 TEST_F(InstallAttributesTest, IsEnterpriseDeviceCloud) { 124 TEST_F(InstallAttributesTest, IsEnterpriseManagedCloud) {
125 install_attributes_->Init(GetTempPath()); 125 install_attributes_->Init(GetTempPath());
126 EXPECT_FALSE(install_attributes_->IsEnterpriseDevice()); 126 EXPECT_FALSE(install_attributes_->IsEnterpriseManaged());
127 ASSERT_EQ(InstallAttributes::LOCK_SUCCESS, 127 ASSERT_EQ(InstallAttributes::LOCK_SUCCESS,
128 LockDeviceAndWaitForResult( 128 LockDeviceAndWaitForResult(
129 policy::DEVICE_MODE_ENTERPRISE, 129 policy::DEVICE_MODE_ENTERPRISE,
130 kTestDomain, 130 kTestDomain,
131 std::string(), // realm 131 std::string(), // realm
132 kTestDeviceId)); 132 kTestDeviceId));
133 EXPECT_TRUE(install_attributes_->IsEnterpriseDevice()); 133 EXPECT_TRUE(install_attributes_->IsEnterpriseManaged());
134 EXPECT_TRUE(install_attributes_->IsCloudManaged());
135 EXPECT_FALSE(install_attributes_->IsActiveDirectoryManaged());
134 } 136 }
135 137
136 TEST_F(InstallAttributesTest, IsEnterpriseDeviceRealm) { 138 TEST_F(InstallAttributesTest, IsEnterpriseManagedRealm) {
137 install_attributes_->Init(GetTempPath()); 139 install_attributes_->Init(GetTempPath());
138 EXPECT_FALSE(install_attributes_->IsEnterpriseDevice()); 140 EXPECT_FALSE(install_attributes_->IsEnterpriseManaged());
139 ASSERT_EQ(InstallAttributes::LOCK_SUCCESS, 141 ASSERT_EQ(InstallAttributes::LOCK_SUCCESS,
140 LockDeviceAndWaitForResult( 142 LockDeviceAndWaitForResult(
141 policy::DEVICE_MODE_ENTERPRISE_AD, 143 policy::DEVICE_MODE_ENTERPRISE_AD,
142 std::string(), // domain 144 std::string(), // domain
143 kTestRealm, 145 kTestRealm,
144 kTestDeviceId)); 146 kTestDeviceId));
145 EXPECT_TRUE(install_attributes_->IsEnterpriseDevice()); 147 EXPECT_TRUE(install_attributes_->IsEnterpriseManaged());
148 EXPECT_FALSE(install_attributes_->IsCloudManaged());
149 EXPECT_TRUE(install_attributes_->IsActiveDirectoryManaged());
146 } 150 }
147 151
148 TEST_F(InstallAttributesTest, GettersCloud) { 152 TEST_F(InstallAttributesTest, GettersCloud) {
149 install_attributes_->Init(GetTempPath()); 153 install_attributes_->Init(GetTempPath());
150 EXPECT_EQ(policy::DEVICE_MODE_PENDING, install_attributes_->GetMode()); 154 EXPECT_EQ(policy::DEVICE_MODE_PENDING, install_attributes_->GetMode());
151 EXPECT_EQ(std::string(), install_attributes_->GetDomain()); 155 EXPECT_EQ(std::string(), install_attributes_->GetDomain());
152 EXPECT_EQ(std::string(), install_attributes_->GetRealm()); 156 EXPECT_EQ(std::string(), install_attributes_->GetRealm());
153 EXPECT_EQ(std::string(), install_attributes_->GetDeviceId()); 157 EXPECT_EQ(std::string(), install_attributes_->GetDeviceId());
154 ASSERT_EQ(InstallAttributes::LOCK_SUCCESS, 158 ASSERT_EQ(InstallAttributes::LOCK_SUCCESS,
155 LockDeviceAndWaitForResult( 159 LockDeviceAndWaitForResult(
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 289
286 // Verify that InstallAttributes correctly decodes the stub cache file. 290 // Verify that InstallAttributes correctly decodes the stub cache file.
287 install_attributes_->Init(GetTempPath()); 291 install_attributes_->Init(GetTempPath());
288 EXPECT_EQ(policy::DEVICE_MODE_ENTERPRISE, install_attributes_->GetMode()); 292 EXPECT_EQ(policy::DEVICE_MODE_ENTERPRISE, install_attributes_->GetMode());
289 EXPECT_EQ(kTestDomain, install_attributes_->GetDomain()); 293 EXPECT_EQ(kTestDomain, install_attributes_->GetDomain());
290 EXPECT_EQ(std::string(), install_attributes_->GetRealm()); 294 EXPECT_EQ(std::string(), install_attributes_->GetRealm());
291 EXPECT_EQ(std::string(), install_attributes_->GetDeviceId()); 295 EXPECT_EQ(std::string(), install_attributes_->GetDeviceId());
292 } 296 }
293 297
294 } // namespace chromeos 298 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698