Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(771)

Side by Side Diff: ios/public/test/fake_profile_oauth2_token_service_ios_provider.mm

Issue 489113003: Remove MutableProfileOAuth2TokenService on iOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "ios/public/test/fake_profile_oauth2_token_service_ios_provider.h" 5 #include "ios/public/test/fake_profile_oauth2_token_service_ios_provider.h"
6 6
7 #include <Foundation/Foundation.h> 7 #include <Foundation/Foundation.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
11 11
12 namespace ios { 12 namespace ios {
13 13
14 FakeProfileOAuth2TokenServiceIOSProvider:: 14 FakeProfileOAuth2TokenServiceIOSProvider::
15 FakeProfileOAuth2TokenServiceIOSProvider() 15 FakeProfileOAuth2TokenServiceIOSProvider() {}
16 : is_using_shared_authentication_(true) {}
17 16
18 FakeProfileOAuth2TokenServiceIOSProvider:: 17 FakeProfileOAuth2TokenServiceIOSProvider::
19 ~FakeProfileOAuth2TokenServiceIOSProvider() {} 18 ~FakeProfileOAuth2TokenServiceIOSProvider() {}
20 19
21 void FakeProfileOAuth2TokenServiceIOSProvider::GetAccessToken( 20 void FakeProfileOAuth2TokenServiceIOSProvider::GetAccessToken(
22 const std::string& account_id, 21 const std::string& account_id,
23 const std::string& client_id, 22 const std::string& client_id,
24 const std::string& client_secret, 23 const std::string& client_secret,
25 const std::set<std::string>& scopes, 24 const std::set<std::string>& scopes,
26 const AccessTokenCallback& callback) { 25 const AccessTokenCallback& callback) {
27 DCHECK(is_using_shared_authentication_);
28 requests_.push_back(AccessTokenRequest(account_id, callback)); 26 requests_.push_back(AccessTokenRequest(account_id, callback));
29 } 27 }
30 28
31 std::vector<std::string> 29 std::vector<std::string>
32 FakeProfileOAuth2TokenServiceIOSProvider::GetAllAccountIds() { 30 FakeProfileOAuth2TokenServiceIOSProvider::GetAllAccountIds() {
33 return accounts_; 31 return accounts_;
34 } 32 }
35 33
36 void FakeProfileOAuth2TokenServiceIOSProvider::AddAccount( 34 void FakeProfileOAuth2TokenServiceIOSProvider::AddAccount(
37 const std::string& account_id) { 35 const std::string& account_id) {
(...skipping 28 matching lines...) Expand all
66 std::string account_id = i->first; 64 std::string account_id = i->first;
67 AccessTokenCallback callback = i->second; 65 AccessTokenCallback callback = i->second;
68 NSError* error = [[[NSError alloc] initWithDomain:@"fake_access_token_error" 66 NSError* error = [[[NSError alloc] initWithDomain:@"fake_access_token_error"
69 code:-1 67 code:-1
70 userInfo:nil] autorelease]; 68 userInfo:nil] autorelease];
71 callback.Run(nil, nil, error); 69 callback.Run(nil, nil, error);
72 } 70 }
73 requests_.clear(); 71 requests_.clear();
74 } 72 }
75 73
76 bool FakeProfileOAuth2TokenServiceIOSProvider::IsUsingSharedAuthentication()
77 const {
78 return is_using_shared_authentication_;
79 }
80
81 void 74 void
82 FakeProfileOAuth2TokenServiceIOSProvider::InitializeSharedAuthentication() {} 75 FakeProfileOAuth2TokenServiceIOSProvider::InitializeSharedAuthentication() {}
83 76
84 AuthenticationErrorCategory 77 AuthenticationErrorCategory
85 FakeProfileOAuth2TokenServiceIOSProvider::GetAuthenticationErrorCategory( 78 FakeProfileOAuth2TokenServiceIOSProvider::GetAuthenticationErrorCategory(
86 NSError* error) const { 79 NSError* error) const {
87 DCHECK(error); 80 DCHECK(error);
88 return ios::kAuthenticationErrorCategoryAuthorizationErrors; 81 return ios::kAuthenticationErrorCategoryAuthorizationErrors;
89 } 82 }
90 83
91 } // namespace ios 84 } // namespace ios
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698