| 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 "base/run_loop.h" | 5 #include "base/run_loop.h" |
| 6 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" | 6 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" |
| 7 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" | 7 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" |
| 8 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 8 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 9 #include "chrome/browser/sync/profile_sync_auth_provider.h" | 9 #include "chrome/browser/sync/profile_sync_auth_provider.h" |
| 10 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
| 11 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 11 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 12 #include "content/public/test/test_browser_thread_bundle.h" | 12 #include "content/public/test/test_browser_thread_bundle.h" |
| 13 #include "google_apis/gaia/gaia_constants.h" | 13 #include "google_apis/gaia/gaia_constants.h" |
| 14 #include "google_apis/gaia/google_service_auth_error.h" | 14 #include "google_apis/gaia/google_service_auth_error.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 16 |
| 17 const char kAccountId[] = "account.id"; | 17 const char kAccountId[] = "account.id"; |
| 18 | 18 |
| 19 class ProfileSyncAuthProviderTest : public ::testing::Test { | 19 class ProfileSyncAuthProviderTest : public ::testing::Test { |
| 20 public: | 20 public: |
| 21 ProfileSyncAuthProviderTest() {} | 21 ProfileSyncAuthProviderTest() {} |
| 22 | 22 |
| 23 virtual ~ProfileSyncAuthProviderTest() {} | 23 ~ProfileSyncAuthProviderTest() override {} |
| 24 | 24 |
| 25 virtual void SetUp() override { | 25 void SetUp() override { |
| 26 TestingProfile::Builder builder; | 26 TestingProfile::Builder builder; |
| 27 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(), | 27 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(), |
| 28 &BuildAutoIssuingFakeProfileOAuth2TokenService); | 28 &BuildAutoIssuingFakeProfileOAuth2TokenService); |
| 29 | 29 |
| 30 profile_ = builder.Build(); | 30 profile_ = builder.Build(); |
| 31 | 31 |
| 32 FakeProfileOAuth2TokenService* token_service = | 32 FakeProfileOAuth2TokenService* token_service = |
| 33 (FakeProfileOAuth2TokenService*) | 33 (FakeProfileOAuth2TokenService*) |
| 34 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()); | 34 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()); |
| 35 token_service->IssueRefreshTokenForUser(kAccountId, "fake_refresh_token"); | 35 token_service->IssueRefreshTokenForUser(kAccountId, "fake_refresh_token"); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 run_loop.RunUntilIdle(); | 82 run_loop.RunUntilIdle(); |
| 83 EXPECT_EQ(2U, request_token_errors_.size()); | 83 EXPECT_EQ(2U, request_token_errors_.size()); |
| 84 | 84 |
| 85 EXPECT_EQ("", issued_tokens_[0]); | 85 EXPECT_EQ("", issued_tokens_[0]); |
| 86 EXPECT_EQ(GoogleServiceAuthError::REQUEST_CANCELED, | 86 EXPECT_EQ(GoogleServiceAuthError::REQUEST_CANCELED, |
| 87 request_token_errors_[0].state()); | 87 request_token_errors_[0].state()); |
| 88 | 88 |
| 89 EXPECT_NE("", issued_tokens_[1]); | 89 EXPECT_NE("", issued_tokens_[1]); |
| 90 EXPECT_EQ(GoogleServiceAuthError::AuthErrorNone(), request_token_errors_[1]); | 90 EXPECT_EQ(GoogleServiceAuthError::AuthErrorNone(), request_token_errors_[1]); |
| 91 } | 91 } |
| OLD | NEW |