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

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

Issue 2557473003: PaymentApp: Factor out functions to serialize/deserialize manifest data. (Closed)
Patch Set: test Created 4 years 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
Index: content/browser/payments/payment_app_manager_unittest.cc
diff --git a/content/browser/payments/payment_app_manager_unittest.cc b/content/browser/payments/payment_app_manager_unittest.cc
index d29d395cee097c470bd026ca239f66565289143e..a11fe25d530e97e5c7051a9ec83bdb376860ab4c 100644
--- a/content/browser/payments/payment_app_manager_unittest.cc
+++ b/content/browser/payments/payment_app_manager_unittest.cc
@@ -67,7 +67,7 @@ class PaymentAppManagerTest : public testing::Test {
storage_partition_impl_.get());
payment_app_context_ =
- new PaymentAppContext(embedded_worker_helper_->context_wrapper());
+ new PaymentAppContextImpl(embedded_worker_helper_->context_wrapper());
bool called = false;
embedded_worker_helper_->context()->RegisterServiceWorker(
@@ -104,12 +104,21 @@ class PaymentAppManagerTest : public testing::Test {
base::RunLoop().RunUntilIdle();
}
+ void GetAll() {
+ payment_app_context_->GetAllManifests(base::Bind(&DidGetAll));
+ base::RunLoop().RunUntilIdle();
+ }
+
+ static void DidGetAll(const std::vector<PaymentAppContext::PaymentAppManifestWithID>& manifests) {
+ LOG(INFO) << "zino";
+ }
+
private:
std::unique_ptr<TestBrowserThreadBundle> thread_bundle_;
std::unique_ptr<EmbeddedWorkerTestHelper> embedded_worker_helper_;
std::unique_ptr<StoragePartitionImpl> storage_partition_impl_;
int64_t sw_registration_id_;
- scoped_refptr<PaymentAppContext> payment_app_context_;
+ scoped_refptr<PaymentAppContextImpl> payment_app_context_;
payments::mojom::PaymentAppManagerPtr service_;
// Owned by payment_app_context_.
@@ -164,4 +173,27 @@ TEST_F(PaymentAppManagerTest, GetManifestWithoutAssociatedServiceWorker) {
MANIFEST_STORAGE_OPERATION_FAILED);
}
+TEST_F(PaymentAppManagerTest, Test) {
+ payments::mojom::PaymentAppOptionPtr option =
+ payments::mojom::PaymentAppOption::New();
+ option->label = "Visa ****";
+ option->id = "payment-app-id";
+ option->icon = std::string("payment-app-icon");
+ option->enabled_methods.push_back("visa");
+
+ payments::mojom::PaymentAppManifestPtr manifest =
+ payments::mojom::PaymentAppManifest::New();
+ manifest->icon = std::string("payment-app-icon");
+ manifest->label = "Payment App";
+ manifest->options.push_back(std::move(option));
+
+ payments::mojom::PaymentAppManifestError error;
+ SetManifest(kServiceWorkerPattern, std::move(manifest),
+ base::Bind(&SetManifestCallback, &error));
+
+ ASSERT_EQ(error, payments::mojom::PaymentAppManifestError::NONE);
+
+ GetAll();
+}
+
} // namespace content
« no previous file with comments | « content/browser/payments/payment_app_manager.cc ('k') | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698