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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/enterprise_install_attributes_unittest.cc
diff --git a/chrome/browser/policy/enterprise_install_attributes_unittest.cc b/chrome/browser/policy/enterprise_install_attributes_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9d69924dc0f0e81ed2b4f446c5a1a919ddc3e3f2
--- /dev/null
+++ b/chrome/browser/policy/enterprise_install_attributes_unittest.cc
@@ -0,0 +1,55 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/policy/enterprise_install_attributes.h"
+
+#include "chrome/browser/chromeos/cros/cryptohome_library.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace policy {
+
+static const char kTestUser[] = "test@example.com";
+
+class EnterpriseInstallAttributesTest : public testing::Test {
+ protected:
+ EnterpriseInstallAttributesTest()
+ : cryptohome_(chromeos::CryptohomeLibrary::GetImpl(true)),
+ install_attributes_(cryptohome_.get()) {}
+
+ scoped_ptr<chromeos::CryptohomeLibrary> cryptohome_;
+ EnterpriseInstallAttributes install_attributes_;
+};
+
+TEST_F(EnterpriseInstallAttributesTest, Lock) {
+ EXPECT_EQ(EnterpriseInstallAttributes::LOCK_SUCCESS,
+ install_attributes_.LockDevice(kTestUser));
+
+ EXPECT_EQ(EnterpriseInstallAttributes::LOCK_SUCCESS,
+ install_attributes_.LockDevice(kTestUser));
+ EXPECT_EQ(EnterpriseInstallAttributes::LOCK_WRONG_USER,
+ install_attributes_.LockDevice("test1@example.com"));
+}
+
+TEST_F(EnterpriseInstallAttributesTest, IsEnterpriseDevice) {
+ EXPECT_FALSE(install_attributes_.IsEnterpriseDevice());
+ ASSERT_EQ(EnterpriseInstallAttributes::LOCK_SUCCESS,
+ install_attributes_.LockDevice(kTestUser));
+ EXPECT_TRUE(install_attributes_.IsEnterpriseDevice());
+}
+
+TEST_F(EnterpriseInstallAttributesTest, GetDomain) {
+ EXPECT_EQ(std::string(), install_attributes_.GetDomain());
+ ASSERT_EQ(EnterpriseInstallAttributes::LOCK_SUCCESS,
+ install_attributes_.LockDevice(kTestUser));
+ EXPECT_EQ("example.com", install_attributes_.GetDomain());
+}
+
+TEST_F(EnterpriseInstallAttributesTest, GetRegistrationUser) {
+ EXPECT_EQ(std::string(), install_attributes_.GetRegistrationUser());
+ ASSERT_EQ(EnterpriseInstallAttributes::LOCK_SUCCESS,
+ install_attributes_.LockDevice(kTestUser));
+ EXPECT_EQ(kTestUser, install_attributes_.GetRegistrationUser());
+}
+
+} // namespace policy
« 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