| 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> |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 } // namespace | 44 } // namespace |
| 45 | 45 |
| 46 class PaymentAppContentUnitTestBase::PaymentAppForWorkerTestHelper | 46 class PaymentAppContentUnitTestBase::PaymentAppForWorkerTestHelper |
| 47 : public EmbeddedWorkerTestHelper { | 47 : public EmbeddedWorkerTestHelper { |
| 48 public: | 48 public: |
| 49 PaymentAppForWorkerTestHelper() | 49 PaymentAppForWorkerTestHelper() |
| 50 : EmbeddedWorkerTestHelper(base::FilePath()), | 50 : EmbeddedWorkerTestHelper(base::FilePath()), |
| 51 last_sw_registration_id_(kInvalidServiceWorkerRegistrationId) {} | 51 last_sw_registration_id_(kInvalidServiceWorkerRegistrationId) {} |
| 52 ~PaymentAppForWorkerTestHelper() override {} | 52 ~PaymentAppForWorkerTestHelper() override {} |
| 53 | 53 |
| 54 void OnStartWorker(int embedded_worker_id, | 54 void OnStartWorker( |
| 55 int64_t service_worker_version_id, | 55 int embedded_worker_id, |
| 56 const GURL& scope, | 56 int64_t service_worker_version_id, |
| 57 const GURL& script_url, | 57 const GURL& scope, |
| 58 bool pause_after_download, | 58 const GURL& script_url, |
| 59 mojom::ServiceWorkerEventDispatcherRequest request, | 59 bool pause_after_download, |
| 60 mojom::EmbeddedWorkerInstanceHostAssociatedPtrInfo | 60 mojom::ServiceWorkerEventDispatcherRequest request, |
| 61 instance_host) override { | 61 mojom::EmbeddedWorkerInstanceHostAssociatedPtrInfo instance_host, |
| 62 mojom::ServiceWorkerProviderClientInfoPtr provider_client_info) override { |
| 62 ServiceWorkerVersion* version = | 63 ServiceWorkerVersion* version = |
| 63 context()->GetLiveVersion(service_worker_version_id); | 64 context()->GetLiveVersion(service_worker_version_id); |
| 64 last_sw_registration_id_ = version->registration_id(); | 65 last_sw_registration_id_ = version->registration_id(); |
| 65 last_sw_scope_ = scope; | 66 last_sw_scope_ = scope; |
| 66 EmbeddedWorkerTestHelper::OnStartWorker( | 67 EmbeddedWorkerTestHelper::OnStartWorker( |
| 67 embedded_worker_id, service_worker_version_id, scope, script_url, | 68 embedded_worker_id, service_worker_version_id, scope, script_url, |
| 68 pause_after_download, std::move(request), std::move(instance_host)); | 69 pause_after_download, std::move(request), std::move(instance_host), |
| 70 std::move(provider_client_info)); |
| 69 } | 71 } |
| 70 | 72 |
| 71 void OnPaymentRequestEvent( | 73 void OnPaymentRequestEvent( |
| 72 payments::mojom::PaymentAppRequestPtr app_request, | 74 payments::mojom::PaymentAppRequestPtr app_request, |
| 73 payments::mojom::PaymentAppResponseCallbackPtr response_callback, | 75 payments::mojom::PaymentAppResponseCallbackPtr response_callback, |
| 74 mojom::ServiceWorkerEventDispatcher::DispatchPaymentRequestEventCallback | 76 mojom::ServiceWorkerEventDispatcher::DispatchPaymentRequestEventCallback |
| 75 callback) override { | 77 callback) override { |
| 76 EmbeddedWorkerTestHelper::OnPaymentRequestEvent( | 78 EmbeddedWorkerTestHelper::OnPaymentRequestEvent( |
| 77 std::move(app_request), std::move(response_callback), | 79 std::move(app_request), std::move(response_callback), |
| 78 std::move(callback)); | 80 std::move(callback)); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 StoragePartitionImpl* PaymentAppContentUnitTestBase::storage_partition() { | 174 StoragePartitionImpl* PaymentAppContentUnitTestBase::storage_partition() { |
| 173 return static_cast<StoragePartitionImpl*>( | 175 return static_cast<StoragePartitionImpl*>( |
| 174 BrowserContext::GetDefaultStoragePartition(browser_context())); | 176 BrowserContext::GetDefaultStoragePartition(browser_context())); |
| 175 } | 177 } |
| 176 | 178 |
| 177 PaymentAppContextImpl* PaymentAppContentUnitTestBase::payment_app_context() { | 179 PaymentAppContextImpl* PaymentAppContentUnitTestBase::payment_app_context() { |
| 178 return storage_partition()->GetPaymentAppContext(); | 180 return storage_partition()->GetPaymentAppContext(); |
| 179 } | 181 } |
| 180 | 182 |
| 181 } // namespace content | 183 } // namespace content |
| OLD | NEW |