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/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "content/browser/geolocation/fake_access_token_store.h" | 6 #include "content/browser/geolocation/fake_access_token_store.h" |
7 #include "content/browser/geolocation/geolocation_observer.h" | 7 #include "content/browser/geolocation/geolocation_observer.h" |
8 #include "content/browser/geolocation/location_arbitrator_impl.h" | 8 #include "content/browser/geolocation/location_arbitrator_impl.h" |
9 #include "content/browser/geolocation/location_provider.h" | 9 #include "content/browser/geolocation/location_provider.h" |
10 #include "content/browser/geolocation/mock_location_provider.h" | 10 #include "content/browser/geolocation/mock_location_provider.h" |
11 #include "content/public/common/geoposition.h" | 11 #include "content/public/common/geoposition.h" |
12 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 using ::testing::NiceMock; | 15 using ::testing::NiceMock; |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 | 18 |
19 class MockLocationObserver : public GeolocationObserver { | 19 class MockLocationObserver : public GeolocationObserver { |
20 public: | 20 public: |
21 void InvalidateLastPosition() { | 21 void InvalidateLastPosition() { |
22 last_position_.latitude = 100; | 22 last_position_.latitude = 100; |
23 last_position_.error_code = Geoposition::ERROR_CODE_NONE; | 23 last_position_.error_code = Geoposition::ERROR_CODE_NONE; |
24 ASSERT_FALSE(last_position_.Validate()); | 24 ASSERT_FALSE(last_position_.Validate()); |
25 } | 25 } |
26 // Delegate | 26 // Delegate |
27 virtual void OnLocationUpdate(const Geoposition& position) { | 27 virtual void OnLocationUpdate(const Geoposition& position) OVERRIDE { |
28 last_position_ = position; | 28 last_position_ = position; |
29 } | 29 } |
30 | 30 |
31 Geoposition last_position_; | 31 Geoposition last_position_; |
32 }; | 32 }; |
33 | 33 |
34 double g_fake_time_now_secs = 1; | 34 double g_fake_time_now_secs = 1; |
35 | 35 |
36 base::Time GetTimeNowForTest() { | 36 base::Time GetTimeNowForTest() { |
37 return base::Time::FromDoubleT(g_fake_time_now_secs); | 37 return base::Time::FromDoubleT(g_fake_time_now_secs); |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 CheckLastPositionInfo(3.5657104, 139.690341, 300); | 285 CheckLastPositionInfo(3.5657104, 139.690341, 300); |
286 | 286 |
287 // 2 minutes later | 287 // 2 minutes later |
288 AdvanceTimeNow(base::TimeDelta::FromMinutes(2)); | 288 AdvanceTimeNow(base::TimeDelta::FromMinutes(2)); |
289 // Arrive in station. Cell moves but GPS is stale. Switch to fresher cell. | 289 // Arrive in station. Cell moves but GPS is stale. Switch to fresher cell. |
290 SetPositionFix(cell(), 3.5658700, 139.069979, 1000); | 290 SetPositionFix(cell(), 3.5658700, 139.069979, 1000); |
291 CheckLastPositionInfo(3.5658700, 139.069979, 1000); | 291 CheckLastPositionInfo(3.5658700, 139.069979, 1000); |
292 } | 292 } |
293 | 293 |
294 } // namespace content | 294 } // namespace content |
OLD | NEW |