| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/signin/fake_profile_oauth2_token_service.h" | 5 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "components/signin/core/browser/signin_account_id_helper.h" | 8 #include "components/signin/core/browser/signin_account_id_helper.h" |
| 9 | 9 |
| 10 FakeProfileOAuth2TokenService::PendingRequest::PendingRequest() { | 10 FakeProfileOAuth2TokenService::PendingRequest::PendingRequest() { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 if (token.empty()) { | 59 if (token.empty()) { |
| 60 refresh_tokens_.erase(account_id); | 60 refresh_tokens_.erase(account_id); |
| 61 FireRefreshTokenRevoked(account_id); | 61 FireRefreshTokenRevoked(account_id); |
| 62 } else { | 62 } else { |
| 63 refresh_tokens_[account_id] = token; | 63 refresh_tokens_[account_id] = token; |
| 64 FireRefreshTokenAvailable(account_id); | 64 FireRefreshTokenAvailable(account_id); |
| 65 // TODO(atwilson): Maybe we should also call FireRefreshTokensLoaded() here? | 65 // TODO(atwilson): Maybe we should also call FireRefreshTokensLoaded() here? |
| 66 } | 66 } |
| 67 } | 67 } |
| 68 | 68 |
| 69 void FakeProfileOAuth2TokenService::IssueAllRefreshTokensLoaded() { |
| 70 FireRefreshTokensLoaded(); |
| 71 } |
| 72 |
| 69 void FakeProfileOAuth2TokenService::IssueAllTokensForAccount( | 73 void FakeProfileOAuth2TokenService::IssueAllTokensForAccount( |
| 70 const std::string& account_id, | 74 const std::string& account_id, |
| 71 const std::string& access_token, | 75 const std::string& access_token, |
| 72 const base::Time& expiration) { | 76 const base::Time& expiration) { |
| 73 CompleteRequests(account_id, | 77 CompleteRequests(account_id, |
| 74 true, | 78 true, |
| 75 ScopeSet(), | 79 ScopeSet(), |
| 76 GoogleServiceAuthError::AuthErrorNone(), | 80 GoogleServiceAuthError::AuthErrorNone(), |
| 77 access_token, | 81 access_token, |
| 78 expiration); | 82 expiration); |
| 79 } | 83 } |
| 80 | 84 |
| 85 void FakeProfileOAuth2TokenService::IssueErrorForAllPendingRequestsForAccount( |
| 86 const std::string& account_id, |
| 87 const GoogleServiceAuthError& error) { |
| 88 CompleteRequests(account_id, |
| 89 true, |
| 90 ScopeSet(), |
| 91 error, |
| 92 std::string(), |
| 93 base::Time()); |
| 94 } |
| 95 |
| 81 void FakeProfileOAuth2TokenService::IssueTokenForScope( | 96 void FakeProfileOAuth2TokenService::IssueTokenForScope( |
| 82 const ScopeSet& scope, | 97 const ScopeSet& scope, |
| 83 const std::string& access_token, | 98 const std::string& access_token, |
| 84 const base::Time& expiration) { | 99 const base::Time& expiration) { |
| 85 CompleteRequests("", | 100 CompleteRequests("", |
| 86 false, | 101 false, |
| 87 scope, | 102 scope, |
| 88 GoogleServiceAuthError::AuthErrorNone(), | 103 GoogleServiceAuthError::AuthErrorNone(), |
| 89 access_token, | 104 access_token, |
| 90 expiration); | 105 expiration); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 return NULL; | 209 return NULL; |
| 195 } | 210 } |
| 196 | 211 |
| 197 void FakeProfileOAuth2TokenService::InvalidateOAuth2Token( | 212 void FakeProfileOAuth2TokenService::InvalidateOAuth2Token( |
| 198 const std::string& account_id, | 213 const std::string& account_id, |
| 199 const std::string& client_id, | 214 const std::string& client_id, |
| 200 const ScopeSet& scopes, | 215 const ScopeSet& scopes, |
| 201 const std::string& access_token) { | 216 const std::string& access_token) { |
| 202 // Do nothing, as we don't have a cache from which to remove the token. | 217 // Do nothing, as we don't have a cache from which to remove the token. |
| 203 } | 218 } |
| OLD | NEW |