| 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 "content/browser/geofencing/geofencing_provider.h" | 5 #include "content/browser/geofencing/geofencing_provider.h" |
| 6 #include "content/browser/geofencing/geofencing_registration_delegate.h" | 6 #include "content/browser/geofencing/geofencing_registration_delegate.h" |
| 7 #include "content/browser/geofencing/geofencing_service.h" | 7 #include "content/browser/geofencing/geofencing_service.h" |
| 8 #include "content/public/test/test_browser_thread_bundle.h" | 8 #include "content/public/test/test_browser_thread_bundle.h" |
| 9 #include "content/public/test/test_utils.h" | 9 #include "content/public/test/test_utils.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } | 59 } |
| 60 | 60 |
| 61 class GeofencingServiceTest : public testing::Test { | 61 class GeofencingServiceTest : public testing::Test { |
| 62 public: | 62 public: |
| 63 GeofencingServiceTest() : service_(nullptr) { | 63 GeofencingServiceTest() : service_(nullptr) { |
| 64 test_region_.latitude = 37.421999; | 64 test_region_.latitude = 37.421999; |
| 65 test_region_.longitude = -122.084015; | 65 test_region_.longitude = -122.084015; |
| 66 test_region_.radius = 100; | 66 test_region_.radius = 100; |
| 67 } | 67 } |
| 68 | 68 |
| 69 virtual void SetUp() { service_ = new GeofencingServiceImpl(); } | 69 void SetUp() override { service_ = new GeofencingServiceImpl(); } |
| 70 | 70 |
| 71 virtual void TearDown() { delete service_; } | 71 void TearDown() override { delete service_; } |
| 72 | 72 |
| 73 void SetProviderForTests() { | 73 void SetProviderForTests() { |
| 74 provider_ = new MockGeofencingProvider(); | 74 provider_ = new MockGeofencingProvider(); |
| 75 service_->SetProviderForTesting(make_scoped_ptr(provider_)); | 75 service_->SetProviderForTesting(make_scoped_ptr(provider_)); |
| 76 } | 76 } |
| 77 | 77 |
| 78 int RegistrationCount() { return service_->RegistrationCountForTesting(); } | 78 int RegistrationCount() { return service_->RegistrationCountForTesting(); } |
| 79 | 79 |
| 80 int64 RegisterRegionSync(const WebCircularGeofencingRegion& region, | 80 int64 RegisterRegionSync(const WebCircularGeofencingRegion& region, |
| 81 GeofencingStatus provider_status) { | 81 GeofencingStatus provider_status) { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 // provider to be called. The delegate should not be called in this case. | 182 // provider to be called. The delegate should not be called in this case. |
| 183 EXPECT_CALL(delegate_, RegistrationFinished(testing::_, testing::_)).Times(0); | 183 EXPECT_CALL(delegate_, RegistrationFinished(testing::_, testing::_)).Times(0); |
| 184 EXPECT_CALL(*provider_, UnregisterRegion(geofencing_registration_id)) | 184 EXPECT_CALL(*provider_, UnregisterRegion(geofencing_registration_id)) |
| 185 .WillOnce(QuitRunner(runner)); | 185 .WillOnce(QuitRunner(runner)); |
| 186 callback.Run(GEOFENCING_STATUS_OK); | 186 callback.Run(GEOFENCING_STATUS_OK); |
| 187 runner->Run(); | 187 runner->Run(); |
| 188 EXPECT_EQ(0, RegistrationCount()); | 188 EXPECT_EQ(0, RegistrationCount()); |
| 189 } | 189 } |
| 190 | 190 |
| 191 } // namespace content | 191 } // namespace content |
| OLD | NEW |