| Index: chrome/browser/policy/cloud/user_cloud_policy_store_unittest.cc
|
| diff --git a/chrome/browser/policy/cloud/user_cloud_policy_store_unittest.cc b/chrome/browser/policy/cloud/user_cloud_policy_store_unittest.cc
|
| index 2c2876cca0d5a3e2d404e139f68027cea1153705..f31f3b97097cd69d9e0ec0cbacbd955bb55d7ee8 100644
|
| --- a/chrome/browser/policy/cloud/user_cloud_policy_store_unittest.cc
|
| +++ b/chrome/browser/policy/cloud/user_cloud_policy_store_unittest.cc
|
| @@ -13,9 +13,6 @@
|
| #include "chrome/browser/policy/cloud/mock_cloud_external_data_manager.h"
|
| #include "chrome/browser/policy/cloud/mock_cloud_policy_store.h"
|
| #include "chrome/browser/policy/cloud/policy_builder.h"
|
| -#include "chrome/browser/signin/fake_signin_manager.h"
|
| -#include "chrome/browser/signin/signin_manager.h"
|
| -#include "chrome/browser/signin/signin_manager_factory.h"
|
| #include "chrome/common/pref_names.h"
|
| #include "chrome/test/base/testing_profile.h"
|
| #include "net/url_request/url_request_context_getter.h"
|
| @@ -46,16 +43,13 @@ class UserCloudPolicyStoreTest : public testing::Test {
|
|
|
| virtual void SetUp() OVERRIDE {
|
| ASSERT_TRUE(tmp_dir_.CreateUniqueTempDir());
|
| - SigninManager* signin = static_cast<SigninManager*>(
|
| - SigninManagerFactory::GetInstance()->SetTestingFactoryAndUse(
|
| - profile_.get(), FakeSigninManager::Build));
|
| profile_->GetPrefs()->SetString(prefs::kGoogleServicesUsername,
|
| PolicyBuilder::kFakeUsername);
|
| - signin->Initialize(profile_.get(), NULL);
|
| store_.reset(new UserCloudPolicyStore(
|
| profile_.get(), policy_file(), loop_.message_loop_proxy()));
|
| external_data_manager_.reset(new MockCloudExternalDataManager);
|
| external_data_manager_->SetPolicyStore(store_.get());
|
| + store_->SetSigninUsername(PolicyBuilder::kFakeUsername);
|
| store_->AddObserver(&observer_);
|
|
|
| policy_.payload().mutable_passwordmanagerenabled()->set_value(true);
|
| @@ -279,6 +273,7 @@ TEST_F(UserCloudPolicyStoreTest, StoreThenLoad) {
|
| // Now, make sure the policy can be read back in from a second store.
|
| scoped_ptr<UserCloudPolicyStore> store2(new UserCloudPolicyStore(
|
| profile_.get(), policy_file(), loop_.message_loop_proxy()));
|
| + store2->SetSigninUsername(PolicyBuilder::kFakeUsername);
|
| store2->AddObserver(&observer_);
|
| EXPECT_CALL(observer_, OnStoreLoaded(store2.get()));
|
| store2->Load();
|
| @@ -304,6 +299,7 @@ TEST_F(UserCloudPolicyStoreTest, StoreThenLoadImmediately) {
|
| // Now, make sure the policy can be read back in from a second store.
|
| scoped_ptr<UserCloudPolicyStore> store2(new UserCloudPolicyStore(
|
| profile_.get(), policy_file(), loop_.message_loop_proxy()));
|
| + store2->SetSigninUsername(PolicyBuilder::kFakeUsername);
|
| store2->AddObserver(&observer_);
|
| EXPECT_CALL(observer_, OnStoreLoaded(store2.get()));
|
| store2->LoadImmediately(); // Should load without running the message loop.
|
| @@ -338,12 +334,9 @@ TEST_F(UserCloudPolicyStoreTest, LoadValidationError) {
|
|
|
| // Sign out, and sign back in as a different user, and try to load the profile
|
| // data (should fail due to mismatched username).
|
| - SigninManagerFactory::GetForProfile(profile_.get())->SignOut();
|
| - SigninManagerFactory::GetForProfile(profile_.get())->SetAuthenticatedUsername(
|
| - "foobar@foobar.com");
|
| -
|
| scoped_ptr<UserCloudPolicyStore> store2(new UserCloudPolicyStore(
|
| profile_.get(), policy_file(), loop_.message_loop_proxy()));
|
| + store2->SetSigninUsername("foobar@foobar.com");
|
| store2->AddObserver(&observer_);
|
| ExpectError(store2.get(), CloudPolicyStore::STATUS_VALIDATION_ERROR);
|
| store2->Load();
|
| @@ -354,7 +347,6 @@ TEST_F(UserCloudPolicyStoreTest, LoadValidationError) {
|
|
|
| // Sign out - we should be able to load the policy (don't check usernames
|
| // when signed out).
|
| - SigninManagerFactory::GetForProfile(profile_.get())->SignOut();
|
| scoped_ptr<UserCloudPolicyStore> store3(new UserCloudPolicyStore(
|
| profile_.get(), policy_file(), loop_.message_loop_proxy()));
|
| store3->AddObserver(&observer_);
|
| @@ -366,12 +358,9 @@ TEST_F(UserCloudPolicyStoreTest, LoadValidationError) {
|
| store3->RemoveObserver(&observer_);
|
|
|
| // Now start a signin as a different user - this should fail validation.
|
| - FakeSigninManager* signin = static_cast<FakeSigninManager*>(
|
| - SigninManagerFactory::GetForProfile(profile_.get()));
|
| - signin->set_auth_in_progress("foobar@foobar.com");
|
| -
|
| scoped_ptr<UserCloudPolicyStore> store4(new UserCloudPolicyStore(
|
| profile_.get(), policy_file(), loop_.message_loop_proxy()));
|
| + store4->SetSigninUsername("foobar@foobar.com");
|
| store4->AddObserver(&observer_);
|
| ExpectError(store4.get(), CloudPolicyStore::STATUS_VALIDATION_ERROR);
|
| store4->Load();
|
|
|