OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/background_sync/background_sync_service_impl.h" | 5 #include "content/browser/background_sync/background_sync_service_impl.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 179 |
180 void CreateBackgroundSyncServiceImpl() { | 180 void CreateBackgroundSyncServiceImpl() { |
181 // Create a dummy mojo channel so that the BackgroundSyncServiceImpl can be | 181 // Create a dummy mojo channel so that the BackgroundSyncServiceImpl can be |
182 // instantiated. | 182 // instantiated. |
183 mojo::InterfaceRequest<blink::mojom::BackgroundSyncService> | 183 mojo::InterfaceRequest<blink::mojom::BackgroundSyncService> |
184 service_request = mojo::GetProxy(&service_ptr_); | 184 service_request = mojo::GetProxy(&service_ptr_); |
185 // Create a new BackgroundSyncServiceImpl bound to the dummy channel. | 185 // Create a new BackgroundSyncServiceImpl bound to the dummy channel. |
186 background_sync_context_->CreateService(std::move(service_request)); | 186 background_sync_context_->CreateService(std::move(service_request)); |
187 base::RunLoop().RunUntilIdle(); | 187 base::RunLoop().RunUntilIdle(); |
188 | 188 |
189 service_impl_ = *background_sync_context_->services_.begin(); | 189 service_impl_ = background_sync_context_->services_.begin()->first; |
190 ASSERT_TRUE(service_impl_); | 190 ASSERT_TRUE(service_impl_); |
191 } | 191 } |
192 | 192 |
193 // Helpers for testing BackgroundSyncServiceImpl methods | 193 // Helpers for testing BackgroundSyncServiceImpl methods |
194 void Register( | 194 void Register( |
195 blink::mojom::SyncRegistrationPtr sync, | 195 blink::mojom::SyncRegistrationPtr sync, |
196 const blink::mojom::BackgroundSyncService::RegisterCallback& callback) { | 196 const blink::mojom::BackgroundSyncService::RegisterCallback& callback) { |
197 service_impl_->Register(std::move(sync), sw_registration_id_, callback); | 197 service_impl_->Register(std::move(sync), sw_registration_id_, callback); |
198 base::RunLoop().RunUntilIdle(); | 198 base::RunLoop().RunUntilIdle(); |
199 } | 199 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 EXPECT_EQ(blink::mojom::BackgroundSyncError::NONE, register_error); | 256 EXPECT_EQ(blink::mojom::BackgroundSyncError::NONE, register_error); |
257 GetRegistrations(base::Bind(&ErrorAndRegistrationListCallback, | 257 GetRegistrations(base::Bind(&ErrorAndRegistrationListCallback, |
258 &getregistrations_called, &getregistrations_error, | 258 &getregistrations_called, &getregistrations_error, |
259 &array_size)); | 259 &array_size)); |
260 EXPECT_TRUE(getregistrations_called); | 260 EXPECT_TRUE(getregistrations_called); |
261 EXPECT_EQ(blink::mojom::BackgroundSyncError::NONE, getregistrations_error); | 261 EXPECT_EQ(blink::mojom::BackgroundSyncError::NONE, getregistrations_error); |
262 EXPECT_EQ(1UL, array_size); | 262 EXPECT_EQ(1UL, array_size); |
263 } | 263 } |
264 | 264 |
265 } // namespace content | 265 } // namespace content |
OLD | NEW |