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 #include "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "content/browser/geolocation/fake_access_token_store.h" | 7 #include "content/browser/geolocation/fake_access_token_store.h" |
8 #include "content/browser/geolocation/location_arbitrator_impl.h" | 8 #include "content/browser/geolocation/location_arbitrator_impl.h" |
9 #include "content/browser/geolocation/mock_location_provider.h" | 9 #include "content/browser/geolocation/mock_location_provider.h" |
10 #include "content/public/common/geoposition.h" | 10 #include "content/public/common/geoposition.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 public: | 66 public: |
67 TestingLocationArbitrator( | 67 TestingLocationArbitrator( |
68 const LocationArbitratorImpl::LocationUpdateCallback& callback, | 68 const LocationArbitratorImpl::LocationUpdateCallback& callback, |
69 AccessTokenStore* access_token_store) | 69 AccessTokenStore* access_token_store) |
70 : LocationArbitratorImpl(callback), | 70 : LocationArbitratorImpl(callback), |
71 cell_(NULL), | 71 cell_(NULL), |
72 gps_(NULL), | 72 gps_(NULL), |
73 access_token_store_(access_token_store) { | 73 access_token_store_(access_token_store) { |
74 } | 74 } |
75 | 75 |
76 virtual base::Time GetTimeNow() const OVERRIDE { | 76 virtual base::Time GetTimeNow() const override { |
77 return GetTimeNowForTest(); | 77 return GetTimeNowForTest(); |
78 } | 78 } |
79 | 79 |
80 virtual AccessTokenStore* NewAccessTokenStore() OVERRIDE { | 80 virtual AccessTokenStore* NewAccessTokenStore() override { |
81 return access_token_store_.get(); | 81 return access_token_store_.get(); |
82 } | 82 } |
83 | 83 |
84 virtual LocationProvider* NewNetworkLocationProvider( | 84 virtual LocationProvider* NewNetworkLocationProvider( |
85 AccessTokenStore* access_token_store, | 85 AccessTokenStore* access_token_store, |
86 net::URLRequestContextGetter* context, | 86 net::URLRequestContextGetter* context, |
87 const GURL& url, | 87 const GURL& url, |
88 const base::string16& access_token) OVERRIDE { | 88 const base::string16& access_token) override { |
89 return new MockLocationProvider(&cell_); | 89 return new MockLocationProvider(&cell_); |
90 } | 90 } |
91 | 91 |
92 virtual LocationProvider* NewSystemLocationProvider() OVERRIDE { | 92 virtual LocationProvider* NewSystemLocationProvider() override { |
93 return new MockLocationProvider(&gps_); | 93 return new MockLocationProvider(&gps_); |
94 } | 94 } |
95 | 95 |
96 // Two location providers, with nice short names to make the tests more | 96 // 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 | 97 // 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 | 98 // observer registered (and |cell_| when there's at least one observer of any |
99 // type). | 99 // type). |
100 MockLocationProvider* cell_; | 100 MockLocationProvider* cell_; |
101 MockLocationProvider* gps_; | 101 MockLocationProvider* gps_; |
102 scoped_refptr<AccessTokenStore> access_token_store_; | 102 scoped_refptr<AccessTokenStore> access_token_store_; |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 | 321 |
322 // Update with a less accurate position to verify 240956. | 322 // Update with a less accurate position to verify 240956. |
323 SetPositionFix(cell(), 3, 139, 150); | 323 SetPositionFix(cell(), 3, 139, 150); |
324 CheckLastPositionInfo(3, 139, 150); | 324 CheckLastPositionInfo(3, 139, 150); |
325 | 325 |
326 // No delete required for fakeMockProvider. It points to fakeProvider. | 326 // No delete required for fakeMockProvider. It points to fakeProvider. |
327 delete fakeProvider; | 327 delete fakeProvider; |
328 } | 328 } |
329 | 329 |
330 } // namespace content | 330 } // namespace content |
OLD | NEW |