Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ios / chrome / browser / geolocation / test_location_manager.mm
blobeb6633eaf84d124313a21a4fa8bbb16f557887da
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.
5 #import "ios/chrome/browser/geolocation/test_location_manager.h"
7 #include "base/mac/scoped_nsobject.h"
9 @interface TestLocationManager () {
10   CLAuthorizationStatus _authorizationStatus;
11   base::scoped_nsobject<CLLocation> _currentLocation;
12   BOOL _locationServicesEnabled;
13   BOOL _started;
14   BOOL _stopped;
17 @end
19 @implementation TestLocationManager
21 @synthesize authorizationStatus = _authorizationStatus;
22 @synthesize locationServicesEnabled = _locationServicesEnabled;
23 @synthesize started = _started;
24 @synthesize stopped = _stopped;
26 - (id)init {
27   self = [super init];
28   if (self) {
29     [self reset];
30   }
31   return self;
34 - (void)setAuthorizationStatus:(CLAuthorizationStatus)authorizationStatus {
35   if (_authorizationStatus != authorizationStatus) {
36     _authorizationStatus = authorizationStatus;
37     [self.delegate locationManagerDidChangeAuthorizationStatus:self];
38   }
41 - (CLLocation*)currentLocation {
42   return _currentLocation;
45 - (void)setCurrentLocation:(CLLocation*)currentLocation {
46   _currentLocation.reset([currentLocation retain]);
49 - (void)reset {
50   _authorizationStatus = kCLAuthorizationStatusNotDetermined;
51   _currentLocation.reset();
52   _locationServicesEnabled = YES;
53   _started = NO;
54   _stopped = NO;
57 #pragma mark - LocationManager overrides
59 - (void)startUpdatingLocation {
60   _started = YES;
63 - (void)stopUpdatingLocation {
64   _stopped = YES;
67 @end