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

Unified Diff: chrome/browser/policy/cloud/user_policy_signin_service_unittest.cc

Issue 49783006: policy: Remove SigninManager from UserCloudPolicyStore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 years, 1 month 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/cloud/user_policy_signin_service_unittest.cc
diff --git a/chrome/browser/policy/cloud/user_policy_signin_service_unittest.cc b/chrome/browser/policy/cloud/user_policy_signin_service_unittest.cc
index 14de9106094de7386a624a434a4e92dd8bd85986..22a9e59236eaf901586a32d5643f00d60ac8fdd9 100644
--- a/chrome/browser/policy/cloud/user_policy_signin_service_unittest.cc
+++ b/chrome/browser/policy/cloud/user_policy_signin_service_unittest.cc
@@ -256,7 +256,9 @@ class UserPolicySigninServiceTest : public testing::Test {
.WillOnce(device_management_service_.CreateAsyncJob(&fetch_request));
EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _, _))
.Times(1);
+
signin_service->FetchPolicyForSignedInUser(
+ kTestUser,
created_client_.Pass(),
base::Bind(&UserPolicySigninServiceTest::OnPolicyRefresh,
base::Unretained(this)));
@@ -265,6 +267,7 @@ class UserPolicySigninServiceTest : public testing::Test {
ASSERT_TRUE(fetch_request);
// UserCloudPolicyManager should now be initialized.
+ EXPECT_EQ(mock_store_->signin_username_, kTestUser);
ASSERT_TRUE(manager_->core()->service());
// Make the policy fetch succeed - this should result in a write to the
@@ -359,6 +362,7 @@ TEST_F(UserPolicySigninServiceTest, InitWhileSignedIn) {
GetTokenService()->IssueRefreshToken("oauth_login_refresh_token");
// Client registration should be in progress since we now have an oauth token.
+ EXPECT_EQ(mock_store_->signin_username_, kTestUser);
ASSERT_TRUE(IsRequestActive());
}
@@ -418,6 +422,7 @@ TEST_F(UserPolicySigninServiceTest, SignInAfterInit) {
GetTokenService()->IssueRefreshToken("oauth_login_refresh_token");
// UserCloudPolicyManager should be initialized.
+ EXPECT_EQ(mock_store_->signin_username_, kTestUser);
ASSERT_TRUE(manager_->core()->service());
// Client registration should be in progress since we have an oauth token.
@@ -472,6 +477,7 @@ TEST_F(UserPolicySigninServiceTest, UnregisteredClient) {
GetTokenService()->IssueRefreshToken("oauth_login_refresh_token");
// UserCloudPolicyManager should be initialized.
+ EXPECT_EQ(mock_store_->signin_username_, kTestUser);
ASSERT_TRUE(manager_->core()->service());
// Client registration should not be in progress since the store is not
@@ -505,6 +511,7 @@ TEST_F(UserPolicySigninServiceTest, RegisteredClient) {
GetTokenService()->IssueRefreshToken("oauth_login_refresh_token");
// UserCloudPolicyManager should be initialized.
+ EXPECT_EQ(mock_store_->signin_username_, kTestUser);
ASSERT_TRUE(manager_->core()->service());
// Client registration should not be in progress since the store is not
@@ -529,6 +536,7 @@ TEST_F(UserPolicySigninServiceTest, RegisteredClient) {
TEST_F(UserPolicySigninServiceTest, SignOutAfterInit) {
EXPECT_CALL(*mock_store_, Clear());
+
// Set the user as signed in.
SigninManagerFactory::GetForProfile(profile_.get())->SetAuthenticatedUsername(
kTestUser);
@@ -540,6 +548,7 @@ TEST_F(UserPolicySigninServiceTest, SignOutAfterInit) {
content::NotificationService::NoDetails());
// UserCloudPolicyManager should be initialized.
+ EXPECT_EQ(mock_store_->signin_username_, kTestUser);
ASSERT_TRUE(manager_->core()->service());
// Now sign out.
@@ -700,6 +709,7 @@ TEST_F(UserPolicySigninServiceTest, FetchPolicyFailed) {
UserPolicySigninService* signin_service =
UserPolicySigninServiceFactory::GetForProfile(profile_.get());
signin_service->FetchPolicyForSignedInUser(
+ kTestUser,
client.Pass(),
base::Bind(&UserPolicySigninServiceTest::OnPolicyRefresh,
base::Unretained(this)));
@@ -709,7 +719,9 @@ TEST_F(UserPolicySigninServiceTest, FetchPolicyFailed) {
EXPECT_CALL(*this, OnPolicyRefresh(false)).Times(1);
fetch_request->SendResponse(DM_STATUS_REQUEST_FAILED,
em::DeviceManagementResponse());
+
// UserCloudPolicyManager should be initialized.
+ EXPECT_EQ(mock_store_->signin_username_, kTestUser);
ASSERT_TRUE(manager_->core()->service());
}

Powered by Google App Engine
This is Rietveld 408576698