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