OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 111 } |
112 | 112 |
113 class GeolocationProviderTest : public testing::Test { | 113 class GeolocationProviderTest : public testing::Test { |
114 protected: | 114 protected: |
115 GeolocationProviderTest() | 115 GeolocationProviderTest() |
116 : message_loop_(), | 116 : message_loop_(), |
117 ui_thread_(BrowserThread::UI, &message_loop_), | 117 ui_thread_(BrowserThread::UI, &message_loop_), |
118 provider_(new LocationProviderForTestArbitrator) { | 118 provider_(new LocationProviderForTestArbitrator) { |
119 } | 119 } |
120 | 120 |
121 virtual ~GeolocationProviderTest() {} | 121 ~GeolocationProviderTest() override {} |
122 | 122 |
123 LocationProviderForTestArbitrator* provider() { return provider_.get(); } | 123 LocationProviderForTestArbitrator* provider() { return provider_.get(); } |
124 | 124 |
125 // Called on test thread. | 125 // Called on test thread. |
126 bool ProvidersStarted(); | 126 bool ProvidersStarted(); |
127 void SendMockLocation(const Geoposition& position); | 127 void SendMockLocation(const Geoposition& position); |
128 | 128 |
129 private: | 129 private: |
130 // Called on provider thread. | 130 // Called on provider thread. |
131 void GetProvidersStarted(bool* started); | 131 void GetProvidersStarted(bool* started); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 &MockGeolocationObserver::OnLocationUpdate, | 249 &MockGeolocationObserver::OnLocationUpdate, |
250 base::Unretained(&mock_observer)); | 250 base::Unretained(&mock_observer)); |
251 scoped_ptr<content::GeolocationProvider::Subscription> subscription = | 251 scoped_ptr<content::GeolocationProvider::Subscription> subscription = |
252 provider()->AddLocationUpdateCallback(callback, false); | 252 provider()->AddLocationUpdateCallback(callback, false); |
253 subscription.reset(); | 253 subscription.reset(); |
254 // Wait for the providers to be stopped now that all clients are gone. | 254 // Wait for the providers to be stopped now that all clients are gone. |
255 EXPECT_FALSE(ProvidersStarted()); | 255 EXPECT_FALSE(ProvidersStarted()); |
256 } | 256 } |
257 | 257 |
258 } // namespace content | 258 } // namespace content |
OLD | NEW |