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

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: 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 c0c581b2a53fc7a0a986169515d1d6a9a031d220..2c5c8e717612c39c32b161f4922ad3c0806b899f 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,10 @@ 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());
please use gerrit instead 2016/12/20 16:57:54 Run the loop here as well, because Init() posts a
zino 2016/12/20 17:18:37 Done.
return candidate_manager.first;
+ }
}
NOTREACHED();
@@ -98,21 +106,29 @@ 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();
}
+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