| Index: chrome/browser/signin/account_reconcilor_unittest.cc
|
| diff --git a/chrome/browser/signin/account_reconcilor_unittest.cc b/chrome/browser/signin/account_reconcilor_unittest.cc
|
| index e1a5af9e37e39c3f9320c9390d106d0bb623979b..0bb444c66f077152151f595145d5192d02585d00 100644
|
| --- a/chrome/browser/signin/account_reconcilor_unittest.cc
|
| +++ b/chrome/browser/signin/account_reconcilor_unittest.cc
|
| @@ -51,16 +51,6 @@ class MockAccountReconcilor : public testing::StrictMock<AccountReconcilor> {
|
| }
|
|
|
| MOCK_METHOD1(PerformMergeAction, void(const std::string& account_id));
|
| - MOCK_METHOD1(PerformStartRemoveAction, void(const std::string& account_id));
|
| - MOCK_METHOD3(
|
| - PerformFinishRemoveAction,
|
| - void(const std::string& account_id,
|
| - const GoogleServiceAuthError& error,
|
| - const std::vector<std::pair<std::string, bool> >& accounts));
|
| - MOCK_METHOD3(PerformAddToChromeAction,
|
| - void(const std::string& account_id,
|
| - int session_index,
|
| - const std::string& signin_scoped_device_id));
|
| MOCK_METHOD0(PerformLogoutAllAccountsAction, void());
|
| };
|
|
|
| @@ -109,11 +99,6 @@ class AccountReconcilorTest : public ::testing::TestWithParam<bool> {
|
| const std::string& account_id,
|
| const GoogleServiceAuthError& error);
|
|
|
| - void SimulateRefreshTokenFetched(
|
| - AccountReconcilor* reconcilor,
|
| - const std::string& account_id,
|
| - const std::string& refresh_token);
|
| -
|
| private:
|
| content::TestBrowserThreadBundle bundle_;
|
| TestingProfile* profile_;
|
| @@ -187,13 +172,6 @@ void AccountReconcilorTest::SimulateMergeSessionCompleted(
|
| observer->MergeSessionCompleted(account_id, error);
|
| }
|
|
|
| -void AccountReconcilorTest::SimulateRefreshTokenFetched(
|
| - AccountReconcilor* reconcilor,
|
| - const std::string& account_id,
|
| - const std::string& refresh_token) {
|
| - reconcilor->HandleRefreshTokenFetched(account_id, refresh_token);
|
| -}
|
| -
|
| TEST_F(AccountReconcilorTest, Basic) {
|
| AccountReconcilor* reconcilor =
|
| AccountReconcilorFactory::GetForProfile(profile());
|
| @@ -255,6 +233,7 @@ TEST_F(AccountReconcilorTest, ProfileAlreadyConnected) {
|
| TEST_F(AccountReconcilorTest, GetAccountsFromCookieSuccess) {
|
| signin_manager()->SetAuthenticatedUsername(kTestEmail);
|
| token_service()->UpdateCredentials(kTestEmail, "refresh_token");
|
| + EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction(kTestEmail));
|
| AccountReconcilor* reconcilor =
|
| AccountReconcilorFactory::GetForProfile(profile());
|
| ASSERT_TRUE(reconcilor);
|
| @@ -288,71 +267,7 @@ TEST_F(AccountReconcilorTest, GetAccountsFromCookieFailure) {
|
| ASSERT_FALSE(reconcilor->AreGaiaAccountsSet());
|
|
|
| base::RunLoop().RunUntilIdle();
|
| - ASSERT_EQ(0u, reconcilor->GetGaiaAccountsForTesting().size());
|
| -}
|
| -
|
| -TEST_F(AccountReconcilorTest, ValidateAccountsFromTokens) {
|
| - signin_manager()->SetAuthenticatedUsername(kTestEmail);
|
| - token_service()->UpdateCredentials(kTestEmail, "refresh_token");
|
| -
|
| - AccountReconcilor* reconcilor =
|
| - AccountReconcilorFactory::GetForProfile(profile());
|
| - ASSERT_TRUE(reconcilor);
|
| -
|
| - reconcilor->ValidateAccountsFromTokenService();
|
| - ASSERT_FALSE(reconcilor->AreAllRefreshTokensChecked());
|
| -
|
| - SetFakeResponse("https://www.googleapis.com/oauth2/v1/userinfo",
|
| - "{\"id\":\"foo\"}", net::HTTP_OK, net::URLRequestStatus::SUCCESS);
|
| - token_service()->IssueTokenForAllPendingRequests("access_token",
|
| - base::Time::Now() + base::TimeDelta::FromHours(1));
|
| -
|
| - base::RunLoop().RunUntilIdle();
|
| - ASSERT_TRUE(reconcilor->AreAllRefreshTokensChecked());
|
| - ASSERT_EQ(1u, reconcilor->GetValidChromeAccountsForTesting().size());
|
| - ASSERT_EQ(0u, reconcilor->GetInvalidChromeAccountsForTesting().size());
|
| -}
|
| -
|
| -TEST_F(AccountReconcilorTest, ValidateAccountsFromTokensFailedUserInfo) {
|
| - signin_manager()->SetAuthenticatedUsername(kTestEmail);
|
| - token_service()->UpdateCredentials(kTestEmail, "refresh_token");
|
| -
|
| - AccountReconcilor* reconcilor =
|
| - AccountReconcilorFactory::GetForProfile(profile());
|
| - ASSERT_TRUE(reconcilor);
|
| -
|
| - reconcilor->ValidateAccountsFromTokenService();
|
| - ASSERT_FALSE(reconcilor->AreAllRefreshTokensChecked());
|
| -
|
| - SetFakeResponse("https://www.googleapis.com/oauth2/v1/userinfo",
|
| - "", net::HTTP_NOT_FOUND, net::URLRequestStatus::SUCCESS);
|
| - token_service()->IssueTokenForAllPendingRequests("access_token",
|
| - base::Time::Now() + base::TimeDelta::FromHours(1));
|
| -
|
| - base::RunLoop().RunUntilIdle();
|
| - ASSERT_TRUE(reconcilor->AreAllRefreshTokensChecked());
|
| - ASSERT_EQ(0u, reconcilor->GetValidChromeAccountsForTesting().size());
|
| - ASSERT_EQ(1u, reconcilor->GetInvalidChromeAccountsForTesting().size());
|
| -}
|
| -
|
| -TEST_F(AccountReconcilorTest, ValidateAccountsFromTokensFailedTokenRequest) {
|
| - signin_manager()->SetAuthenticatedUsername(kTestEmail);
|
| - token_service()->UpdateCredentials(kTestEmail, "refresh_token");
|
| -
|
| - AccountReconcilor* reconcilor =
|
| - AccountReconcilorFactory::GetForProfile(profile());
|
| - ASSERT_TRUE(reconcilor);
|
| -
|
| - reconcilor->ValidateAccountsFromTokenService();
|
| - ASSERT_FALSE(reconcilor->AreAllRefreshTokensChecked());
|
| -
|
| - token_service()->IssueErrorForAllPendingRequests(
|
| - GoogleServiceAuthError(GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS));
|
| -
|
| - base::RunLoop().RunUntilIdle();
|
| - ASSERT_TRUE(reconcilor->AreAllRefreshTokensChecked());
|
| - ASSERT_EQ(0u, reconcilor->GetValidChromeAccountsForTesting().size());
|
| - ASSERT_EQ(1u, reconcilor->GetInvalidChromeAccountsForTesting().size());
|
| + ASSERT_FALSE(reconcilor->AreGaiaAccountsSet());
|
| }
|
|
|
| TEST_P(AccountReconcilorTest, StartReconcileNoop) {
|
| @@ -366,23 +281,12 @@ TEST_P(AccountReconcilorTest, StartReconcileNoop) {
|
| SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(),
|
| "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]",
|
| net::HTTP_OK, net::URLRequestStatus::SUCCESS);
|
| - SetFakeResponse("https://www.googleapis.com/oauth2/v1/userinfo",
|
| - "{\"id\":\"foo\"}", net::HTTP_OK, net::URLRequestStatus::SUCCESS);
|
|
|
| reconcilor->StartReconcile();
|
| + ASSERT_TRUE(reconcilor->is_reconcile_started_);
|
| ASSERT_FALSE(reconcilor->AreGaiaAccountsSet());
|
| - ASSERT_FALSE(reconcilor->AreAllRefreshTokensChecked());
|
|
|
| base::RunLoop().RunUntilIdle();
|
| - ASSERT_TRUE(reconcilor->AreGaiaAccountsSet());
|
| - ASSERT_EQ(1u, reconcilor->GetGaiaAccountsForTesting().size());
|
| - ASSERT_FALSE(reconcilor->AreAllRefreshTokensChecked());
|
| -
|
| - token_service()->IssueAllTokensForAccount("user@gmail.com", "access_token",
|
| - base::Time::Now() + base::TimeDelta::FromHours(1));
|
| -
|
| - base::RunLoop().RunUntilIdle();
|
| - ASSERT_TRUE(reconcilor->AreAllRefreshTokensChecked());
|
| ASSERT_FALSE(reconcilor->is_reconcile_started_);
|
|
|
| histogram_tester()->ExpectTotalCount(
|
| @@ -412,25 +316,11 @@ TEST_P(AccountReconcilorTest, StartReconcileNoopWithDots) {
|
| SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(),
|
| "[\"f\", [[\"b\", 0, \"n\", \"dot.s@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]",
|
| net::HTTP_OK, net::URLRequestStatus::SUCCESS);
|
| - SetFakeResponse("https://www.googleapis.com/oauth2/v1/userinfo",
|
| - "{\"id\":\"foo\"}", net::HTTP_OK, net::URLRequestStatus::SUCCESS);
|
|
|
| reconcilor->StartReconcile();
|
| ASSERT_FALSE(reconcilor->AreGaiaAccountsSet());
|
| - ASSERT_FALSE(reconcilor->AreAllRefreshTokensChecked());
|
|
|
| base::RunLoop().RunUntilIdle();
|
| - ASSERT_TRUE(reconcilor->AreGaiaAccountsSet());
|
| - ASSERT_EQ(1u, reconcilor->GetGaiaAccountsForTesting().size());
|
| - ASSERT_STREQ("dots@gmail.com",
|
| - reconcilor->GetGaiaAccountsForTesting()[0].first.c_str());
|
| - ASSERT_FALSE(reconcilor->AreAllRefreshTokensChecked());
|
| -
|
| - token_service()->IssueAllTokensForAccount("Dot.S@gmail.com", "access_token",
|
| - base::Time::Now() + base::TimeDelta::FromHours(1));
|
| -
|
| - base::RunLoop().RunUntilIdle();
|
| - ASSERT_TRUE(reconcilor->AreAllRefreshTokensChecked());
|
| ASSERT_FALSE(reconcilor->is_reconcile_started_);
|
|
|
| histogram_tester()->ExpectUniqueSample(
|
| @@ -452,29 +342,10 @@ TEST_P(AccountReconcilorTest, StartReconcileNoopMultiple) {
|
| "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1], "
|
| "[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]",
|
| net::HTTP_OK, net::URLRequestStatus::SUCCESS);
|
| - SetFakeResponse("https://www.googleapis.com/oauth2/v1/userinfo",
|
| - "{\"id\":\"foo\"}", net::HTTP_OK, net::URLRequestStatus::SUCCESS);
|
|
|
| reconcilor->StartReconcile();
|
| ASSERT_FALSE(reconcilor->AreGaiaAccountsSet());
|
| - ASSERT_FALSE(reconcilor->AreAllRefreshTokensChecked());
|
| -
|
| - base::RunLoop().RunUntilIdle();
|
| - ASSERT_TRUE(reconcilor->AreGaiaAccountsSet());
|
| - ASSERT_FALSE(reconcilor->AreAllRefreshTokensChecked());
|
| - ASSERT_EQ(2u, reconcilor->GetGaiaAccountsForTesting().size());
|
| -
|
| - token_service()->IssueAllTokensForAccount("other@gmail.com", "access_token",
|
| - base::Time::Now() + base::TimeDelta::FromHours(1));
|
| -
|
| - base::RunLoop().RunUntilIdle();
|
| - ASSERT_FALSE(reconcilor->AreAllRefreshTokensChecked());
|
| -
|
| - token_service()->IssueAllTokensForAccount("user@gmail.com", "access_token",
|
| - base::Time::Now() + base::TimeDelta::FromHours(1));
|
| -
|
| base::RunLoop().RunUntilIdle();
|
| - ASSERT_TRUE(reconcilor->AreAllRefreshTokensChecked());
|
| ASSERT_FALSE(reconcilor->is_reconcile_started_);
|
|
|
| histogram_tester()->ExpectTotalCount(
|
| @@ -495,15 +366,9 @@ TEST_P(AccountReconcilorTest, StartReconcileAddToCookie) {
|
| SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(),
|
| "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]",
|
| net::HTTP_OK, net::URLRequestStatus::SUCCESS);
|
| - SetFakeResponse("https://www.googleapis.com/oauth2/v1/userinfo",
|
| - "{\"id\":\"foo\"}", net::HTTP_OK, net::URLRequestStatus::SUCCESS);
|
|
|
| AccountReconcilor* reconcilor = GetMockReconcilor();
|
| reconcilor->StartReconcile();
|
| - token_service()->IssueAllTokensForAccount("other@gmail.com", "access_token",
|
| - base::Time::Now() + base::TimeDelta::FromHours(1));
|
| - token_service()->IssueAllTokensForAccount("user@gmail.com", "access_token",
|
| - base::Time::Now() + base::TimeDelta::FromHours(1));
|
|
|
| base::RunLoop().RunUntilIdle();
|
| ASSERT_TRUE(reconcilor->is_reconcile_started_);
|
| @@ -518,7 +383,38 @@ TEST_P(AccountReconcilorTest, StartReconcileAddToCookie) {
|
| histogram_tester()->ExpectUniqueSample(
|
| "Signin.Reconciler.AddedToCookieJar.FirstRun", 1, 1);
|
| histogram_tester()->ExpectUniqueSample(
|
| - "Signin.Reconciler.AddedToChrome.FirstRun", 0, 1);
|
| + "Signin.Reconciler.RemovedFromCookieJar.FirstRun", 0, 1);
|
| +}
|
| +
|
| +TEST_P(AccountReconcilorTest, StartReconcileRemoveFromCookie) {
|
| + signin_manager()->SetAuthenticatedUsername("user@gmail.com");
|
| + token_service()->UpdateCredentials("user@gmail.com", "refresh_token");
|
| +
|
| + EXPECT_CALL(*GetMockReconcilor(), PerformLogoutAllAccountsAction());
|
| + EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction("user@gmail.com"));
|
| +
|
| + SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(),
|
| + "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1], "
|
| + "[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]",
|
| + net::HTTP_OK, net::URLRequestStatus::SUCCESS);
|
| +
|
| + AccountReconcilor* reconcilor = GetMockReconcilor();
|
| + reconcilor->StartReconcile();
|
| + ASSERT_TRUE(reconcilor->is_reconcile_started_);
|
| +
|
| + base::RunLoop().RunUntilIdle();
|
| + SimulateMergeSessionCompleted(reconcilor, "user@gmail.com",
|
| + GoogleServiceAuthError::AuthErrorNone());
|
| + ASSERT_FALSE(reconcilor->is_reconcile_started_);
|
| +
|
| + histogram_tester()->ExpectUniqueSample(
|
| + "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun",
|
| + signin_metrics::ACCOUNTS_SAME,
|
| + 1);
|
| + histogram_tester()->ExpectUniqueSample(
|
| + "Signin.Reconciler.AddedToCookieJar.FirstRun", 0, 1);
|
| + histogram_tester()->ExpectUniqueSample(
|
| + "Signin.Reconciler.RemovedFromCookieJar.FirstRun", 1, 1);
|
| }
|
|
|
| TEST_P(AccountReconcilorTest, StartReconcileAddToCookieTwice) {
|
| @@ -534,21 +430,9 @@ TEST_P(AccountReconcilorTest, StartReconcileAddToCookieTwice) {
|
| "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]",
|
| net::HTTP_OK,
|
| net::URLRequestStatus::SUCCESS);
|
| - SetFakeResponse("https://www.googleapis.com/oauth2/v1/userinfo",
|
| - "{\"id\":\"foo\"}",
|
| - net::HTTP_OK,
|
| - net::URLRequestStatus::SUCCESS);
|
|
|
| AccountReconcilor* reconcilor = GetMockReconcilor();
|
| reconcilor->StartReconcile();
|
| - token_service()->IssueAllTokensForAccount(
|
| - "other@gmail.com",
|
| - "access_token",
|
| - base::Time::Now() + base::TimeDelta::FromHours(1));
|
| - token_service()->IssueAllTokensForAccount(
|
| - "user@gmail.com",
|
| - "access_token",
|
| - base::Time::Now() + base::TimeDelta::FromHours(1));
|
|
|
| base::RunLoop().RunUntilIdle();
|
| ASSERT_TRUE(reconcilor->is_reconcile_started_);
|
| @@ -563,7 +447,7 @@ TEST_P(AccountReconcilorTest, StartReconcileAddToCookieTwice) {
|
| histogram_tester()->ExpectUniqueSample(
|
| "Signin.Reconciler.AddedToCookieJar.FirstRun", 1, 1);
|
| histogram_tester()->ExpectUniqueSample(
|
| - "Signin.Reconciler.AddedToChrome.FirstRun", 0, 1);
|
| + "Signin.Reconciler.RemovedFromCookieJar.FirstRun", 0, 1);
|
|
|
| // Do another pass after I've added a third account to the token service
|
|
|
| @@ -576,19 +460,6 @@ TEST_P(AccountReconcilorTest, StartReconcileAddToCookieTwice) {
|
| // This will cause the reconcilor to fire.
|
| token_service()->UpdateCredentials("third@gmail.com", "refresh_token");
|
|
|
| - token_service()->IssueAllTokensForAccount(
|
| - "other@gmail.com",
|
| - "access_token",
|
| - base::Time::Now() + base::TimeDelta::FromHours(1));
|
| - token_service()->IssueAllTokensForAccount(
|
| - "user@gmail.com",
|
| - "access_token",
|
| - base::Time::Now() + base::TimeDelta::FromHours(1));
|
| - token_service()->IssueAllTokensForAccount(
|
| - "third@gmail.com",
|
| - "access_token",
|
| - base::Time::Now() + base::TimeDelta::FromHours(1));
|
| -
|
| base::RunLoop().RunUntilIdle();
|
|
|
| ASSERT_TRUE(reconcilor->is_reconcile_started_);
|
| @@ -603,7 +474,7 @@ TEST_P(AccountReconcilorTest, StartReconcileAddToCookieTwice) {
|
| histogram_tester()->ExpectUniqueSample(
|
| "Signin.Reconciler.AddedToCookieJar.FirstRun", 1, 1);
|
| histogram_tester()->ExpectUniqueSample(
|
| - "Signin.Reconciler.AddedToChrome.FirstRun", 0, 1);
|
| + "Signin.Reconciler.RemovedFromCookieJar.FirstRun", 0, 1);
|
| histogram_tester()->ExpectUniqueSample(
|
| "Signin.Reconciler.DifferentPrimaryAccounts.SubsequentRun",
|
| signin_metrics::ACCOUNTS_SAME,
|
| @@ -611,41 +482,7 @@ TEST_P(AccountReconcilorTest, StartReconcileAddToCookieTwice) {
|
| histogram_tester()->ExpectUniqueSample(
|
| "Signin.Reconciler.AddedToCookieJar.SubsequentRun", 1, 1);
|
| histogram_tester()->ExpectUniqueSample(
|
| - "Signin.Reconciler.AddedToChrome.SubsequentRun", 0, 1);
|
| -}
|
| -
|
| -TEST_P(AccountReconcilorTest, StartReconcileAddToChrome) {
|
| - signin_manager()->SetAuthenticatedUsername("user@gmail.com");
|
| - token_service()->UpdateCredentials("user@gmail.com", "refresh_token");
|
| -
|
| - EXPECT_CALL(*GetMockReconcilor(),
|
| - PerformAddToChromeAction("other@gmail.com", 1, ""));
|
| -
|
| - SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(),
|
| - "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1], "
|
| - "[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]",
|
| - net::HTTP_OK, net::URLRequestStatus::SUCCESS);
|
| - SetFakeResponse("https://www.googleapis.com/oauth2/v1/userinfo",
|
| - "{\"id\":\"foo\"}", net::HTTP_OK, net::URLRequestStatus::SUCCESS);
|
| -
|
| - AccountReconcilor* reconcilor = GetMockReconcilor();
|
| - reconcilor->StartReconcile();
|
| - token_service()->IssueAllTokensForAccount("user@gmail.com", "access_token",
|
| - base::Time::Now() + base::TimeDelta::FromHours(1));
|
| -
|
| - base::RunLoop().RunUntilIdle();
|
| - ASSERT_TRUE(reconcilor->is_reconcile_started_);
|
| - SimulateRefreshTokenFetched(reconcilor, "other@gmail.com", "");
|
| - ASSERT_FALSE(reconcilor->is_reconcile_started_);
|
| -
|
| - histogram_tester()->ExpectUniqueSample(
|
| - "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun",
|
| - signin_metrics::ACCOUNTS_SAME,
|
| - 1);
|
| - histogram_tester()->ExpectUniqueSample(
|
| - "Signin.Reconciler.AddedToCookieJar.FirstRun", 0, 1);
|
| - histogram_tester()->ExpectUniqueSample(
|
| - "Signin.Reconciler.AddedToChrome.FirstRun", 1, 1);
|
| + "Signin.Reconciler.RemovedFromCookieJar.SubsequentRun", 0, 1);
|
| }
|
|
|
| TEST_P(AccountReconcilorTest, StartReconcileBadPrimary) {
|
| @@ -661,15 +498,9 @@ TEST_P(AccountReconcilorTest, StartReconcileBadPrimary) {
|
| "[\"f\", [[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1], "
|
| "[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]",
|
| net::HTTP_OK, net::URLRequestStatus::SUCCESS);
|
| - SetFakeResponse("https://www.googleapis.com/oauth2/v1/userinfo",
|
| - "{\"id\":\"foo\"}", net::HTTP_OK, net::URLRequestStatus::SUCCESS);
|
|
|
| AccountReconcilor* reconcilor = GetMockReconcilor();
|
| reconcilor->StartReconcile();
|
| - token_service()->IssueAllTokensForAccount("other@gmail.com", "access_token",
|
| - base::Time::Now() + base::TimeDelta::FromHours(1));
|
| - token_service()->IssueAllTokensForAccount("user@gmail.com", "access_token",
|
| - base::Time::Now() + base::TimeDelta::FromHours(1));
|
|
|
| base::RunLoop().RunUntilIdle();
|
| ASSERT_TRUE(reconcilor->is_reconcile_started_);
|
| @@ -685,9 +516,9 @@ TEST_P(AccountReconcilorTest, StartReconcileBadPrimary) {
|
| signin_metrics::COOKIE_AND_TOKEN_PRIMARIES_DIFFERENT,
|
| 1);
|
| histogram_tester()->ExpectUniqueSample(
|
| - "Signin.Reconciler.AddedToCookieJar.FirstRun", 2, 1);
|
| + "Signin.Reconciler.AddedToCookieJar.FirstRun", 0, 1);
|
| histogram_tester()->ExpectUniqueSample(
|
| - "Signin.Reconciler.AddedToChrome.FirstRun", 0, 1);
|
| + "Signin.Reconciler.RemovedFromCookieJar.FirstRun", 0, 1);
|
| }
|
|
|
| TEST_P(AccountReconcilorTest, StartReconcileOnlyOnce) {
|
| @@ -701,16 +532,11 @@ TEST_P(AccountReconcilorTest, StartReconcileOnlyOnce) {
|
| SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(),
|
| "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]",
|
| net::HTTP_OK, net::URLRequestStatus::SUCCESS);
|
| - SetFakeResponse("https://www.googleapis.com/oauth2/v1/userinfo",
|
| - "{\"id\":\"foo\"}", net::HTTP_OK, net::URLRequestStatus::SUCCESS);
|
|
|
| ASSERT_FALSE(reconcilor->is_reconcile_started_);
|
| reconcilor->StartReconcile();
|
| ASSERT_TRUE(reconcilor->is_reconcile_started_);
|
|
|
| - token_service()->IssueAllTokensForAccount("user@gmail.com", "access_token",
|
| - base::Time::Now() + base::TimeDelta::FromHours(1));
|
| -
|
| base::RunLoop().RunUntilIdle();
|
| ASSERT_FALSE(reconcilor->is_reconcile_started_);
|
| }
|
| @@ -726,8 +552,6 @@ TEST_P(AccountReconcilorTest, StartReconcileWithSessionInfoExpiredDefault) {
|
| "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 0],"
|
| "[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]",
|
| net::HTTP_OK, net::URLRequestStatus::SUCCESS);
|
| - SetFakeResponse("https://www.googleapis.com/oauth2/v1/userinfo",
|
| - "{\"id\":\"foo\"}", net::HTTP_OK, net::URLRequestStatus::SUCCESS);
|
|
|
| AccountReconcilor* reconcilor =
|
| AccountReconcilorFactory::GetForProfile(profile());
|
| @@ -737,11 +561,6 @@ TEST_P(AccountReconcilorTest, StartReconcileWithSessionInfoExpiredDefault) {
|
| reconcilor->StartReconcile();
|
| ASSERT_TRUE(reconcilor->is_reconcile_started_);
|
|
|
| - token_service()->IssueAllTokensForAccount("user@gmail.com", "access_token",
|
| - base::Time::Now() + base::TimeDelta::FromHours(1));
|
| - token_service()->IssueAllTokensForAccount("other@gmail.com", "access_token",
|
| - base::Time::Now() + base::TimeDelta::FromHours(1));
|
| -
|
| base::RunLoop().RunUntilIdle();
|
| SimulateMergeSessionCompleted(reconcilor, "user@gmail.com",
|
| GoogleServiceAuthError::AuthErrorNone());
|
| @@ -757,8 +576,6 @@ TEST_F(AccountReconcilorTest, MergeSessionCompletedWithBogusAccount) {
|
| SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(),
|
| "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 0]]]",
|
| net::HTTP_OK, net::URLRequestStatus::SUCCESS);
|
| - SetFakeResponse("https://www.googleapis.com/oauth2/v1/userinfo",
|
| - "{\"id\":\"foo\"}", net::HTTP_OK, net::URLRequestStatus::SUCCESS);
|
|
|
| AccountReconcilor* reconcilor =
|
| AccountReconcilorFactory::GetForProfile(profile());
|
| @@ -768,8 +585,6 @@ TEST_F(AccountReconcilorTest, MergeSessionCompletedWithBogusAccount) {
|
| reconcilor->StartReconcile();
|
| ASSERT_TRUE(reconcilor->is_reconcile_started_);
|
|
|
| - token_service()->IssueAllTokensForAccount("user@gmail.com", "access_token",
|
| - base::Time::Now() + base::TimeDelta::FromHours(1));
|
| base::RunLoop().RunUntilIdle();
|
|
|
| // If an unknown account id is sent, it should not upset the state.
|
|
|