13551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
23551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
33551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)// found in the LICENSE file.
43551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
53551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
63551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
75d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "base/message_loop/message_loop.h"
8e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch#include "components/signin/core/browser/signin_account_id_helper.h"
95d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
103551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)FakeProfileOAuth2TokenService::PendingRequest::PendingRequest() {
113551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)}
123551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
133551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)FakeProfileOAuth2TokenService::PendingRequest::~PendingRequest() {
143551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)}
153551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
165d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)FakeProfileOAuth2TokenService::FakeProfileOAuth2TokenService()
17cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    : auto_post_fetch_response_on_message_loop_(false),
18cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)      weak_ptr_factory_(this) {
195d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  SigninAccountIdHelper::SetDisableForTest(true);
203551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)}
213551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
223551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)FakeProfileOAuth2TokenService::~FakeProfileOAuth2TokenService() {
235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  SigninAccountIdHelper::SetDisableForTest(false);
243551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)}
253551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
2668043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)bool FakeProfileOAuth2TokenService::RefreshTokenIsAvailable(
27a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    const std::string& account_id) const {
2868043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  return !GetRefreshToken(account_id).empty();
2968043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)}
3068043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
315d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)void FakeProfileOAuth2TokenService::LoadCredentials(
325d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    const std::string& primary_account_id) {
335d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Empty implementation as FakeProfileOAuth2TokenService does not have any
345d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // credentials to load.
355d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}
365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)std::vector<std::string> FakeProfileOAuth2TokenService::GetAccounts() {
385d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  std::vector<std::string> account_ids;
395d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  for (std::map<std::string, std::string>::const_iterator iter =
405d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)           refresh_tokens_.begin(); iter != refresh_tokens_.end(); ++iter) {
415d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    account_ids.push_back(iter->first);
425d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  }
435d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  return account_ids;
445d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}
455d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
46f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)void FakeProfileOAuth2TokenService::UpdateCredentials(
47f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)    const std::string& account_id,
48f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)    const std::string& refresh_token) {
49f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  IssueRefreshTokenForUser(account_id, refresh_token);
50f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)}
51f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
523551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)void FakeProfileOAuth2TokenService::IssueRefreshToken(
533551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)    const std::string& token) {
548bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  IssueRefreshTokenForUser("account_id", token);
558bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)}
568bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
578bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)void FakeProfileOAuth2TokenService::IssueRefreshTokenForUser(
588bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)    const std::string& account_id,
598bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)    const std::string& token) {
60116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  ScopedBacthChange batch(this);
615d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  if (token.empty()) {
625d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    refresh_tokens_.erase(account_id);
638bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)    FireRefreshTokenRevoked(account_id);
645d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  } else {
655d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    refresh_tokens_[account_id] = token;
668bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)    FireRefreshTokenAvailable(account_id);
675d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    // TODO(atwilson): Maybe we should also call FireRefreshTokensLoaded() here?
685d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  }
695d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}
705d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
7146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)void FakeProfileOAuth2TokenService::IssueAllRefreshTokensLoaded() {
7246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  FireRefreshTokensLoaded();
7346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)}
7446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
755d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)void FakeProfileOAuth2TokenService::IssueAllTokensForAccount(
765d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    const std::string& account_id,
775d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    const std::string& access_token,
785d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    const base::Time& expiration) {
795d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  CompleteRequests(account_id,
805d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                   true,
815d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                   ScopeSet(),
825d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                   GoogleServiceAuthError::AuthErrorNone(),
835d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                   access_token,
845d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                   expiration);
853551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)}
863551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
8746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)void FakeProfileOAuth2TokenService::IssueErrorForAllPendingRequestsForAccount(
8846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    const std::string& account_id,
8946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    const GoogleServiceAuthError& error) {
9046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  CompleteRequests(account_id,
9146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)                   true,
9246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)                   ScopeSet(),
9346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)                   error,
9446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)                   std::string(),
9546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)                   base::Time());
9646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)}
9746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
983551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)void FakeProfileOAuth2TokenService::IssueTokenForScope(
993551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)    const ScopeSet& scope,
1003551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)    const std::string& access_token,
1013551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)    const base::Time& expiration) {
1025d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  CompleteRequests("",
1035d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                   false,
1043551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)                   scope,
1053551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)                   GoogleServiceAuthError::AuthErrorNone(),
1063551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)                   access_token,
1073551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)                   expiration);
1083551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)}
1093551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
1103551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)void FakeProfileOAuth2TokenService::IssueErrorForScope(
1113551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)    const ScopeSet& scope,
1123551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)    const GoogleServiceAuthError& error) {
1135d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  CompleteRequests("", false, scope, error, std::string(), base::Time());
1143551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)}
1153551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
1163551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)void FakeProfileOAuth2TokenService::IssueErrorForAllPendingRequests(
1173551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)    const GoogleServiceAuthError& error) {
1185d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  CompleteRequests("", true, ScopeSet(), error, std::string(), base::Time());
1193551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)}
1203551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
1213551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)void FakeProfileOAuth2TokenService::IssueTokenForAllPendingRequests(
1223551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)    const std::string& access_token,
1233551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)    const base::Time& expiration) {
1245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  CompleteRequests("",
1255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                   true,
1263551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)                   ScopeSet(),
1273551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)                   GoogleServiceAuthError::AuthErrorNone(),
1283551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)                   access_token,
1293551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)                   expiration);
1303551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)}
1313551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
1323551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)void FakeProfileOAuth2TokenService::CompleteRequests(
1335d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    const std::string& account_id,
1343551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)    bool all_scopes,
1353551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)    const ScopeSet& scope,
1363551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)    const GoogleServiceAuthError& error,
1373551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)    const std::string& access_token,
1383551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)    const base::Time& expiration) {
1393551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  std::vector<FakeProfileOAuth2TokenService::PendingRequest> requests =
1403551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)      GetPendingRequests();
1418bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
1423551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Walk the requests and notify the callbacks.
1433551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  for (std::vector<PendingRequest>::iterator it = pending_requests_.begin();
1443551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)       it != pending_requests_.end(); ++it) {
1455d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    if (!it->request)
1465d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      continue;
1475d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
1485d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    bool scope_matches = all_scopes || it->scopes == scope;
1495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    bool account_matches = account_id.empty() || account_id == it->account_id;
1505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    if (account_matches && scope_matches)
1513551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)      it->request->InformConsumer(error, access_token, expiration);
1523551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  }
1533551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)}
1543551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
15568043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)std::string FakeProfileOAuth2TokenService::GetRefreshToken(
156a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    const std::string& account_id) const {
157a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  std::map<std::string, std::string>::const_iterator it =
158a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      refresh_tokens_.find(account_id);
159a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  if (it != refresh_tokens_.end())
160a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    return it->second;
161a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  return std::string();
1623551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)}
1633551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
1643551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)net::URLRequestContextGetter*
1653551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)FakeProfileOAuth2TokenService::GetRequestContext() {
1663551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  return NULL;
1673551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)}
1683551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
1693551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)std::vector<FakeProfileOAuth2TokenService::PendingRequest>
1703551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)FakeProfileOAuth2TokenService::GetPendingRequests() {
1713551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  std::vector<PendingRequest> valid_requests;
1723551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  for (std::vector<PendingRequest>::iterator it = pending_requests_.begin();
1733551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)       it != pending_requests_.end(); ++it) {
1743551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)    if (it->request)
1753551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)      valid_requests.push_back(*it);
1763551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  }
1773551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  return valid_requests;
1783551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)}
1793551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
1803551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)void FakeProfileOAuth2TokenService::FetchOAuth2Token(
1813551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)    RequestImpl* request,
18268043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)    const std::string& account_id,
1833551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)    net::URLRequestContextGetter* getter,
1843551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)    const std::string& client_id,
1853551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)    const std::string& client_secret,
1863551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)    const ScopeSet& scopes) {
1873551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  PendingRequest pending_request;
18868043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  pending_request.account_id = account_id;
1893551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  pending_request.client_id = client_id;
1903551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  pending_request.client_secret = client_secret;
1913551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  pending_request.scopes = scopes;
1923551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  pending_request.request = request->AsWeakPtr();
1933551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  pending_requests_.push_back(pending_request);
1945d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
1955d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  if (auto_post_fetch_response_on_message_loop_) {
1965d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
1975d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)        &FakeProfileOAuth2TokenService::IssueAllTokensForAccount,
198cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)        weak_ptr_factory_.GetWeakPtr(),
1995d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)        account_id,
2005d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)        "access_token",
2015d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)        base::Time::Max()));
2025d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  }
2033551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)}
204f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
205a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)OAuth2AccessTokenFetcher*
206a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)FakeProfileOAuth2TokenService::CreateAccessTokenFetcher(
207a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    const std::string& account_id,
208a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    net::URLRequestContextGetter* getter,
209a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    OAuth2AccessTokenConsumer* consumer) {
210a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  NOTREACHED();
211a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  return NULL;
212a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}
213a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
214f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)void FakeProfileOAuth2TokenService::InvalidateOAuth2Token(
215f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)    const std::string& account_id,
216f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)    const std::string& client_id,
217f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)    const ScopeSet& scopes,
218f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)    const std::string& access_token) {
219f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // Do nothing, as we don't have a cache from which to remove the token.
220f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)}
221