| 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 #ifndef CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTENT_UNITTEST_BASE_H_ | 5 #ifndef CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTENT_UNITTEST_BASE_H_ |
| 6 #define CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTENT_UNITTEST_BASE_H_ | 6 #define CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTENT_UNITTEST_BASE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "components/payments/payment_app.mojom.h" | 14 #include "components/payments/payment_app.mojom.h" |
| 15 #include "content/browser/payments/payment_app_manager.h" | 15 #include "content/browser/payments/payment_app_manager.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 #include "url/gurl.h" | 17 #include "url/gurl.h" |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 | 20 |
| 21 class BrowserContext; |
| 21 class EmbeddedWorkerTestHelper; | 22 class EmbeddedWorkerTestHelper; |
| 22 class PaymentAppContextImpl; | 23 class PaymentAppContextImpl; |
| 23 class StoragePartitionImpl; | 24 class StoragePartitionImpl; |
| 24 class TestBrowserThreadBundle; | 25 class TestBrowserThreadBundle; |
| 25 | 26 |
| 26 class PaymentAppContentUnitTestBase : public testing::Test { | 27 class PaymentAppContentUnitTestBase : public testing::Test { |
| 27 protected: | 28 protected: |
| 28 PaymentAppContentUnitTestBase(); | 29 PaymentAppContentUnitTestBase(); |
| 29 ~PaymentAppContentUnitTestBase() override; | 30 ~PaymentAppContentUnitTestBase() override; |
| 30 | 31 |
| 31 PaymentAppContextImpl* payment_app_context() const { | 32 BrowserContext* browser_context(); |
| 32 return payment_app_context_.get(); | |
| 33 } | |
| 34 PaymentAppManager* CreatePaymentAppManager(const GURL& scope_url, | 33 PaymentAppManager* CreatePaymentAppManager(const GURL& scope_url, |
| 35 const GURL& sw_script_url); | 34 const GURL& sw_script_url); |
| 36 void SetManifest(PaymentAppManager* manager, | 35 void SetManifest(PaymentAppManager* manager, |
| 37 payments::mojom::PaymentAppManifestPtr manifest, | 36 payments::mojom::PaymentAppManifestPtr manifest, |
| 38 const PaymentAppManager::SetManifestCallback& callback); | 37 const PaymentAppManager::SetManifestCallback& callback); |
| 39 void GetManifest(PaymentAppManager* manager, | 38 void GetManifest(PaymentAppManager* manager, |
| 40 const PaymentAppManager::GetManifestCallback& callback); | 39 const PaymentAppManager::GetManifestCallback& callback); |
| 41 payments::mojom::PaymentAppManifestPtr CreatePaymentAppManifestForTest( | 40 payments::mojom::PaymentAppManifestPtr CreatePaymentAppManifestForTest( |
| 42 const std::string& name); | 41 const std::string& name); |
| 43 void UnregisterServiceWorker(const GURL& scope_url); | 42 void UnregisterServiceWorker(const GURL& scope_url); |
| 44 | 43 |
| 45 private: | 44 private: |
| 45 StoragePartitionImpl* storage_partition(); |
| 46 PaymentAppContextImpl* payment_app_context(); |
| 47 |
| 46 std::unique_ptr<TestBrowserThreadBundle> thread_bundle_; | 48 std::unique_ptr<TestBrowserThreadBundle> thread_bundle_; |
| 47 std::unique_ptr<EmbeddedWorkerTestHelper> embedded_worker_helper_; | 49 std::unique_ptr<EmbeddedWorkerTestHelper> embedded_worker_helper_; |
| 48 std::unique_ptr<StoragePartitionImpl> storage_partition_impl_; | |
| 49 scoped_refptr<PaymentAppContextImpl> payment_app_context_; | |
| 50 std::vector<payments::mojom::PaymentAppManagerPtr> payment_app_managers_; | 50 std::vector<payments::mojom::PaymentAppManagerPtr> payment_app_managers_; |
| 51 | 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(PaymentAppContentUnitTestBase); | 52 DISALLOW_COPY_AND_ASSIGN(PaymentAppContentUnitTestBase); |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 } // namespace content | 55 } // namespace content |
| 56 | 56 |
| 57 #endif // CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTENT_UNITTEST_BASE_H_ | 57 #endif // CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTENT_UNITTEST_BASE_H_ |
| OLD | NEW |