OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "ios/chrome/browser/geolocation/test_location_manager.h" |
| 6 |
| 7 #include "base/mac/scoped_nsobject.h" |
| 8 |
| 9 @interface TestLocationManager () { |
| 10 CLAuthorizationStatus _authorizationStatus; |
| 11 base::scoped_nsobject<CLLocation> _currentLocation; |
| 12 BOOL _locationServicesEnabled; |
| 13 BOOL _started; |
| 14 BOOL _stopped; |
| 15 } |
| 16 |
| 17 @end |
| 18 |
| 19 @implementation TestLocationManager |
| 20 |
| 21 @synthesize authorizationStatus = _authorizationStatus; |
| 22 @synthesize locationServicesEnabled = _locationServicesEnabled; |
| 23 @synthesize started = _started; |
| 24 @synthesize stopped = _stopped; |
| 25 |
| 26 - (id)init { |
| 27 self = [super init]; |
| 28 if (self) { |
| 29 [self reset]; |
| 30 } |
| 31 return self; |
| 32 } |
| 33 |
| 34 - (void)setAuthorizationStatus:(CLAuthorizationStatus)authorizationStatus { |
| 35 if (_authorizationStatus != authorizationStatus) { |
| 36 _authorizationStatus = authorizationStatus; |
| 37 [self.delegate locationManagerDidChangeAuthorizationStatus:self]; |
| 38 } |
| 39 } |
| 40 |
| 41 - (CLLocation*)currentLocation { |
| 42 return _currentLocation; |
| 43 } |
| 44 |
| 45 - (void)setCurrentLocation:(CLLocation*)currentLocation { |
| 46 _currentLocation.reset([currentLocation retain]); |
| 47 } |
| 48 |
| 49 - (void)reset { |
| 50 _authorizationStatus = kCLAuthorizationStatusNotDetermined; |
| 51 _currentLocation.reset(); |
| 52 _locationServicesEnabled = YES; |
| 53 _started = NO; |
| 54 _stopped = NO; |
| 55 } |
| 56 |
| 57 #pragma mark - LocationManager overrides |
| 58 |
| 59 - (void)startUpdatingLocation { |
| 60 _started = YES; |
| 61 } |
| 62 |
| 63 - (void)stopUpdatingLocation { |
| 64 _stopped = YES; |
| 65 } |
| 66 |
| 67 @end |
OLD | NEW |