Index: content/browser/payments/payment_app_provider_impl_unittest.cc |
diff --git a/content/browser/payments/payment_app_provider_impl_unittest.cc b/content/browser/payments/payment_app_provider_impl_unittest.cc |
index f9c4f16827676d818d39c41c4debac0f48a61429..fbc9fcd0a18b28f9893275a9a1388e3976f07449 100644 |
--- a/content/browser/payments/payment_app_provider_impl_unittest.cc |
+++ b/content/browser/payments/payment_app_provider_impl_unittest.cc |
@@ -14,9 +14,6 @@ |
#include "testing/gtest/include/gtest/gtest.h" |
#include "url/gurl.h" |
-using payments::mojom::PaymentAppManifestError; |
-using payments::mojom::PaymentAppManifestPtr; |
- |
namespace content { |
class PaymentManager; |
@@ -27,20 +24,6 @@ using ::payments::mojom::PaymentHandlerStatus; |
using ::payments::mojom::PaymentInstrument; |
using ::payments::mojom::PaymentInstrumentPtr; |
-void SetManifestCallback(bool* called, |
- PaymentAppManifestError* out_error, |
- PaymentAppManifestError error) { |
- *called = true; |
- *out_error = error; |
-} |
- |
-void GetAllManifestsCallback(bool* called, |
- PaymentAppProvider::Manifests* out_manifests, |
- PaymentAppProvider::Manifests manifests) { |
- *called = true; |
- *out_manifests = std::move(manifests); |
-} |
- |
void SetPaymentInstrumentCallback(PaymentHandlerStatus* out_status, |
PaymentHandlerStatus status) { |
*out_status = status; |
@@ -63,12 +46,6 @@ class PaymentAppProviderTest : public PaymentAppContentUnitTestBase { |
PaymentAppProviderTest() {} |
~PaymentAppProviderTest() override {} |
- void GetAllManifests(PaymentAppProvider::GetAllManifestsCallback callback) { |
- PaymentAppProviderImpl::GetInstance()->GetAllManifests(browser_context(), |
- callback); |
- base::RunLoop().RunUntilIdle(); |
- } |
- |
void SetPaymentInstrument( |
PaymentManager* manager, |
const std::string& instrument_key, |
@@ -95,56 +72,10 @@ class PaymentAppProviderTest : public PaymentAppContentUnitTestBase { |
base::RunLoop().RunUntilIdle(); |
} |
- void CreatePaymentApp(const GURL& scope_url, const GURL& sw_script_url) { |
- PaymentManager* manager = CreatePaymentManager(scope_url, sw_script_url); |
- |
- PaymentAppManifestError error = |
- PaymentAppManifestError::MANIFEST_STORAGE_OPERATION_FAILED; |
- bool called = false; |
- SetManifest(manager, CreatePaymentAppManifestForTest(scope_url.spec()), |
- base::Bind(&SetManifestCallback, &called, &error)); |
- ASSERT_TRUE(called); |
- |
- ASSERT_EQ(PaymentAppManifestError::NONE, error); |
- } |
- |
private: |
DISALLOW_COPY_AND_ASSIGN(PaymentAppProviderTest); |
}; |
-TEST_F(PaymentAppProviderTest, GetAllManifestsTest) { |
- static const struct { |
- const char* scopeUrl; |
- const char* scriptUrl; |
- } kPaymentAppInfo[] = { |
- {"https://example.com/a", "https://example.com/a/script.js"}, |
- {"https://example.com/b", "https://example.com/b/script.js"}, |
- {"https://example.com/c", "https://example.com/c/script.js"}}; |
- |
- for (size_t i = 0; i < arraysize(kPaymentAppInfo); i++) { |
- CreatePaymentApp(GURL(kPaymentAppInfo[i].scopeUrl), |
- GURL(kPaymentAppInfo[i].scriptUrl)); |
- } |
- |
- PaymentAppProvider::Manifests manifests; |
- bool called = false; |
- GetAllManifests(base::Bind(&GetAllManifestsCallback, &called, &manifests)); |
- ASSERT_TRUE(called); |
- |
- ASSERT_EQ(3U, manifests.size()); |
- size_t i = 0; |
- for (const auto& manifest : manifests) { |
- EXPECT_EQ("payment-app-icon", manifest.second->icon.value()); |
- EXPECT_EQ(kPaymentAppInfo[i++].scopeUrl, manifest.second->name); |
- ASSERT_EQ(1U, manifest.second->options.size()); |
- EXPECT_EQ("payment-app-icon", manifest.second->options[0]->icon.value()); |
- EXPECT_EQ("Visa ****", manifest.second->options[0]->name); |
- EXPECT_EQ("payment-app-id", manifest.second->options[0]->id); |
- ASSERT_EQ(1U, manifest.second->options[0]->enabled_methods.size()); |
- EXPECT_EQ("visa", manifest.second->options[0]->enabled_methods[0]); |
- } |
-} |
- |
TEST_F(PaymentAppProviderTest, InvokePaymentAppTest) { |
PaymentManager* manager1 = CreatePaymentManager( |
GURL("https://hellopay.com/a"), GURL("https://hellopay.com/a/script.js")); |