| 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 PaymentAppManager* PaymentAppContentUnitTestBase::CreatePaymentAppManager( | 109 PaymentAppManager* PaymentAppContentUnitTestBase::CreatePaymentAppManager( |
| 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 app manager. | 112 // Register service worker for payment app 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 app manager | 120 // This function should eventually return created payment app manager |
| 121 // but there is no way to get last created payment app manager from | 121 // but there is no way to get last created payment app manager from |
| 122 // payment_app_context()->payment_app_managers_ because its type is std::map | 122 // payment_app_context()->payment_app_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<PaymentAppManager*> existing_managers; | 125 std::set<PaymentAppManager*> existing_managers; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 StoragePartitionImpl* PaymentAppContentUnitTestBase::storage_partition() { | 215 StoragePartitionImpl* PaymentAppContentUnitTestBase::storage_partition() { |
| 216 return static_cast<StoragePartitionImpl*>( | 216 return static_cast<StoragePartitionImpl*>( |
| 217 BrowserContext::GetDefaultStoragePartition(browser_context())); | 217 BrowserContext::GetDefaultStoragePartition(browser_context())); |
| 218 } | 218 } |
| 219 | 219 |
| 220 PaymentAppContextImpl* PaymentAppContentUnitTestBase::payment_app_context() { | 220 PaymentAppContextImpl* PaymentAppContentUnitTestBase::payment_app_context() { |
| 221 return storage_partition()->GetPaymentAppContext(); | 221 return storage_partition()->GetPaymentAppContext(); |
| 222 } | 222 } |
| 223 | 223 |
| 224 } // namespace content | 224 } // namespace content |
| OLD | NEW |