OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #import "ios/public/provider/chrome/browser/signin/fake_chrome_identity.h" | 5 #import "ios/public/provider/chrome/browser/signin/fake_chrome_identity.h" |
6 | 6 |
7 #import "base/mac/scoped_nsobject.h" | |
8 | 7 |
9 @implementation FakeChromeIdentity { | 8 @implementation FakeChromeIdentity { |
10 base::scoped_nsobject<NSString> _userEmail; | 9 NSString* _userEmail; |
11 base::scoped_nsobject<NSString> _gaiaID; | 10 NSString* _gaiaID; |
12 base::scoped_nsobject<NSString> _userFullName; | 11 NSString* _userFullName; |
13 base::scoped_nsobject<NSString> _hashedGaiaID; | 12 NSString* _hashedGaiaID; |
14 } | 13 } |
15 | 14 |
16 + (FakeChromeIdentity*)identityWithEmail:(NSString*)email | 15 + (FakeChromeIdentity*)identityWithEmail:(NSString*)email |
17 gaiaID:(NSString*)gaiaID | 16 gaiaID:(NSString*)gaiaID |
18 name:(NSString*)name { | 17 name:(NSString*)name { |
19 return | 18 return |
20 [[[FakeChromeIdentity alloc] initWithEmail:email gaiaID:gaiaID name:name] | 19 [[[FakeChromeIdentity alloc] initWithEmail:email gaiaID:gaiaID name:name] |
21 autorelease]; | 20 autorelease]; |
22 } | 21 } |
23 | 22 |
24 - (instancetype)initWithEmail:(NSString*)email | 23 - (instancetype)initWithEmail:(NSString*)email |
25 gaiaID:(NSString*)gaiaID | 24 gaiaID:(NSString*)gaiaID |
26 name:(NSString*)name { | 25 name:(NSString*)name { |
27 self = [super init]; | 26 self = [super init]; |
28 if (self) { | 27 if (self) { |
29 _userEmail.reset([email copy]); | 28 _userEmail = [email copy]; |
30 _gaiaID.reset([gaiaID copy]); | 29 _gaiaID = [gaiaID copy]; |
31 _userFullName.reset([name copy]); | 30 _userFullName = [name copy]; |
32 _hashedGaiaID.reset( | 31 _hashedGaiaID = [[NSString stringWithFormat:@"%@_hashID", name] retain]; |
33 [[NSString stringWithFormat:@"%@_hashID", name] retain]); | |
34 } | 32 } |
35 return self; | 33 return self; |
36 } | 34 } |
37 | 35 |
38 - (NSString*)userEmail { | 36 - (NSString*)userEmail { |
39 return _userEmail; | 37 return _userEmail; |
40 } | 38 } |
41 | 39 |
42 - (NSString*)gaiaID { | 40 - (NSString*)gaiaID { |
43 return _gaiaID; | 41 return _gaiaID; |
44 } | 42 } |
45 | 43 |
46 - (NSString*)userFullName { | 44 - (NSString*)userFullName { |
47 return _userFullName; | 45 return _userFullName; |
48 } | 46 } |
49 | 47 |
50 - (NSString*)hashedGaiaID { | 48 - (NSString*)hashedGaiaID { |
51 return _hashedGaiaID; | 49 return _hashedGaiaID; |
52 } | 50 } |
53 | 51 |
54 @end | 52 @end |
OLD | NEW |