Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(760)

Unified Diff: content/browser/payments/payment_manager_unittest.cc

Issue 2875493003: PaymentHandler: Remove PaymentAppManifest and PaymentAppOption. (Closed)
Patch Set: global-interface-listing Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/payments/payment_manager.cc ('k') | content/public/browser/payment_app_provider.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/payments/payment_manager_unittest.cc
diff --git a/content/browser/payments/payment_manager_unittest.cc b/content/browser/payments/payment_manager_unittest.cc
index 07e522c1d4358f8e532c9ad32bceba0d049bf2b0..42d80cbfff986ece75b125273a2dbf05557be1ed 100644
--- a/content/browser/payments/payment_manager_unittest.cc
+++ b/content/browser/payments/payment_manager_unittest.cc
@@ -14,8 +14,6 @@
namespace content {
namespace {
-using ::payments::mojom::PaymentAppManifestError;
-using ::payments::mojom::PaymentAppManifestPtr;
using ::payments::mojom::PaymentHandlerStatus;
using ::payments::mojom::PaymentInstrument;
using ::payments::mojom::PaymentInstrumentPtr;
@@ -23,23 +21,6 @@ using ::payments::mojom::PaymentInstrumentPtr;
const char kServiceWorkerPattern[] = "https://example.com/a";
const char kServiceWorkerScript[] = "https://example.com/a/script.js";
-void SetManifestCallback(bool* called,
- PaymentAppManifestError* out_error,
- PaymentAppManifestError error) {
- *called = true;
- *out_error = error;
-}
-
-void GetManifestCallback(bool* called,
- PaymentAppManifestPtr* out_manifest,
- PaymentAppManifestError* out_error,
- PaymentAppManifestPtr manifest,
- PaymentAppManifestError error) {
- *called = true;
- *out_manifest = std::move(manifest);
- *out_error = error;
-}
-
void DeletePaymentInstrumentCallback(PaymentHandlerStatus* out_status,
PaymentHandlerStatus status) {
*out_status = status;
@@ -141,72 +122,6 @@ class PaymentManagerTest : public PaymentAppContentUnitTestBase {
DISALLOW_COPY_AND_ASSIGN(PaymentManagerTest);
};
-TEST_F(PaymentManagerTest, SetAndGetManifest) {
- bool called = false;
- PaymentAppManifestError error =
- PaymentAppManifestError::MANIFEST_STORAGE_OPERATION_FAILED;
- SetManifest(payment_manager(),
- CreatePaymentAppManifestForTest(kServiceWorkerPattern),
- base::Bind(&SetManifestCallback, &called, &error));
- ASSERT_TRUE(called);
-
- ASSERT_EQ(PaymentAppManifestError::NONE, error);
-
- called = false;
- PaymentAppManifestPtr read_manifest;
- PaymentAppManifestError read_error =
- PaymentAppManifestError::MANIFEST_STORAGE_OPERATION_FAILED;
- GetManifest(payment_manager(), base::Bind(&GetManifestCallback, &called,
- &read_manifest, &read_error));
- ASSERT_TRUE(called);
-
- ASSERT_EQ(payments::mojom::PaymentAppManifestError::NONE, read_error);
- EXPECT_EQ("payment-app-icon", read_manifest->icon.value());
- EXPECT_EQ(kServiceWorkerPattern, read_manifest->name);
- ASSERT_EQ(1U, read_manifest->options.size());
- EXPECT_EQ("payment-app-icon", read_manifest->options[0]->icon.value());
- EXPECT_EQ("Visa ****", read_manifest->options[0]->name);
- EXPECT_EQ("payment-app-id", read_manifest->options[0]->id);
- ASSERT_EQ(1U, read_manifest->options[0]->enabled_methods.size());
- EXPECT_EQ("visa", read_manifest->options[0]->enabled_methods[0]);
-}
-
-TEST_F(PaymentManagerTest, SetManifestWithoutAssociatedServiceWorker) {
- bool called = false;
- PaymentAppManifestError error = PaymentAppManifestError::NONE;
- UnregisterServiceWorker(GURL(kServiceWorkerPattern));
- SetManifest(payment_manager(),
- CreatePaymentAppManifestForTest(kServiceWorkerPattern),
- base::Bind(&SetManifestCallback, &called, &error));
- ASSERT_TRUE(called);
-
- EXPECT_EQ(PaymentAppManifestError::NO_ACTIVE_WORKER, error);
-}
-
-TEST_F(PaymentManagerTest, GetManifestWithoutAssociatedServiceWorker) {
- bool called = false;
- PaymentAppManifestPtr read_manifest;
- PaymentAppManifestError read_error = PaymentAppManifestError::NONE;
- UnregisterServiceWorker(GURL(kServiceWorkerPattern));
- GetManifest(payment_manager(), base::Bind(&GetManifestCallback, &called,
- &read_manifest, &read_error));
- ASSERT_TRUE(called);
-
- EXPECT_EQ(PaymentAppManifestError::NO_ACTIVE_WORKER, read_error);
-}
-
-TEST_F(PaymentManagerTest, GetManifestWithNoSavedManifest) {
- bool called = false;
- PaymentAppManifestPtr read_manifest;
- PaymentAppManifestError read_error = PaymentAppManifestError::NONE;
- GetManifest(payment_manager(), base::Bind(&GetManifestCallback, &called,
- &read_manifest, &read_error));
- ASSERT_TRUE(called);
-
- EXPECT_EQ(PaymentAppManifestError::MANIFEST_STORAGE_OPERATION_FAILED,
- read_error);
-}
-
TEST_F(PaymentManagerTest, SetAndGetPaymentInstrument) {
PaymentHandlerStatus write_status = PaymentHandlerStatus::NOT_FOUND;
PaymentInstrumentPtr write_details = PaymentInstrument::New();
« no previous file with comments | « content/browser/payments/payment_manager.cc ('k') | content/public/browser/payment_app_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698