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

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

Issue 2586203003: PaymentApp: Remove scope_url parameter from Get/SetManifest methods. (Closed)
Patch Set: rebased 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_content_unittest_base.cc
diff --git a/content/browser/payments/payment_app_content_unittest_base.cc b/content/browser/payments/payment_app_content_unittest_base.cc
index 4d95eee40ef74e803f468d03d14a8a76df25d5e7..a8aac646f97ccb1bcbdaf46ebdd2713cbbcebe28 100644
--- a/content/browser/payments/payment_app_content_unittest_base.cc
+++ b/content/browser/payments/payment_app_content_unittest_base.cc
@@ -33,6 +33,12 @@ void RegisterServiceWorkerCallback(bool* called,
*called = true;
}
+void UnregisterServiceWorkerCallback(bool* called,
+ ServiceWorkerStatusCode status) {
+ EXPECT_EQ(SERVICE_WORKER_OK, status) << ServiceWorkerStatusToString(status);
+ *called = true;
+}
+
} // namespace
PaymentAppContentUnitTestBase::PaymentAppContentUnitTestBase()
@@ -88,8 +94,11 @@ PaymentAppManager* PaymentAppContentUnitTestBase::CreatePaymentAppManager(
// Find a last registered payment app manager.
for (const auto& candidate_manager :
payment_app_context_->payment_app_managers_) {
- if (!base::ContainsKey(existing_managers, candidate_manager.first))
+ if (!base::ContainsKey(existing_managers, candidate_manager.first)) {
+ candidate_manager.first->Init(scope_url.spec());
+ base::RunLoop().RunUntilIdle();
return candidate_manager.first;
+ }
}
NOTREACHED();
@@ -98,20 +107,18 @@ PaymentAppManager* PaymentAppContentUnitTestBase::CreatePaymentAppManager(
void PaymentAppContentUnitTestBase::SetManifest(
PaymentAppManager* manager,
- const std::string& scope,
payments::mojom::PaymentAppManifestPtr manifest,
const PaymentAppManager::SetManifestCallback& callback) {
ASSERT_NE(nullptr, manager);
- manager->SetManifest(scope, std::move(manifest), callback);
+ manager->SetManifest(std::move(manifest), callback);
base::RunLoop().RunUntilIdle();
}
void PaymentAppContentUnitTestBase::GetManifest(
PaymentAppManager* manager,
- const std::string& scope,
const PaymentAppManager::GetManifestCallback& callback) {
ASSERT_NE(nullptr, manager);
- manager->GetManifest(scope, callback);
+ manager->GetManifest(callback);
base::RunLoop().RunUntilIdle();
}
@@ -134,4 +141,14 @@ PaymentAppContentUnitTestBase::CreatePaymentAppManifestForTest(
return manifest;
}
+void PaymentAppContentUnitTestBase::UnregisterServiceWorker(
+ const GURL& scope_url) {
+ // Unregister service worker.
+ bool called = false;
+ embedded_worker_helper_->context()->UnregisterServiceWorker(
+ scope_url, base::Bind(&UnregisterServiceWorkerCallback, &called));
+ base::RunLoop().RunUntilIdle();
+ EXPECT_TRUE(called);
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698