| 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/callback.h" | 5 #include "base/callback.h" |
| 6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
| 7 #include "content/browser/geofencing/geofencing_manager.h" | 7 #include "content/browser/geofencing/geofencing_manager.h" |
| 8 #include "content/browser/geofencing/geofencing_service.h" | 8 #include "content/browser/geofencing/geofencing_service.h" |
| 9 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 9 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| 10 #include "content/public/test/test_browser_thread_bundle.h" | 10 #include "content/public/test/test_browser_thread_bundle.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 class GeofencingManagerTest : public testing::Test { | 81 class GeofencingManagerTest : public testing::Test { |
| 82 public: | 82 public: |
| 83 GeofencingManagerTest() : service_(nullptr) { | 83 GeofencingManagerTest() : service_(nullptr) { |
| 84 test_region_.latitude = 37.421999; | 84 test_region_.latitude = 37.421999; |
| 85 test_region_.longitude = -122.084015; | 85 test_region_.longitude = -122.084015; |
| 86 test_region_.radius = 100; | 86 test_region_.radius = 100; |
| 87 expected_regions_[kTestRegionId] = test_region_; | 87 expected_regions_[kTestRegionId] = test_region_; |
| 88 } | 88 } |
| 89 | 89 |
| 90 virtual void SetUp() { | 90 void SetUp() override { |
| 91 service_ = new TestGeofencingService(); | 91 service_ = new TestGeofencingService(); |
| 92 ON_CALL(*service_, IsServiceAvailable()) | 92 ON_CALL(*service_, IsServiceAvailable()) |
| 93 .WillByDefault(testing::Return(false)); | 93 .WillByDefault(testing::Return(false)); |
| 94 manager_ = new GeofencingManager(nullptr /* ServiceWorkerContextWrapper */); | 94 manager_ = new GeofencingManager(nullptr /* ServiceWorkerContextWrapper */); |
| 95 manager_->SetServiceForTesting(service_); | 95 manager_->SetServiceForTesting(service_); |
| 96 } | 96 } |
| 97 | 97 |
| 98 virtual void TearDown() { | 98 void TearDown() override { |
| 99 manager_ = nullptr; | 99 manager_ = nullptr; |
| 100 delete service_; | 100 delete service_; |
| 101 service_ = nullptr; | 101 service_ = nullptr; |
| 102 } | 102 } |
| 103 | 103 |
| 104 void SetHasProviderForTests() { | 104 void SetHasProviderForTests() { |
| 105 ON_CALL(*service_, IsServiceAvailable()) | 105 ON_CALL(*service_, IsServiceAvailable()) |
| 106 .WillByDefault(testing::Return(true)); | 106 .WillByDefault(testing::Return(true)); |
| 107 } | 107 } |
| 108 | 108 |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 GEOFENCING_STATUS_OK, | 405 GEOFENCING_STATUS_OK, |
| 406 kTestGeofencingRegistrationId)); | 406 kTestGeofencingRegistrationId)); |
| 407 | 407 |
| 408 EXPECT_CALL(*service_, UnregisterRegion(kTestGeofencingRegistrationId)) | 408 EXPECT_CALL(*service_, UnregisterRegion(kTestGeofencingRegistrationId)) |
| 409 .WillOnce(QuitRunner(runner)); | 409 .WillOnce(QuitRunner(runner)); |
| 410 manager_->Shutdown(); | 410 manager_->Shutdown(); |
| 411 runner->Run(); | 411 runner->Run(); |
| 412 } | 412 } |
| 413 | 413 |
| 414 } // namespace content | 414 } // namespace content |
| OLD | NEW |