Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
|
Pam (message me for reviews)
2013/01/14 14:12:42
Hum de dum.
| |
| 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/managed_mode/managed_user_service.h" | |
| 6 #include "chrome/browser/prefs/pref_service.h" | |
| 7 #include "chrome/browser/profiles/profile.h" | |
| 8 #include "chrome/common/pref_names.h" | |
| 9 #include "chrome/test/base/testing_profile.h" | |
| 10 #include "testing/gtest/include/gtest/gtest.h" | |
| 11 | |
| 12 TEST(ManagedUserServiceTest, ExtensionManagementPolicyProvider) { | |
| 13 TestingProfile profile; | |
| 14 { | |
| 15 ManagedUserService managed_user_service(&profile); | |
| 16 EXPECT_FALSE(managed_user_service.ProfileIsManaged()); | |
| 17 | |
| 18 string16 error_1; | |
| 19 EXPECT_TRUE(managed_user_service.UserMayLoad(NULL, &error_1)); | |
| 20 EXPECT_EQ(string16(), error_1); | |
| 21 | |
| 22 string16 error_2; | |
| 23 EXPECT_TRUE(managed_user_service.UserMayModifySettings(NULL, &error_2)); | |
| 24 EXPECT_EQ(string16(), error_2); | |
| 25 } | |
| 26 | |
| 27 profile.GetPrefs()->SetBoolean(prefs::kProfileIsManaged, true); | |
| 28 { | |
| 29 ManagedUserService managed_user_service(&profile); | |
| 30 EXPECT_TRUE(managed_user_service.ProfileIsManaged()); | |
| 31 | |
| 32 string16 error_1; | |
| 33 EXPECT_FALSE(managed_user_service.UserMayLoad(NULL, &error_1)); | |
| 34 EXPECT_FALSE(error_1.empty()); | |
| 35 | |
| 36 string16 error_2; | |
| 37 EXPECT_FALSE(managed_user_service.UserMayModifySettings(NULL, &error_2)); | |
| 38 EXPECT_FALSE(error_2.empty()); | |
| 39 | |
| 40 #ifndef NDEBUG | |
| 41 EXPECT_FALSE(managed_user_service.GetDebugPolicyProviderName().empty()); | |
| 42 #endif | |
| 43 } | |
| 44 } | |
| OLD | NEW |