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

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

Issue 6869042: Add immutable settings checks when handling policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, address comments Created 9 years, 8 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
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/policy/enterprise_install_attributes.h"
6
7 #include "chrome/browser/chromeos/cros/cryptohome_library.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9
10 namespace policy {
11
12 static const char kTestUser[] = "test@example.com";
13
14 class EnterpriseInstallAttributesTest : public testing::Test {
15 protected:
16 EnterpriseInstallAttributesTest()
17 : cryptohome_(chromeos::CryptohomeLibrary::GetImpl(true)),
18 install_attributes_(cryptohome_.get()) {}
19
20 scoped_ptr<chromeos::CryptohomeLibrary> cryptohome_;
21 EnterpriseInstallAttributes install_attributes_;
22 };
23
24 TEST_F(EnterpriseInstallAttributesTest, Lock) {
25 EXPECT_EQ(EnterpriseInstallAttributes::LOCK_SUCCESS,
26 install_attributes_.LockDevice(kTestUser));
27
28 EXPECT_EQ(EnterpriseInstallAttributes::LOCK_SUCCESS,
29 install_attributes_.LockDevice(kTestUser));
30 EXPECT_EQ(EnterpriseInstallAttributes::LOCK_WRONG_USER,
31 install_attributes_.LockDevice("test1@example.com"));
32 }
33
34 TEST_F(EnterpriseInstallAttributesTest, IsEnterpriseDevice) {
35 EXPECT_FALSE(install_attributes_.IsEnterpriseDevice());
36 ASSERT_EQ(EnterpriseInstallAttributes::LOCK_SUCCESS,
37 install_attributes_.LockDevice(kTestUser));
38 EXPECT_TRUE(install_attributes_.IsEnterpriseDevice());
39 }
40
41 TEST_F(EnterpriseInstallAttributesTest, GetDomain) {
42 EXPECT_EQ(std::string(), install_attributes_.GetDomain());
43 ASSERT_EQ(EnterpriseInstallAttributes::LOCK_SUCCESS,
44 install_attributes_.LockDevice(kTestUser));
45 EXPECT_EQ("example.com", install_attributes_.GetDomain());
46 }
47
48 TEST_F(EnterpriseInstallAttributesTest, GetRegistrationUser) {
49 EXPECT_EQ(std::string(), install_attributes_.GetRegistrationUser());
50 ASSERT_EQ(EnterpriseInstallAttributes::LOCK_SUCCESS,
51 install_attributes_.LockDevice(kTestUser));
52 EXPECT_EQ(kTestUser, install_attributes_.GetRegistrationUser());
53 }
54
55 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/enterprise_install_attributes.cc ('k') | chrome/browser/policy/proto/device_management_backend.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698