| OLD | NEW |
| 1 // Copyright (c) 2011 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" |
| 11 #include "content/browser/geolocation/mock_location_provider.h" | 11 #include "content/browser/geolocation/mock_location_provider.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // Object under tests. Owned, but not a scoped_ptr due to specialized | 54 // Object under tests. Owned, but not a scoped_ptr due to specialized |
| 55 // destruction protocol. | 55 // destruction protocol. |
| 56 GeolocationProvider* provider_; | 56 GeolocationProvider* provider_; |
| 57 | 57 |
| 58 scoped_refptr<GeolocationArbitratorDependencyFactory> dependency_factory_; | 58 scoped_refptr<GeolocationArbitratorDependencyFactory> dependency_factory_; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 // Regression test for http://crbug.com/59377 | 61 // Regression test for http://crbug.com/59377 |
| 62 TEST_F(GeolocationProviderTest, OnPermissionGrantedWithoutObservers) { | 62 TEST_F(GeolocationProviderTest, OnPermissionGrantedWithoutObservers) { |
| 63 EXPECT_FALSE(provider_->HasPermissionBeenGranted()); | 63 EXPECT_FALSE(provider_->HasPermissionBeenGranted()); |
| 64 provider_->OnPermissionGranted(GURL("http://example.com")); | 64 provider_->OnPermissionGranted(); |
| 65 EXPECT_TRUE(provider_->HasPermissionBeenGranted()); | 65 EXPECT_TRUE(provider_->HasPermissionBeenGranted()); |
| 66 } | 66 } |
| 67 | 67 |
| 68 class NullGeolocationObserver : public GeolocationObserver { | 68 class NullGeolocationObserver : public GeolocationObserver { |
| 69 public: | 69 public: |
| 70 // GeolocationObserver | 70 // GeolocationObserver |
| 71 virtual void OnLocationUpdate(const Geoposition& position) {} | 71 virtual void OnLocationUpdate(const Geoposition& position) {} |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 class StartStopMockLocationProvider : public MockLocationProvider { | 74 class StartStopMockLocationProvider : public MockLocationProvider { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 provider_->RemoveObserver(&null_observer); | 173 provider_->RemoveObserver(&null_observer); |
| 174 // Wait for the providers to be stopped. | 174 // Wait for the providers to be stopped. |
| 175 event.Wait(); | 175 event.Wait(); |
| 176 event.Reset(); | 176 event.Reset(); |
| 177 EXPECT_TRUE(provider_->IsRunning()); | 177 EXPECT_TRUE(provider_->IsRunning()); |
| 178 | 178 |
| 179 GeolocationArbitrator::SetDependencyFactoryForTest(NULL); | 179 GeolocationArbitrator::SetDependencyFactoryForTest(NULL); |
| 180 } | 180 } |
| 181 | 181 |
| 182 } // namespace | 182 } // namespace |
| OLD | NEW |