| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 } // namespace | 43 } // namespace |
| 44 | 44 |
| 45 class PaymentAppContentUnitTestBase::PaymentAppForWorkerTestHelper | 45 class PaymentAppContentUnitTestBase::PaymentAppForWorkerTestHelper |
| 46 : public EmbeddedWorkerTestHelper { | 46 : public EmbeddedWorkerTestHelper { |
| 47 public: | 47 public: |
| 48 PaymentAppForWorkerTestHelper() | 48 PaymentAppForWorkerTestHelper() |
| 49 : EmbeddedWorkerTestHelper(base::FilePath()), | 49 : EmbeddedWorkerTestHelper(base::FilePath()), |
| 50 last_sw_registration_id_(kInvalidServiceWorkerRegistrationId) {} | 50 last_sw_registration_id_(kInvalidServiceWorkerRegistrationId) {} |
| 51 ~PaymentAppForWorkerTestHelper() override {} | 51 ~PaymentAppForWorkerTestHelper() override {} |
| 52 | 52 |
| 53 void OnStartWorker( | 53 void OnStartWorker(int embedded_worker_id, |
| 54 int embedded_worker_id, | 54 int64_t service_worker_version_id, |
| 55 int64_t service_worker_version_id, | 55 const GURL& scope, |
| 56 const GURL& scope, | 56 const GURL& script_url, |
| 57 const GURL& script_url, | 57 bool pause_after_download, |
| 58 bool pause_after_download, | 58 mojom::ServiceWorkerEventDispatcherRequest request, |
| 59 mojom::ServiceWorkerEventDispatcherRequest request) override { | 59 mojom::EmbeddedWorkerInstanceHostAssociatedPtrInfo |
| 60 instance_host) override { |
| 60 ServiceWorkerVersion* version = | 61 ServiceWorkerVersion* version = |
| 61 context()->GetLiveVersion(service_worker_version_id); | 62 context()->GetLiveVersion(service_worker_version_id); |
| 62 last_sw_registration_id_ = version->registration_id(); | 63 last_sw_registration_id_ = version->registration_id(); |
| 63 last_sw_scope_ = scope; | 64 last_sw_scope_ = scope; |
| 64 EmbeddedWorkerTestHelper::OnStartWorker( | 65 EmbeddedWorkerTestHelper::OnStartWorker( |
| 65 embedded_worker_id, service_worker_version_id, scope, script_url, | 66 embedded_worker_id, service_worker_version_id, scope, script_url, |
| 66 pause_after_download, std::move(request)); | 67 pause_after_download, std::move(request), std::move(instance_host)); |
| 67 } | 68 } |
| 68 | 69 |
| 69 void OnPaymentRequestEvent( | 70 void OnPaymentRequestEvent( |
| 70 payments::mojom::PaymentAppRequestPtr app_request, | 71 payments::mojom::PaymentAppRequestPtr app_request, |
| 71 payments::mojom::PaymentAppResponseCallbackPtr response_callback, | 72 payments::mojom::PaymentAppResponseCallbackPtr response_callback, |
| 72 const mojom::ServiceWorkerEventDispatcher:: | 73 const mojom::ServiceWorkerEventDispatcher:: |
| 73 DispatchPaymentRequestEventCallback& callback) override { | 74 DispatchPaymentRequestEventCallback& callback) override { |
| 74 EmbeddedWorkerTestHelper::OnPaymentRequestEvent( | 75 EmbeddedWorkerTestHelper::OnPaymentRequestEvent( |
| 75 std::move(app_request), std::move(response_callback), callback); | 76 std::move(app_request), std::move(response_callback), callback); |
| 76 } | 77 } |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 StoragePartitionImpl* PaymentAppContentUnitTestBase::storage_partition() { | 205 StoragePartitionImpl* PaymentAppContentUnitTestBase::storage_partition() { |
| 205 return static_cast<StoragePartitionImpl*>( | 206 return static_cast<StoragePartitionImpl*>( |
| 206 BrowserContext::GetDefaultStoragePartition(browser_context())); | 207 BrowserContext::GetDefaultStoragePartition(browser_context())); |
| 207 } | 208 } |
| 208 | 209 |
| 209 PaymentAppContextImpl* PaymentAppContentUnitTestBase::payment_app_context() { | 210 PaymentAppContextImpl* PaymentAppContentUnitTestBase::payment_app_context() { |
| 210 return storage_partition()->GetPaymentAppContext(); | 211 return storage_partition()->GetPaymentAppContext(); |
| 211 } | 212 } |
| 212 | 213 |
| 213 } // namespace content | 214 } // namespace content |
| OLD | NEW |