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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/payments/payment-app-manager.html

Issue 2506093002: PaymentApp: Implement PaymentAppManager.getManifest(). (Closed)
Patch Set: PaymentApp: Implement PaymentAppManager.getManifest(). Created 4 years, 1 month 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: third_party/WebKit/LayoutTests/http/tests/payments/payment-app-manager.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/payments/payment-app-manager.html b/third_party/WebKit/LayoutTests/http/tests/payments/payment-app-manager.html
index 1eb8a3be9ff33000dfe53628042e8fa2059a1f5f..05cbe8d127a6658dfd77944df688bccf95205969 100644
--- a/third_party/WebKit/LayoutTests/http/tests/payments/payment-app-manager.html
+++ b/third_party/WebKit/LayoutTests/http/tests/payments/payment-app-manager.html
@@ -77,4 +77,96 @@ promise_test(test => {
}, 'If registration has no active worker, no waiting worker and '
+ 'no installing worker, then throws InvalidStateError.');
+promise_test(test => {
+ var registration;
+ var script_url = 'resources/empty-worker.js';
+ var scope = 'resources/';
+ var manifest = {
+ label: 'Payment App',
+ icon: 'payment-app-icon',
+ options: [{
+ label: 'Visa ****',
+ icon: 'payment-app-icon',
+ id: 'payment-app-id',
+ enabledMethods: ['visa2']
+ }]
+ };
+
+ return service_worker_unregister_and_register(test, script_url, scope)
+ .then(r => {
+ registration = r;
+ return wait_for_state(test, registration.installing, 'activated');
+ })
+ .then(state => {
+ assert_equals(state, 'activated');
+ return registration.paymentAppManager.setManifest(manifest);
+ })
+ .then(result => {
+ assert_equals(result, undefined);
+ return registration.paymentAppManager.getManifest();
+ })
+ .then(read_manifest => {
+ assert_object_equals(read_manifest, manifest);
+ })
+ .catch(unreached_rejection(test));
+ }, 'If getManifest() is succeeded, then resolves stored manifest data.');
+
+promise_test(test => {
+ var registration;
+ var script_url = 'resources/empty-worker.js';
+ var scope = 'resources/';
+ var manifest = {
+ label: 'Payment App',
+ icon: 'payment-app-icon',
+ options: [{
+ label: 'Visa ****',
+ icon: 'payment-app-icon',
+ id: 'payment-app-id',
+ enabledMethods: ['visa2']
+ }]
+ };
+
+ return service_worker_unregister_and_register(test, script_url, scope)
+ .then(r => {
+ registration = r;
+ return wait_for_state(test, registration.installing, 'activated');
+ })
+ .then(state => {
+ assert_equals(state, 'activated');
+ return registration.paymentAppManager.setManifest(manifest);
+ })
+ .then(result => {
+ assert_equals(result, undefined);
+ return registration.unregister();
+ })
+ .then(result => {
+ assert_equals(result, true);
+ return registration.paymentAppManager.getManifest();
+ })
+ .then(unreached_fulfillment(test))
+ .catch(error => {
+ assert_equals(error.name, 'AbortError');
+ });
+ }, 'If service worker is unregistered, then manifest is cleared as well.');
+
+promise_test(test => {
+ var registration;
+ var script_url = 'resources/empty-worker.js';
+ var scope = 'resources/';
+
+ return service_worker_unregister_and_register(test, script_url, scope)
+ .then(r => {
+ registration = r;
+ return wait_for_state(test, registration.installing, 'activated');
+ })
+ .then(state => {
+ assert_equals(state, 'activated');
+ return registration.paymentAppManager.getManifest();
+ })
+ .then(unreached_fulfillment(test))
+ .catch(error => {
+ assert_equals(error.name, 'AbortError');
+ });
+ }, 'If there is no manifest data, then throws AbortError.');
+
</script>

Powered by Google App Engine
This is Rietveld 408576698