| 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 "components/signin/core/browser/fake_account_fetcher_service.h" | 6 #include "components/signin/core/browser/fake_account_fetcher_service.h" |
| 7 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" | 7 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" |
| 8 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 8 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 9 #include "components/sync_driver/profile_sync_auth_provider.h" | 9 #include "components/sync_driver/profile_sync_auth_provider.h" |
| 10 #include "google_apis/gaia/gaia_constants.h" | 10 #include "google_apis/gaia/gaia_constants.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 void SetUp() override { | 22 void SetUp() override { |
| 23 token_service_.reset(new FakeProfileOAuth2TokenService()); | 23 token_service_.reset(new FakeProfileOAuth2TokenService()); |
| 24 token_service_->set_auto_post_fetch_response_on_message_loop(true); | 24 token_service_->set_auto_post_fetch_response_on_message_loop(true); |
| 25 token_service_->UpdateCredentials(kAccountId, "fake_refresh_token"); | 25 token_service_->UpdateCredentials(kAccountId, "fake_refresh_token"); |
| 26 | 26 |
| 27 auth_provider_frontend_.reset(new ProfileSyncAuthProvider( | 27 auth_provider_frontend_.reset(new ProfileSyncAuthProvider( |
| 28 token_service_.get(), kAccountId, | 28 token_service_.get(), kAccountId, |
| 29 GaiaConstants::kChromeSyncOAuth2Scope)); | 29 GaiaConstants::kChromeSyncOAuth2Scope)); |
| 30 auth_provider_backend_ = | 30 auth_provider_backend_ = |
| 31 auth_provider_frontend_->CreateProviderForSyncThread().Pass(); | 31 auth_provider_frontend_->CreateProviderForSyncThread(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void RequestTokenFinished(const GoogleServiceAuthError& error, | 34 void RequestTokenFinished(const GoogleServiceAuthError& error, |
| 35 const std::string& token) { | 35 const std::string& token) { |
| 36 issued_tokens_.push_back(token); | 36 issued_tokens_.push_back(token); |
| 37 request_token_errors_.push_back(error); | 37 request_token_errors_.push_back(error); |
| 38 } | 38 } |
| 39 | 39 |
| 40 protected: | 40 protected: |
| 41 base::MessageLoop message_loop_; | 41 base::MessageLoop message_loop_; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 run_loop.RunUntilIdle(); | 73 run_loop.RunUntilIdle(); |
| 74 EXPECT_EQ(2U, request_token_errors_.size()); | 74 EXPECT_EQ(2U, request_token_errors_.size()); |
| 75 | 75 |
| 76 EXPECT_EQ("", issued_tokens_[0]); | 76 EXPECT_EQ("", issued_tokens_[0]); |
| 77 EXPECT_EQ(GoogleServiceAuthError::REQUEST_CANCELED, | 77 EXPECT_EQ(GoogleServiceAuthError::REQUEST_CANCELED, |
| 78 request_token_errors_[0].state()); | 78 request_token_errors_[0].state()); |
| 79 | 79 |
| 80 EXPECT_NE("", issued_tokens_[1]); | 80 EXPECT_NE("", issued_tokens_[1]); |
| 81 EXPECT_EQ(GoogleServiceAuthError::AuthErrorNone(), request_token_errors_[1]); | 81 EXPECT_EQ(GoogleServiceAuthError::AuthErrorNone(), request_token_errors_[1]); |
| 82 } | 82 } |
| OLD | NEW |