OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/payments/payment_app_content_unittest_base.h" | 5 #include "content/browser/payments/payment_app_content_unittest_base.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
15 #include "content/browser/service_worker/embedded_worker_test_helper.h" | 15 #include "content/browser/service_worker/embedded_worker_test_helper.h" |
16 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 16 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
17 #include "content/browser/storage_partition_impl.h" | 17 #include "content/browser/storage_partition_impl.h" |
18 #include "content/common/service_worker/service_worker_event_dispatcher.mojom.h" | 18 #include "content/common/service_worker/service_worker_event_dispatcher.mojom.h" |
19 #include "content/common/service_worker/service_worker_status_code.h" | 19 #include "content/common/service_worker/service_worker_status_code.h" |
20 #include "content/public/test/test_browser_context.h" | 20 #include "content/public/test/test_browser_context.h" |
21 #include "content/public/test/test_browser_thread_bundle.h" | 21 #include "content/public/test/test_browser_thread_bundle.h" |
22 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" | 22 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" |
23 #include "mojo/public/cpp/bindings/interface_request.h" | 23 #include "mojo/public/cpp/bindings/interface_request.h" |
| 24 #include "services/service_manager/public/cpp/bind_source_info.h" |
24 | 25 |
25 namespace content { | 26 namespace content { |
26 | 27 |
27 namespace { | 28 namespace { |
28 | 29 |
29 void RegisterServiceWorkerCallback(bool* called, | 30 void RegisterServiceWorkerCallback(bool* called, |
30 ServiceWorkerStatusCode status, | 31 ServiceWorkerStatusCode status, |
31 const std::string& status_message, | 32 const std::string& status_message, |
32 int64_t registration_id) { | 33 int64_t registration_id) { |
33 EXPECT_EQ(SERVICE_WORKER_OK, status) << ServiceWorkerStatusToString(status); | 34 EXPECT_EQ(SERVICE_WORKER_OK, status) << ServiceWorkerStatusToString(status); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 for (const auto& existing_manager : | 126 for (const auto& existing_manager : |
126 payment_app_context()->payment_managers_) { | 127 payment_app_context()->payment_managers_) { |
127 existing_managers.insert(existing_manager.first); | 128 existing_managers.insert(existing_manager.first); |
128 } | 129 } |
129 | 130 |
130 // Create a new payment manager. | 131 // Create a new payment manager. |
131 payments::mojom::PaymentManagerPtr manager; | 132 payments::mojom::PaymentManagerPtr manager; |
132 mojo::InterfaceRequest<payments::mojom::PaymentManager> request = | 133 mojo::InterfaceRequest<payments::mojom::PaymentManager> request = |
133 mojo::MakeRequest(&manager); | 134 mojo::MakeRequest(&manager); |
134 payment_managers_.push_back(std::move(manager)); | 135 payment_managers_.push_back(std::move(manager)); |
135 payment_app_context()->CreatePaymentManager(std::move(request)); | 136 payment_app_context()->CreatePaymentManager(service_manager::BindSourceInfo(), |
| 137 std::move(request)); |
136 base::RunLoop().RunUntilIdle(); | 138 base::RunLoop().RunUntilIdle(); |
137 | 139 |
138 // Find a last registered payment manager. | 140 // Find a last registered payment manager. |
139 for (const auto& candidate_manager : | 141 for (const auto& candidate_manager : |
140 payment_app_context()->payment_managers_) { | 142 payment_app_context()->payment_managers_) { |
141 if (!base::ContainsKey(existing_managers, candidate_manager.first)) { | 143 if (!base::ContainsKey(existing_managers, candidate_manager.first)) { |
142 candidate_manager.first->Init(scope_url.spec()); | 144 candidate_manager.first->Init(scope_url.spec()); |
143 base::RunLoop().RunUntilIdle(); | 145 base::RunLoop().RunUntilIdle(); |
144 return candidate_manager.first; | 146 return candidate_manager.first; |
145 } | 147 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 StoragePartitionImpl* PaymentAppContentUnitTestBase::storage_partition() { | 208 StoragePartitionImpl* PaymentAppContentUnitTestBase::storage_partition() { |
207 return static_cast<StoragePartitionImpl*>( | 209 return static_cast<StoragePartitionImpl*>( |
208 BrowserContext::GetDefaultStoragePartition(browser_context())); | 210 BrowserContext::GetDefaultStoragePartition(browser_context())); |
209 } | 211 } |
210 | 212 |
211 PaymentAppContextImpl* PaymentAppContentUnitTestBase::payment_app_context() { | 213 PaymentAppContextImpl* PaymentAppContentUnitTestBase::payment_app_context() { |
212 return storage_partition()->GetPaymentAppContext(); | 214 return storage_partition()->GetPaymentAppContext(); |
213 } | 215 } |
214 | 216 |
215 } // namespace content | 217 } // namespace content |
OLD | NEW |