| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/users/multi_profile_user_controller.h" | 5 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" | 10 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 MultiProfileUserController::kBehaviorNotAllowed, | 93 MultiProfileUserController::kBehaviorNotAllowed, |
| 94 MultiProfileUserController::NOT_ALLOWED_PRIMARY_USER_POLICY_FORBIDS, | 94 MultiProfileUserController::NOT_ALLOWED_PRIMARY_USER_POLICY_FORBIDS, |
| 95 MultiProfileUserController::NOT_ALLOWED_PRIMARY_USER_POLICY_FORBIDS, | 95 MultiProfileUserController::NOT_ALLOWED_PRIMARY_USER_POLICY_FORBIDS, |
| 96 }, | 96 }, |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 // Weak ptr to PolicyCertVerifier - object is freed in test destructor once | 99 // Weak ptr to PolicyCertVerifier - object is freed in test destructor once |
| 100 // we've ensured the profile has been shut down. | 100 // we've ensured the profile has been shut down. |
| 101 policy::PolicyCertVerifier* g_policy_cert_verifier_for_factory = NULL; | 101 policy::PolicyCertVerifier* g_policy_cert_verifier_for_factory = NULL; |
| 102 | 102 |
| 103 KeyedService* TestPolicyCertServiceFactory(content::BrowserContext* context) { | 103 scoped_ptr<KeyedService> TestPolicyCertServiceFactory( |
| 104 content::BrowserContext* context) { |
| 104 return policy::PolicyCertService::CreateForTesting( | 105 return policy::PolicyCertService::CreateForTesting( |
| 105 kUsers[0], | 106 kUsers[0], g_policy_cert_verifier_for_factory, |
| 106 g_policy_cert_verifier_for_factory, | 107 user_manager::UserManager::Get()); |
| 107 user_manager::UserManager::Get()).release(); | |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace | 110 } // namespace |
| 111 | 111 |
| 112 class MultiProfileUserControllerTest | 112 class MultiProfileUserControllerTest |
| 113 : public testing::Test, | 113 : public testing::Test, |
| 114 public MultiProfileUserControllerDelegate { | 114 public MultiProfileUserControllerDelegate { |
| 115 public: | 115 public: |
| 116 MultiProfileUserControllerTest() | 116 MultiProfileUserControllerTest() |
| 117 : fake_user_manager_(new FakeChromeUserManager), | 117 : fake_user_manager_(new FakeChromeUserManager), |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 EXPECT_EQ(MultiProfileUserController::NOT_ALLOWED_PRIMARY_POLICY_CERT_TAINTED, | 421 EXPECT_EQ(MultiProfileUserController::NOT_ALLOWED_PRIMARY_POLICY_CERT_TAINTED, |
| 422 reason); | 422 reason); |
| 423 EXPECT_EQ(MultiProfileUserController::NOT_ALLOWED_PRIMARY_POLICY_CERT_TAINTED, | 423 EXPECT_EQ(MultiProfileUserController::NOT_ALLOWED_PRIMARY_POLICY_CERT_TAINTED, |
| 424 MultiProfileUserController::GetPrimaryUserPolicy()); | 424 MultiProfileUserController::GetPrimaryUserPolicy()); |
| 425 | 425 |
| 426 // Flush tasks posted to IO. | 426 // Flush tasks posted to IO. |
| 427 base::RunLoop().RunUntilIdle(); | 427 base::RunLoop().RunUntilIdle(); |
| 428 } | 428 } |
| 429 | 429 |
| 430 } // namespace chromeos | 430 } // namespace chromeos |
| OLD | NEW |