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/singleton.h" | 5 #include "base/memory/singleton.h" |
6 #include "base/synchronization/waitable_event.h" | 6 #include "base/synchronization/waitable_event.h" |
7 #include "content/browser/geolocation/arbitrator_dependency_factories_for_test.h
" | 7 #include "content/browser/geolocation/arbitrator_dependency_factories_for_test.h
" |
8 #include "content/browser/geolocation/fake_access_token_store.h" | 8 #include "content/browser/geolocation/fake_access_token_store.h" |
9 #include "content/browser/geolocation/geolocation_provider.h" | 9 #include "content/browser/geolocation/geolocation_provider.h" |
10 #include "content/browser/geolocation/location_arbitrator.h" | 10 #include "content/browser/geolocation/location_arbitrator.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 const GURL& url, | 131 const GURL& url, |
132 const string16& access_token) { | 132 const string16& access_token) { |
133 return new StartStopMockLocationProvider(test_loop_); | 133 return new StartStopMockLocationProvider(test_loop_); |
134 } | 134 } |
135 | 135 |
136 virtual LocationProviderBase* NewSystemLocationProvider() { | 136 virtual LocationProviderBase* NewSystemLocationProvider() { |
137 return NULL; | 137 return NULL; |
138 } | 138 } |
139 | 139 |
140 private: | 140 private: |
| 141 virtual ~MockDependencyFactory() {} |
| 142 |
141 MessageLoop* test_loop_; | 143 MessageLoop* test_loop_; |
142 scoped_refptr<AccessTokenStore> access_token_store_; | 144 scoped_refptr<AccessTokenStore> access_token_store_; |
143 }; | 145 }; |
144 | 146 |
145 TEST_F(GeolocationProviderTest, StartStop) { | 147 TEST_F(GeolocationProviderTest, StartStop) { |
146 scoped_refptr<FakeAccessTokenStore> fake_access_token_store = | 148 scoped_refptr<FakeAccessTokenStore> fake_access_token_store = |
147 new FakeAccessTokenStore; | 149 new FakeAccessTokenStore; |
148 scoped_refptr<GeolocationArbitratorDependencyFactory> dependency_factory = | 150 scoped_refptr<GeolocationArbitratorDependencyFactory> dependency_factory = |
149 new MockDependencyFactory(&message_loop_, fake_access_token_store.get()); | 151 new MockDependencyFactory(&message_loop_, fake_access_token_store.get()); |
150 base::WaitableEvent event(false, false); | 152 base::WaitableEvent event(false, false); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 testing::Field( | 206 testing::Field( |
205 &Geoposition::error_code, | 207 &Geoposition::error_code, |
206 testing::Eq(Geoposition::ERROR_CODE_POSITION_UNAVAILABLE)))); | 208 testing::Eq(Geoposition::ERROR_CODE_POSITION_UNAVAILABLE)))); |
207 provider_->AddObserver(&mock_observer, GeolocationObserverOptions()); | 209 provider_->AddObserver(&mock_observer, GeolocationObserverOptions()); |
208 provider_->RemoveObserver(&mock_observer); | 210 provider_->RemoveObserver(&mock_observer); |
209 | 211 |
210 GeolocationArbitrator::SetDependencyFactoryForTest(NULL); | 212 GeolocationArbitrator::SetDependencyFactoryForTest(NULL); |
211 } | 213 } |
212 | 214 |
213 } // namespace | 215 } // namespace |
OLD | NEW |