| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 DCHECK(worker_helper_); | 105 DCHECK(worker_helper_); |
| 106 return worker_helper_->browser_context(); | 106 return worker_helper_->browser_context(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 PaymentManager* PaymentAppContentUnitTestBase::CreatePaymentManager( | 109 PaymentManager* PaymentAppContentUnitTestBase::CreatePaymentManager( |
| 110 const GURL& scope_url, | 110 const GURL& scope_url, |
| 111 const GURL& sw_script_url) { | 111 const GURL& sw_script_url) { |
| 112 // Register service worker for payment manager. | 112 // Register service worker for payment manager. |
| 113 bool called = false; | 113 bool called = false; |
| 114 worker_helper_->context()->RegisterServiceWorker( | 114 worker_helper_->context()->RegisterServiceWorker( |
| 115 scope_url, sw_script_url, nullptr, | 115 sw_script_url, ServiceWorkerRegistrationOptions(scope_url), nullptr, |
| 116 base::Bind(&RegisterServiceWorkerCallback, &called)); | 116 base::Bind(&RegisterServiceWorkerCallback, &called)); |
| 117 base::RunLoop().RunUntilIdle(); | 117 base::RunLoop().RunUntilIdle(); |
| 118 EXPECT_TRUE(called); | 118 EXPECT_TRUE(called); |
| 119 | 119 |
| 120 // This function should eventually return created payment manager | 120 // This function should eventually return created payment manager |
| 121 // but there is no way to get last created payment manager from | 121 // but there is no way to get last created payment manager from |
| 122 // payment_app_context()->payment_managers_ because its type is std::map | 122 // payment_app_context()->payment_managers_ because its type is std::map |
| 123 // and can not ensure its order. So, just make a set of existing payment app | 123 // and can not ensure its order. So, just make a set of existing payment app |
| 124 // managers before creating a new manager and then check what is a new thing. | 124 // managers before creating a new manager and then check what is a new thing. |
| 125 std::set<PaymentManager*> existing_managers; | 125 std::set<PaymentManager*> existing_managers; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 StoragePartitionImpl* PaymentAppContentUnitTestBase::storage_partition() { | 172 StoragePartitionImpl* PaymentAppContentUnitTestBase::storage_partition() { |
| 173 return static_cast<StoragePartitionImpl*>( | 173 return static_cast<StoragePartitionImpl*>( |
| 174 BrowserContext::GetDefaultStoragePartition(browser_context())); | 174 BrowserContext::GetDefaultStoragePartition(browser_context())); |
| 175 } | 175 } |
| 176 | 176 |
| 177 PaymentAppContextImpl* PaymentAppContentUnitTestBase::payment_app_context() { | 177 PaymentAppContextImpl* PaymentAppContentUnitTestBase::payment_app_context() { |
| 178 return storage_partition()->GetPaymentAppContext(); | 178 return storage_partition()->GetPaymentAppContext(); |
| 179 } | 179 } |
| 180 | 180 |
| 181 } // namespace content | 181 } // namespace content |
| OLD | NEW |