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> |