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/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 virtual void LoadAccessTokens(const LoadAccessTokensCallbackType& callback) | 62 virtual void LoadAccessTokens(const LoadAccessTokensCallbackType& callback) |
63 OVERRIDE { | 63 OVERRIDE { |
64 callback.Run(AccessTokenSet(), NULL); | 64 callback.Run(AccessTokenSet(), NULL); |
65 event_->Signal(); | 65 event_->Signal(); |
66 } | 66 } |
67 | 67 |
68 virtual void SaveAccessToken(const GURL& server_url, | 68 virtual void SaveAccessToken(const GURL& server_url, |
69 const string16& access_token) OVERRIDE {} | 69 const string16& access_token) OVERRIDE {} |
70 | 70 |
| 71 protected: |
| 72 virtual ~TestingAccessTokenStore() {} |
| 73 |
71 private: | 74 private: |
72 base::WaitableEvent* event_; | 75 base::WaitableEvent* event_; |
73 }; | 76 }; |
74 | 77 |
75 class TestingDependencyFactory | 78 class TestingDependencyFactory |
76 : public DefaultGeolocationArbitratorDependencyFactory { | 79 : public DefaultGeolocationArbitratorDependencyFactory { |
77 public: | 80 public: |
78 TestingDependencyFactory(base::WaitableEvent* event) : event_(event) {} | 81 TestingDependencyFactory(base::WaitableEvent* event) : event_(event) {} |
79 | 82 |
80 virtual content::AccessTokenStore* NewAccessTokenStore() OVERRIDE { | 83 virtual content::AccessTokenStore* NewAccessTokenStore() OVERRIDE { |
81 return new TestingAccessTokenStore(event_); | 84 return new TestingAccessTokenStore(event_); |
82 } | 85 } |
83 | 86 |
84 virtual LocationProviderBase* NewNetworkLocationProvider( | 87 virtual LocationProviderBase* NewNetworkLocationProvider( |
85 content::AccessTokenStore* access_token_store, | 88 content::AccessTokenStore* access_token_store, |
86 net::URLRequestContextGetter* context, | 89 net::URLRequestContextGetter* context, |
87 const GURL& url, | 90 const GURL& url, |
88 const string16& access_token) OVERRIDE { | 91 const string16& access_token) OVERRIDE { |
89 return new StartStopMockLocationProvider(event_); | 92 return new StartStopMockLocationProvider(event_); |
90 } | 93 } |
91 | 94 |
92 virtual LocationProviderBase* NewSystemLocationProvider() OVERRIDE { | 95 virtual LocationProviderBase* NewSystemLocationProvider() OVERRIDE { |
93 return NULL; | 96 return NULL; |
94 } | 97 } |
95 | 98 |
| 99 protected: |
| 100 virtual ~TestingDependencyFactory() {} |
| 101 |
96 private: | 102 private: |
97 base::WaitableEvent* event_; | 103 base::WaitableEvent* event_; |
98 }; | 104 }; |
99 | 105 |
100 class NullGeolocationObserver : public GeolocationObserver { | 106 class NullGeolocationObserver : public GeolocationObserver { |
101 public: | 107 public: |
102 // GeolocationObserver | 108 // GeolocationObserver |
103 virtual void OnLocationUpdate(const content::Geoposition& position) {} | 109 virtual void OnLocationUpdate(const content::Geoposition& position) {} |
104 }; | 110 }; |
105 | 111 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 position.longitude = 34; | 242 position.longitude = 34; |
237 position.accuracy = 56; | 243 position.accuracy = 56; |
238 position.timestamp = base::Time::Now(); | 244 position.timestamp = base::Time::Now(); |
239 EXPECT_CALL(callback_wrapper, Callback(GeopositionEq(position))); | 245 EXPECT_CALL(callback_wrapper, Callback(GeopositionEq(position))); |
240 provider_->OverrideLocationForTesting(position); | 246 provider_->OverrideLocationForTesting(position); |
241 // Wait for the providers to be stopped now that all clients are gone. | 247 // Wait for the providers to be stopped now that all clients are gone. |
242 WaitAndReset(); | 248 WaitAndReset(); |
243 } | 249 } |
244 | 250 |
245 } // namespace | 251 } // namespace |
OLD | NEW |