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/embedded_worker_test_helper.h" | 9 #include "content/browser/service_worker/embedded_worker_test_helper.h" |
10 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 10 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 class GeofencingManagerTest : public testing::Test { | 116 class GeofencingManagerTest : public testing::Test { |
117 public: | 117 public: |
118 GeofencingManagerTest() : service_(nullptr) { | 118 GeofencingManagerTest() : service_(nullptr) { |
119 test_region_.latitude = 37.421999; | 119 test_region_.latitude = 37.421999; |
120 test_region_.longitude = -122.084015; | 120 test_region_.longitude = -122.084015; |
121 test_region_.radius = 100; | 121 test_region_.radius = 100; |
122 expected_regions_[kTestRegionId] = test_region_; | 122 expected_regions_[kTestRegionId] = test_region_; |
123 } | 123 } |
124 | 124 |
125 void SetUp() override { | 125 void SetUp() override { |
126 helper_.reset(new EmbeddedWorkerTestHelper(kRenderProcessId)); | 126 helper_.reset( |
| 127 new EmbeddedWorkerTestHelper(base::FilePath(), kRenderProcessId)); |
127 service_ = new TestGeofencingService(); | 128 service_ = new TestGeofencingService(); |
128 manager_ = new GeofencingManager(helper_->context_wrapper()); | 129 manager_ = new GeofencingManager(helper_->context_wrapper()); |
129 manager_->SetServiceForTesting(service_); | 130 manager_->SetServiceForTesting(service_); |
130 manager_->Init(); | 131 manager_->Init(); |
131 | 132 |
132 worker1_ = RegisterServiceWorker("1"); | 133 worker1_ = RegisterServiceWorker("1"); |
133 worker2_ = RegisterServiceWorker("2"); | 134 worker2_ = RegisterServiceWorker("2"); |
134 } | 135 } |
135 | 136 |
136 void TearDown() override { | 137 void TearDown() override { |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 GEOFENCING_STATUS_OK, kTestGeofencingRegistrationId)); | 508 GEOFENCING_STATUS_OK, kTestGeofencingRegistrationId)); |
508 VerifyRegions(worker1_->id(), expected_regions_); | 509 VerifyRegions(worker1_->id(), expected_regions_); |
509 | 510 |
510 EXPECT_CALL(*service_, UnregisterRegion(kTestGeofencingRegistrationId)); | 511 EXPECT_CALL(*service_, UnregisterRegion(kTestGeofencingRegistrationId)); |
511 | 512 |
512 manager_->SetMockProvider(GeofencingMockState::SERVICE_AVAILABLE); | 513 manager_->SetMockProvider(GeofencingMockState::SERVICE_AVAILABLE); |
513 VerifyRegions(worker1_->id(), RegionMap()); | 514 VerifyRegions(worker1_->id(), RegionMap()); |
514 } | 515 } |
515 | 516 |
516 } // namespace content | 517 } // namespace content |
OLD | NEW |