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

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

Issue 10443125: Allow re-enrollment to the same domain in case of policy data loss. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments. Created 8 years, 6 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/policy/enterprise_install_attributes.h" 5 #include "chrome/browser/policy/enterprise_install_attributes.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "chrome/browser/chromeos/cros/cryptohome_library.h" 8 #include "chrome/browser/chromeos/cros/cryptohome_library.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 21 matching lines...) Expand all
32 install_attributes_.LockDevice( 32 install_attributes_.LockDevice(
33 kTestUser, 33 kTestUser,
34 DEVICE_MODE_ENTERPRISE, 34 DEVICE_MODE_ENTERPRISE,
35 kTestDeviceId)); 35 kTestDeviceId));
36 36
37 EXPECT_EQ(EnterpriseInstallAttributes::LOCK_SUCCESS, 37 EXPECT_EQ(EnterpriseInstallAttributes::LOCK_SUCCESS,
38 install_attributes_.LockDevice( 38 install_attributes_.LockDevice(
39 kTestUser, 39 kTestUser,
40 DEVICE_MODE_ENTERPRISE, 40 DEVICE_MODE_ENTERPRISE,
41 kTestDeviceId)); 41 kTestDeviceId));
42 // Another user from the4 same domain should also succeed.
43 EXPECT_EQ(EnterpriseInstallAttributes::LOCK_SUCCESS,
44 install_attributes_.LockDevice(
45 "test1@example.com",
46 DEVICE_MODE_ENTERPRISE,
47 kTestDeviceId));
48 // But another domain should fail.
42 EXPECT_EQ(EnterpriseInstallAttributes::LOCK_WRONG_USER, 49 EXPECT_EQ(EnterpriseInstallAttributes::LOCK_WRONG_USER,
43 install_attributes_.LockDevice( 50 install_attributes_.LockDevice(
44 "test1@example.com", 51 "test@bluebears.com",
45 DEVICE_MODE_ENTERPRISE, 52 DEVICE_MODE_ENTERPRISE,
46 kTestDeviceId)); 53 kTestDeviceId));
47 } 54 }
48 55
49 TEST_F(EnterpriseInstallAttributesTest, IsEnterpriseDevice) { 56 TEST_F(EnterpriseInstallAttributesTest, IsEnterpriseDevice) {
50 EXPECT_FALSE(install_attributes_.IsEnterpriseDevice()); 57 EXPECT_FALSE(install_attributes_.IsEnterpriseDevice());
51 ASSERT_EQ(EnterpriseInstallAttributes::LOCK_SUCCESS, 58 ASSERT_EQ(EnterpriseInstallAttributes::LOCK_SUCCESS,
52 install_attributes_.LockDevice( 59 install_attributes_.LockDevice(
53 kTestUser, 60 kTestUser,
54 DEVICE_MODE_ENTERPRISE, 61 DEVICE_MODE_ENTERPRISE,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 ASSERT_TRUE(cryptohome_->InstallAttributesFinalize()); 125 ASSERT_TRUE(cryptohome_->InstallAttributesFinalize());
119 ASSERT_FALSE(cryptohome_->InstallAttributesIsFirstInstall()); 126 ASSERT_FALSE(cryptohome_->InstallAttributesIsFirstInstall());
120 EXPECT_EQ(DEVICE_MODE_ENTERPRISE, 127 EXPECT_EQ(DEVICE_MODE_ENTERPRISE,
121 install_attributes_.GetMode()); 128 install_attributes_.GetMode());
122 EXPECT_EQ(kTestDomain, install_attributes_.GetDomain()); 129 EXPECT_EQ(kTestDomain, install_attributes_.GetDomain());
123 EXPECT_EQ(kTestUser, install_attributes_.GetRegistrationUser()); 130 EXPECT_EQ(kTestUser, install_attributes_.GetRegistrationUser());
124 EXPECT_EQ("", install_attributes_.GetDeviceId()); 131 EXPECT_EQ("", install_attributes_.GetDeviceId());
125 } 132 }
126 133
127 } // namespace policy 134 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/enterprise_install_attributes.cc ('k') | chrome/browser/policy/enterprise_metrics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698