OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file implements a mock location provider and the factory functions for | 5 // This file implements a mock location provider and the factory functions for |
6 // various ways of creating it. | 6 // various ways of creating it. |
7 | 7 |
8 #include "content/browser/geolocation/mock_location_provider.h" | 8 #include "content/browser/geolocation/mock_location_provider.h" |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/location.h" |
13 #include "base/logging.h" | 14 #include "base/logging.h" |
14 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
15 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
16 #include "base/message_loop_proxy.h" | 17 #include "base/time.h" |
17 | 18 |
18 MockLocationProvider* MockLocationProvider::instance_ = NULL; | 19 MockLocationProvider* MockLocationProvider::instance_ = NULL; |
19 | 20 |
20 MockLocationProvider::MockLocationProvider(MockLocationProvider** self_ref) | 21 MockLocationProvider::MockLocationProvider(MockLocationProvider** self_ref) |
21 : state_(STOPPED), | 22 : state_(STOPPED), |
22 is_permission_granted_(false), | 23 is_permission_granted_(false), |
23 self_ref_(self_ref), | 24 self_ref_(self_ref), |
24 provider_loop_(base::MessageLoopProxy::current()) { | 25 provider_loop_(base::MessageLoopProxy::current()) { |
25 CHECK(self_ref_); | 26 CHECK(self_ref_); |
26 CHECK(*self_ref_ == NULL); | 27 CHECK(*self_ref_ == NULL); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 return new AutoMockLocationProvider(true, false); | 124 return new AutoMockLocationProvider(true, false); |
124 } | 125 } |
125 | 126 |
126 LocationProviderBase* NewAutoFailMockLocationProvider() { | 127 LocationProviderBase* NewAutoFailMockLocationProvider() { |
127 return new AutoMockLocationProvider(false, false); | 128 return new AutoMockLocationProvider(false, false); |
128 } | 129 } |
129 | 130 |
130 LocationProviderBase* NewAutoSuccessMockNetworkLocationProvider() { | 131 LocationProviderBase* NewAutoSuccessMockNetworkLocationProvider() { |
131 return new AutoMockLocationProvider(true, true); | 132 return new AutoMockLocationProvider(true, true); |
132 } | 133 } |
| 134 |
| 135 LocationProviderBase* NewAutoFailMockNetworkLocationProvider() { |
| 136 return new AutoMockLocationProvider(false, true); |
| 137 } |
OLD | NEW |