Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/login/multi_profile_user_controller.h" | 5 #include "chrome/browser/chromeos/login/multi_profile_user_controller.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/chromeos/login/fake_user_manager.h" | 9 #include "chrome/browser/chromeos/login/fake_user_manager.h" |
| 10 #include "chrome/browser/chromeos/login/multi_profile_user_controller_delegate.h " | 10 #include "chrome/browser/chromeos/login/multi_profile_user_controller_delegate.h " |
| 11 #include "chrome/browser/chromeos/login/user_manager.h" | 11 #include "chrome/browser/chromeos/login/user_manager.h" |
| 12 #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h" | |
| 12 #include "chrome/browser/prefs/browser_prefs.h" | 13 #include "chrome/browser/prefs/browser_prefs.h" |
| 13 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
| 14 #include "chrome/test/base/scoped_testing_local_state.h" | 15 #include "chrome/test/base/scoped_testing_local_state.h" |
| 15 #include "chrome/test/base/testing_browser_process.h" | 16 #include "chrome/test/base/testing_browser_process.h" |
| 16 #include "chrome/test/base/testing_pref_service_syncable.h" | 17 #include "chrome/test/base/testing_pref_service_syncable.h" |
| 17 #include "chrome/test/base/testing_profile.h" | 18 #include "chrome/test/base/testing_profile.h" |
| 18 #include "chrome/test/base/testing_profile_manager.h" | 19 #include "chrome/test/base/testing_profile_manager.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 20 | 21 |
| 21 namespace chromeos { | 22 namespace chromeos { |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 256 LoginUser(0); | 257 LoginUser(0); |
| 257 SetOwner(1); | 258 SetOwner(1); |
| 258 | 259 |
| 259 EXPECT_FALSE(controller()->IsUserAllowedInSession(kUsers[1])); | 260 EXPECT_FALSE(controller()->IsUserAllowedInSession(kUsers[1])); |
| 260 | 261 |
| 261 EXPECT_EQ(0, user_not_allowed_count()); | 262 EXPECT_EQ(0, user_not_allowed_count()); |
| 262 LoginUser(1); | 263 LoginUser(1); |
| 263 EXPECT_EQ(1, user_not_allowed_count()); | 264 EXPECT_EQ(1, user_not_allowed_count()); |
| 264 } | 265 } |
| 265 | 266 |
| 267 TEST_F(MultiProfileUserControllerTest, | |
| 268 UsedPolicyCertificatesAllowedForPrimary) { | |
| 269 policy::PolicyCertServiceFactory::SetUsedPolicyCertificates(kUsers[0]); | |
| 270 EXPECT_TRUE(controller()->IsUserAllowedInSession(kUsers[0])); | |
| 271 EXPECT_TRUE(controller()->IsUserAllowedInSession(kUsers[1])); | |
|
Nikita (slow)
2013/12/17 18:42:05
nit: It seems that you're actually checking both u
Joao da Silva
2013/12/17 20:44:21
Yes; this test verifies that both "normal" and "ta
| |
| 272 policy::PolicyCertServiceFactory::ClearUsedPolicyCertificates(kUsers[0]); | |
| 273 } | |
| 274 | |
| 275 TEST_F(MultiProfileUserControllerTest, | |
| 276 UsedPolicyCertificatesDisallowedForSecondary) { | |
| 277 LoginUser(1); | |
| 278 EXPECT_TRUE(controller()->IsUserAllowedInSession(kUsers[0])); | |
| 279 policy::PolicyCertServiceFactory::SetUsedPolicyCertificates(kUsers[0]); | |
| 280 EXPECT_FALSE(controller()->IsUserAllowedInSession(kUsers[0])); | |
| 281 policy::PolicyCertServiceFactory::ClearUsedPolicyCertificates(kUsers[0]); | |
| 282 } | |
| 283 | |
| 266 } // namespace chromeos | 284 } // namespace chromeos |
| OLD | NEW |