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

Side by Side Diff: content/browser/geolocation/location_arbitrator_impl_unittest.cc

Issue 2028823002: Refactor to make BlimpLocationProvider accessible to content layer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: In response to Wez's #86 comments Created 4 years, 6 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
OLDNEW
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 #include "content/browser/geolocation/location_arbitrator_impl.h" 5 #include "content/browser/geolocation/location_arbitrator_impl.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h"
10 #include "content/browser/geolocation/fake_access_token_store.h" 11 #include "content/browser/geolocation/fake_access_token_store.h"
11 #include "content/browser/geolocation/mock_location_provider.h" 12 #include "content/browser/geolocation/mock_location_provider.h"
12 #include "content/public/common/geoposition.h" 13 #include "content/public/common/geoposition.h"
14 #include "content/test/test_content_browser_client.h"
13 #include "testing/gmock/include/gmock/gmock.h" 15 #include "testing/gmock/include/gmock/gmock.h"
14 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
15 17
16 using ::testing::NiceMock; 18 using ::testing::NiceMock;
17 19
18 namespace content { 20 namespace content {
19 21
20 class MockLocationObserver { 22 class MockLocationObserver {
21 public: 23 public:
22 // Need a vtable for GMock. 24 // Need a vtable for GMock.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 ASSERT_TRUE(position.Validate()); 59 ASSERT_TRUE(position.Validate());
58 provider->HandlePositionChanged(position); 60 provider->HandlePositionChanged(position);
59 } 61 }
60 62
61 void SetReferencePosition(MockLocationProvider* provider) { 63 void SetReferencePosition(MockLocationProvider* provider) {
62 SetPositionFix(provider, 51.0, -0.1, 400); 64 SetPositionFix(provider, 51.0, -0.1, 400);
63 } 65 }
64 66
65 namespace { 67 namespace {
66 68
69 class GeolocationContentBrowserClient : public TestContentBrowserClient {
70 public:
71 GeolocationContentBrowserClient() {}
72
73 void set_use_network(bool use_network) { use_network_ = use_network; }
74
75 LocationProvider* OverrideSystemLocationProvider() override {
76 provider_ = new MockLocationProvider;
77 return provider_;
78 }
79
80 bool UseNetworkLocationProviders() override { return use_network_; }
81
82 // This provider does not own the object. It is returned by
83 // GetSystemLocationProviderOverride(). The caller takes ownership.
Wez 2016/06/17 05:50:09 What is GetSystemLocationProviderOverride()?
CJ 2016/06/21 22:16:07 A function found in GeolocationLocationArbitratorT
Wez 2016/06/22 18:51:01 Yes, since this function doesn't exist in this fil
CJ 2016/06/22 20:47:29 But it does? Line 178. Adding the class name to th
84 // This is just a reference we can use for mocking purposes.
85 MockLocationProvider* provider_ = nullptr;
86
87 private:
88 bool use_network_ = true;
89
90 DISALLOW_COPY_AND_ASSIGN(GeolocationContentBrowserClient);
91 };
92
67 class TestingLocationArbitrator : public LocationArbitratorImpl { 93 class TestingLocationArbitrator : public LocationArbitratorImpl {
68 public: 94 public:
69 TestingLocationArbitrator( 95 TestingLocationArbitrator(
70 const LocationArbitratorImpl::LocationUpdateCallback& callback, 96 const LocationArbitratorImpl::LocationUpdateCallback& callback,
71 AccessTokenStore* access_token_store) 97 AccessTokenStore* access_token_store)
72 : LocationArbitratorImpl(callback), 98 : LocationArbitratorImpl(callback),
73 cell_(NULL), 99 cell_(nullptr),
74 gps_(NULL), 100 gps_(nullptr),
75 access_token_store_(access_token_store) { 101 access_token_store_(access_token_store) {}
76 }
77 102
78 base::Time GetTimeNow() const override { return GetTimeNowForTest(); } 103 base::Time GetTimeNow() const override { return GetTimeNowForTest(); }
79 104
80 AccessTokenStore* NewAccessTokenStore() override { 105 AccessTokenStore* NewAccessTokenStore() override {
81 return access_token_store_.get(); 106 return access_token_store_.get();
82 } 107 }
83 108
84 LocationProvider* NewNetworkLocationProvider( 109 std::unique_ptr<LocationProvider> NewNetworkLocationProvider(
85 AccessTokenStore* access_token_store, 110 AccessTokenStore* access_token_store,
86 net::URLRequestContextGetter* context, 111 net::URLRequestContextGetter* context,
87 const GURL& url, 112 const GURL& url,
88 const base::string16& access_token) override { 113 const base::string16& access_token) override {
89 return new MockLocationProvider(&cell_); 114 cell_ = new MockLocationProvider;
115 return base::WrapUnique(cell_);
90 } 116 }
91 117
92 LocationProvider* NewSystemLocationProvider() override { 118 std::unique_ptr<LocationProvider> NewSystemLocationProvider() override {
93 return new MockLocationProvider(&gps_); 119 gps_ = new MockLocationProvider;
120 return base::WrapUnique(gps_);
94 } 121 }
95 122
96 // Two location providers, with nice short names to make the tests more 123 // Two location providers, with nice short names to make the tests more
97 // readable. Note |gps_| will only be set when there is a high accuracy 124 // readable. Note |gps_| will only be set when there is a high accuracy
98 // observer registered (and |cell_| when there's at least one observer of any 125 // observer registered (and |cell_| when there's at least one observer of any
99 // type). 126 // type).
127
128 // TODO(mvanouwerkerk): rename |cell_| to |network_location_provider_| and
129 // |gps_| to |system_location_provider_|
100 MockLocationProvider* cell_; 130 MockLocationProvider* cell_;
101 MockLocationProvider* gps_; 131 MockLocationProvider* gps_;
102 scoped_refptr<AccessTokenStore> access_token_store_; 132 scoped_refptr<AccessTokenStore> access_token_store_;
103 }; 133 };
104 134
105 } // namespace 135 } // namespace
106 136
107 class GeolocationLocationArbitratorTest : public testing::Test { 137 class GeolocationLocationArbitratorTest : public testing::Test {
108 protected: 138 protected:
109 // testing::Test 139 // testing::Test
110 void SetUp() override { 140 void SetUp() override {
111 access_token_store_ = new NiceMock<FakeAccessTokenStore>; 141 access_token_store_ = new NiceMock<FakeAccessTokenStore>;
112 observer_.reset(new MockLocationObserver); 142 observer_.reset(new MockLocationObserver);
113 LocationArbitratorImpl::LocationUpdateCallback callback = 143 LocationArbitratorImpl::LocationUpdateCallback callback =
114 base::Bind(&MockLocationObserver::OnLocationUpdate, 144 base::Bind(&MockLocationObserver::OnLocationUpdate,
115 base::Unretained(observer_.get())); 145 base::Unretained(observer_.get()));
116 arbitrator_.reset(new TestingLocationArbitrator( 146 arbitrator_.reset(new TestingLocationArbitrator(
117 callback, access_token_store_.get())); 147 callback, access_token_store_.get()));
148 override_content_browser_client_.reset(new GeolocationContentBrowserClient);
118 } 149 }
119 150
120 // testing::Test 151 // testing::Test
121 void TearDown() override {} 152 void TearDown() override {}
122 153
123 void CheckLastPositionInfo(double latitude, 154 void CheckLastPositionInfo(double latitude,
124 double longitude, 155 double longitude,
125 double accuracy) { 156 double accuracy) {
126 Geoposition geoposition = observer_->last_position_; 157 Geoposition geoposition = observer_->last_position_;
127 EXPECT_TRUE(geoposition.Validate()); 158 EXPECT_TRUE(geoposition.Validate());
128 EXPECT_DOUBLE_EQ(latitude, geoposition.latitude); 159 EXPECT_DOUBLE_EQ(latitude, geoposition.latitude);
129 EXPECT_DOUBLE_EQ(longitude, geoposition.longitude); 160 EXPECT_DOUBLE_EQ(longitude, geoposition.longitude);
130 EXPECT_DOUBLE_EQ(accuracy, geoposition.accuracy); 161 EXPECT_DOUBLE_EQ(accuracy, geoposition.accuracy);
131 } 162 }
132 163
133 base::TimeDelta SwitchOnFreshnessCliff() { 164 base::TimeDelta SwitchOnFreshnessCliff() {
134 // Add 1, to ensure it meets any greater-than test. 165 // Add 1, to ensure it meets any greater-than test.
135 return base::TimeDelta::FromMilliseconds( 166 return base::TimeDelta::FromMilliseconds(
136 LocationArbitratorImpl::kFixStaleTimeoutMilliseconds + 1); 167 LocationArbitratorImpl::kFixStaleTimeoutMilliseconds + 1);
137 } 168 }
138 169
139 MockLocationProvider* cell() { 170 MockLocationProvider* cell() {
140 return arbitrator_->cell_; 171 return arbitrator_->cell_;
141 } 172 }
142 173
143 MockLocationProvider* gps() { 174 MockLocationProvider* gps() {
144 return arbitrator_->gps_; 175 return arbitrator_->gps_;
145 } 176 }
146 177
178 MockLocationProvider* GetSystemLocationProviderOverride() {
179 return override_content_browser_client_->provider_;
180 }
181
147 scoped_refptr<FakeAccessTokenStore> access_token_store_; 182 scoped_refptr<FakeAccessTokenStore> access_token_store_;
148 std::unique_ptr<MockLocationObserver> observer_; 183 std::unique_ptr<MockLocationObserver> observer_;
149 std::unique_ptr<TestingLocationArbitrator> arbitrator_; 184 std::unique_ptr<TestingLocationArbitrator> arbitrator_;
150 base::MessageLoop loop_; 185 base::MessageLoop loop_;
186 std::unique_ptr<GeolocationContentBrowserClient>
187 override_content_browser_client_;
151 }; 188 };
152 189
153 TEST_F(GeolocationLocationArbitratorTest, CreateDestroy) { 190 TEST_F(GeolocationLocationArbitratorTest, CreateDestroy) {
154 EXPECT_TRUE(access_token_store_.get()); 191 EXPECT_TRUE(access_token_store_.get());
155 EXPECT_TRUE(arbitrator_ != NULL); 192 EXPECT_TRUE(arbitrator_);
156 arbitrator_.reset(); 193 arbitrator_.reset();
157 SUCCEED(); 194 SUCCEED();
158 } 195 }
159 196
160 TEST_F(GeolocationLocationArbitratorTest, OnPermissionGranted) { 197 TEST_F(GeolocationLocationArbitratorTest, OnPermissionGranted) {
161 EXPECT_FALSE(arbitrator_->HasPermissionBeenGranted()); 198 EXPECT_FALSE(arbitrator_->HasPermissionBeenGranted());
162 arbitrator_->OnPermissionGranted(); 199 arbitrator_->OnPermissionGranted();
163 EXPECT_TRUE(arbitrator_->HasPermissionBeenGranted()); 200 EXPECT_TRUE(arbitrator_->HasPermissionBeenGranted());
164 // Can't check the provider has been notified without going through the 201 // Can't check the provider has been notified without going through the
165 // motions to create the provider (see next test). 202 // motions to create the provider (see next test).
166 EXPECT_FALSE(cell()); 203 EXPECT_FALSE(cell());
167 EXPECT_FALSE(gps()); 204 EXPECT_FALSE(gps());
205 EXPECT_FALSE(GetSystemLocationProviderOverride());
168 } 206 }
169 207
170 TEST_F(GeolocationLocationArbitratorTest, NormalUsage) { 208 TEST_F(GeolocationLocationArbitratorTest, NormalUsage) {
171 ASSERT_TRUE(access_token_store_.get()); 209 ASSERT_TRUE(access_token_store_.get());
172 ASSERT_TRUE(arbitrator_ != NULL); 210 ASSERT_TRUE(arbitrator_);
173 211
174 EXPECT_FALSE(cell()); 212 EXPECT_FALSE(cell());
175 EXPECT_FALSE(gps()); 213 EXPECT_FALSE(gps());
214 EXPECT_FALSE(GetSystemLocationProviderOverride());
176 arbitrator_->StartProviders(false); 215 arbitrator_->StartProviders(false);
177 216
178 EXPECT_TRUE(access_token_store_->access_token_map_.empty()); 217 EXPECT_TRUE(access_token_store_->access_token_map_.empty());
179 EXPECT_TRUE(access_token_store_->access_token_map_.empty());
180 218
181 access_token_store_->NotifyDelegateTokensLoaded(); 219 access_token_store_->NotifyDelegateTokensLoaded();
182 ASSERT_TRUE(cell()); 220 ASSERT_TRUE(cell());
183 EXPECT_TRUE(gps()); 221 EXPECT_TRUE(gps());
222 EXPECT_FALSE(GetSystemLocationProviderOverride());
184 EXPECT_EQ(MockLocationProvider::LOW_ACCURACY, cell()->state_); 223 EXPECT_EQ(MockLocationProvider::LOW_ACCURACY, cell()->state_);
185 EXPECT_EQ(MockLocationProvider::LOW_ACCURACY, gps()->state_); 224 EXPECT_EQ(MockLocationProvider::LOW_ACCURACY, gps()->state_);
186 EXPECT_FALSE(observer_->last_position_.Validate()); 225 EXPECT_FALSE(observer_->last_position_.Validate());
187 EXPECT_EQ(Geoposition::ERROR_CODE_NONE, 226 EXPECT_EQ(Geoposition::ERROR_CODE_NONE,
188 observer_->last_position_.error_code); 227 observer_->last_position_.error_code);
189 228
190 SetReferencePosition(cell()); 229 SetReferencePosition(cell());
191 230
192 EXPECT_TRUE(observer_->last_position_.Validate() || 231 EXPECT_TRUE(observer_->last_position_.Validate() ||
193 observer_->last_position_.error_code != 232 observer_->last_position_.error_code !=
194 Geoposition::ERROR_CODE_NONE); 233 Geoposition::ERROR_CODE_NONE);
195 EXPECT_EQ(cell()->position_.latitude, 234 EXPECT_EQ(cell()->position_.latitude,
196 observer_->last_position_.latitude); 235 observer_->last_position_.latitude);
197 236
198 EXPECT_FALSE(cell()->is_permission_granted_); 237 EXPECT_FALSE(cell()->is_permission_granted_);
199 EXPECT_FALSE(arbitrator_->HasPermissionBeenGranted()); 238 EXPECT_FALSE(arbitrator_->HasPermissionBeenGranted());
200 arbitrator_->OnPermissionGranted(); 239 arbitrator_->OnPermissionGranted();
201 EXPECT_TRUE(arbitrator_->HasPermissionBeenGranted()); 240 EXPECT_TRUE(arbitrator_->HasPermissionBeenGranted());
202 EXPECT_TRUE(cell()->is_permission_granted_); 241 EXPECT_TRUE(cell()->is_permission_granted_);
203 } 242 }
204 243
244 TEST_F(GeolocationLocationArbitratorTest, CustomSystemProviderOnly) {
245 override_content_browser_client_->set_use_network(false);
246 SetBrowserClientForTesting(override_content_browser_client_.get());
247 ASSERT_TRUE(arbitrator_);
248
249 EXPECT_FALSE(cell());
250 EXPECT_FALSE(gps());
251 EXPECT_FALSE(GetSystemLocationProviderOverride());
252 arbitrator_->StartProviders(false);
253
254 ASSERT_FALSE(cell());
255 EXPECT_FALSE(gps());
256 EXPECT_TRUE(GetSystemLocationProviderOverride());
257 EXPECT_EQ(MockLocationProvider::LOW_ACCURACY,
258 GetSystemLocationProviderOverride()->state_);
259 EXPECT_FALSE(observer_->last_position_.Validate());
260 EXPECT_EQ(Geoposition::ERROR_CODE_NONE, observer_->last_position_.error_code);
261
262 SetReferencePosition(GetSystemLocationProviderOverride());
263
264 EXPECT_TRUE(observer_->last_position_.Validate() ||
265 observer_->last_position_.error_code !=
266 Geoposition::ERROR_CODE_NONE);
267 EXPECT_EQ(GetSystemLocationProviderOverride()->position_.latitude,
268 observer_->last_position_.latitude);
269
270 EXPECT_FALSE(GetSystemLocationProviderOverride()->is_permission_granted_);
271 EXPECT_FALSE(arbitrator_->HasPermissionBeenGranted());
272 arbitrator_->OnPermissionGranted();
273 EXPECT_TRUE(arbitrator_->HasPermissionBeenGranted());
274 EXPECT_TRUE(GetSystemLocationProviderOverride()->is_permission_granted_);
275 }
276
277 TEST_F(GeolocationLocationArbitratorTest,
278 CustomSystemAndDefaultNetworkProviders) {
279 override_content_browser_client_->set_use_network(true);
280 content::SetBrowserClientForTesting(override_content_browser_client_.get());
281 ASSERT_TRUE(arbitrator_);
282
283 EXPECT_FALSE(cell());
284 EXPECT_FALSE(gps());
285 EXPECT_FALSE(GetSystemLocationProviderOverride());
286 arbitrator_->StartProviders(false);
287
288 EXPECT_TRUE(access_token_store_->access_token_map_.empty());
289
290 access_token_store_->NotifyDelegateTokensLoaded();
291
292 ASSERT_TRUE(cell());
293 EXPECT_FALSE(gps());
294 EXPECT_TRUE(GetSystemLocationProviderOverride());
295 EXPECT_EQ(MockLocationProvider::LOW_ACCURACY,
296 GetSystemLocationProviderOverride()->state_);
297 EXPECT_EQ(MockLocationProvider::LOW_ACCURACY, cell()->state_);
298 EXPECT_FALSE(observer_->last_position_.Validate());
299 EXPECT_EQ(Geoposition::ERROR_CODE_NONE, observer_->last_position_.error_code);
300
301 SetReferencePosition(cell());
302
303 EXPECT_TRUE(observer_->last_position_.Validate() ||
304 observer_->last_position_.error_code !=
305 Geoposition::ERROR_CODE_NONE);
306 EXPECT_EQ(cell()->position_.latitude, observer_->last_position_.latitude);
307
308 EXPECT_FALSE(cell()->is_permission_granted_);
309 EXPECT_FALSE(arbitrator_->HasPermissionBeenGranted());
310 arbitrator_->OnPermissionGranted();
311 EXPECT_TRUE(arbitrator_->HasPermissionBeenGranted());
312 EXPECT_TRUE(cell()->is_permission_granted_);
313 }
314
205 TEST_F(GeolocationLocationArbitratorTest, SetObserverOptions) { 315 TEST_F(GeolocationLocationArbitratorTest, SetObserverOptions) {
206 arbitrator_->StartProviders(false); 316 arbitrator_->StartProviders(false);
207 access_token_store_->NotifyDelegateTokensLoaded(); 317 access_token_store_->NotifyDelegateTokensLoaded();
208 ASSERT_TRUE(cell()); 318 ASSERT_TRUE(cell());
209 ASSERT_TRUE(gps()); 319 ASSERT_TRUE(gps());
320 EXPECT_FALSE(GetSystemLocationProviderOverride());
210 EXPECT_EQ(MockLocationProvider::LOW_ACCURACY, cell()->state_); 321 EXPECT_EQ(MockLocationProvider::LOW_ACCURACY, cell()->state_);
211 EXPECT_EQ(MockLocationProvider::LOW_ACCURACY, gps()->state_); 322 EXPECT_EQ(MockLocationProvider::LOW_ACCURACY, gps()->state_);
212 SetReferencePosition(cell()); 323 SetReferencePosition(cell());
213 EXPECT_EQ(MockLocationProvider::LOW_ACCURACY, cell()->state_); 324 EXPECT_EQ(MockLocationProvider::LOW_ACCURACY, cell()->state_);
214 EXPECT_EQ(MockLocationProvider::LOW_ACCURACY, gps()->state_); 325 EXPECT_EQ(MockLocationProvider::LOW_ACCURACY, gps()->state_);
215 arbitrator_->StartProviders(true); 326 arbitrator_->StartProviders(true);
216 EXPECT_EQ(MockLocationProvider::HIGH_ACCURACY, cell()->state_); 327 EXPECT_EQ(MockLocationProvider::HIGH_ACCURACY, cell()->state_);
217 EXPECT_EQ(MockLocationProvider::HIGH_ACCURACY, gps()->state_); 328 EXPECT_EQ(MockLocationProvider::HIGH_ACCURACY, gps()->state_);
329 EXPECT_FALSE(GetSystemLocationProviderOverride());
218 } 330 }
219 331
220 TEST_F(GeolocationLocationArbitratorTest, Arbitration) { 332 TEST_F(GeolocationLocationArbitratorTest, Arbitration) {
221 arbitrator_->StartProviders(false); 333 arbitrator_->StartProviders(false);
222 access_token_store_->NotifyDelegateTokensLoaded(); 334 access_token_store_->NotifyDelegateTokensLoaded();
223 ASSERT_TRUE(cell()); 335 ASSERT_TRUE(cell());
224 ASSERT_TRUE(gps()); 336 ASSERT_TRUE(gps());
337 EXPECT_FALSE(GetSystemLocationProviderOverride());
225 338
226 SetPositionFix(cell(), 1, 2, 150); 339 SetPositionFix(cell(), 1, 2, 150);
227 340
228 // First position available 341 // First position available
229 EXPECT_TRUE(observer_->last_position_.Validate()); 342 EXPECT_TRUE(observer_->last_position_.Validate());
230 CheckLastPositionInfo(1, 2, 150); 343 CheckLastPositionInfo(1, 2, 150);
231 344
232 SetPositionFix(gps(), 3, 4, 50); 345 SetPositionFix(gps(), 3, 4, 50);
233 346
234 // More accurate fix available 347 // More accurate fix available
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 // Arrive in station. Cell moves but GPS is stale. Switch to fresher cell. 404 // Arrive in station. Cell moves but GPS is stale. Switch to fresher cell.
292 SetPositionFix(cell(), 3.5658700, 139.069979, 1000); 405 SetPositionFix(cell(), 3.5658700, 139.069979, 1000);
293 CheckLastPositionInfo(3.5658700, 139.069979, 1000); 406 CheckLastPositionInfo(3.5658700, 139.069979, 1000);
294 } 407 }
295 408
296 TEST_F(GeolocationLocationArbitratorTest, TwoOneShotsIsNewPositionBetter) { 409 TEST_F(GeolocationLocationArbitratorTest, TwoOneShotsIsNewPositionBetter) {
297 arbitrator_->StartProviders(false); 410 arbitrator_->StartProviders(false);
298 access_token_store_->NotifyDelegateTokensLoaded(); 411 access_token_store_->NotifyDelegateTokensLoaded();
299 ASSERT_TRUE(cell()); 412 ASSERT_TRUE(cell());
300 ASSERT_TRUE(gps()); 413 ASSERT_TRUE(gps());
414 EXPECT_FALSE(GetSystemLocationProviderOverride());
301 415
302 // Set the initial position. 416 // Set the initial position.
303 SetPositionFix(cell(), 3, 139, 100); 417 SetPositionFix(cell(), 3, 139, 100);
304 CheckLastPositionInfo(3, 139, 100); 418 CheckLastPositionInfo(3, 139, 100);
305 419
306 // Restart providers to simulate a one-shot request. 420 // Restart providers to simulate a one-shot request.
307 arbitrator_->StopProviders(); 421 arbitrator_->StopProviders();
308 422
309 // To test 240956, perform a throwaway alloc. 423 // To test 240956, perform a throwaway alloc.
310 // This convinces the allocator to put the providers in a new memory location. 424 // This convinces the allocator to put the providers in a new memory location.
311 MockLocationProvider* fakeMockProvider = NULL; 425 std::unique_ptr<MockLocationProvider> dummy_provider(
312 LocationProvider* fakeProvider = 426 new MockLocationProvider);
313 new MockLocationProvider(&fakeMockProvider);
314 427
315 arbitrator_->StartProviders(false); 428 arbitrator_->StartProviders(false);
316 access_token_store_->NotifyDelegateTokensLoaded(); 429 access_token_store_->NotifyDelegateTokensLoaded();
317 430
318 // Advance the time a short while to simulate successive calls. 431 // Advance the time a short while to simulate successive calls.
319 AdvanceTimeNow(base::TimeDelta::FromMilliseconds(5)); 432 AdvanceTimeNow(base::TimeDelta::FromMilliseconds(5));
320 433
321 // Update with a less accurate position to verify 240956. 434 // Update with a less accurate position to verify 240956.
322 SetPositionFix(cell(), 3, 139, 150); 435 SetPositionFix(cell(), 3, 139, 150);
323 CheckLastPositionInfo(3, 139, 150); 436 CheckLastPositionInfo(3, 139, 150);
324
325 // No delete required for fakeMockProvider. It points to fakeProvider.
326 delete fakeProvider;
327 } 437 }
328 438
329 } // namespace content 439 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698