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

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

Issue 2562873002: [PaymentApp] label field was changed to name field in PaymentAppOption. (Closed)
Patch Set: rebase 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script> 2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script> 3 <script src="../resources/testharnessreport.js"></script>
4 <script src="../../serviceworker/resources/test-helpers.js"></script> 4 <script src="../../serviceworker/resources/test-helpers.js"></script>
5 <script> 5 <script>
6 6
7 promise_test(test => { 7 promise_test(test => {
8 var registration; 8 var registration;
9 var script_url = 'resources/empty-worker.js'; 9 var script_url = 'resources/empty-worker.js';
10 var scope = 'resources/'; 10 var scope = 'resources/';
11 11
12 return service_worker_unregister_and_register(test, script_url, scope) 12 return service_worker_unregister_and_register(test, script_url, scope)
13 .then(r => { 13 .then(r => {
14 registration = r; 14 registration = r;
15 return wait_for_state(test, registration.installing, 'activated'); 15 return wait_for_state(test, registration.installing, 'activated');
16 }) 16 })
17 .then(state => { 17 .then(state => {
18 assert_equals(state, 'activated'); 18 assert_equals(state, 'activated');
19 return registration.paymentAppManager.setManifest({ 19 return registration.paymentAppManager.setManifest({
20 label: 'Payment App' 20 name: 'Payment App',
21 icon: 'payment-app-icon',
22 options: [{
23 name: 'Visa ****',
24 icon: 'payment-app-icon',
25 id: 'payment-app-id',
26 enabledMethods: ['visa']
27 }]
21 }); 28 });
22 }) 29 })
23 .then(result => { 30 .then(result => {
24 assert_equals(result, undefined); 31 assert_equals(result, undefined);
25 }) 32 })
26 .catch(unreached_rejection(test)); 33 .catch(unreached_rejection(test));
27 }, 'setManifest() should resolve with undefined if ' 34 }, 'setManifest() should resolve with undefined if '
28 + 'setManifest() is succeeded.'); 35 + 'setManifest() is succeeded.');
29 36
30 promise_test(test => { 37 promise_test(test => {
31 var registration; 38 var registration;
32 var script_url = 'resources/empty-worker.js'; 39 var script_url = 'resources/empty-worker.js';
33 var scope = 'resources/'; 40 var scope = 'resources/';
34 41
35 return service_worker_unregister_and_register(test, script_url, scope) 42 return service_worker_unregister_and_register(test, script_url, scope)
36 .then(r => { 43 .then(r => {
37 registration = r; 44 registration = r;
38 return wait_for_state(test, registration.installing, 'installed'); 45 return wait_for_state(test, registration.installing, 'installed');
39 }) 46 })
40 .then(state => { 47 .then(state => {
41 assert_equals(state, 'installed'); 48 assert_equals(state, 'installed');
42 return registration.paymentAppManager.setManifest({ 49 return registration.paymentAppManager.setManifest({
43 label: 'Payment App' 50 name: 'Payment App',
51 icon: 'payment-app-icon',
52 options: [{
53 name: 'Visa ****',
54 icon: 'payment-app-icon',
55 id: 'payment-app-id',
56 enabledMethods: ['visa']
57 }]
44 }); 58 });
45 }) 59 })
46 .then(result => { 60 .then(result => {
47 assert_equals(result, undefined); 61 assert_equals(result, undefined);
48 }) 62 })
49 .catch(unreached_rejection(test)); 63 .catch(unreached_rejection(test));
50 }, 'If registration has waiting worker, then wait for active worker and ' 64 }, 'If registration has waiting worker, then wait for active worker and '
51 + 'then setManifest() is succeeded.'); 65 + 'then setManifest() is succeeded.');
52 66
53 promise_test(test => { 67 promise_test(test => {
54 var registration; 68 var registration;
55 var script_url = 'resources/empty-worker.js'; 69 var script_url = 'resources/empty-worker.js';
56 var scope = 'resources/'; 70 var scope = 'resources/';
57 71
58 return service_worker_unregister_and_register(test, script_url, scope) 72 return service_worker_unregister_and_register(test, script_url, scope)
59 .then(r => { 73 .then(r => {
60 registration = r; 74 registration = r;
61 registration.unregister(); 75 registration.unregister();
62 return wait_for_state(test, registration.installing, 'redundant'); 76 return wait_for_state(test, registration.installing, 'redundant');
63 }) 77 })
64 .then(state => { 78 .then(state => {
65 assert_equals(state, 'redundant'); 79 assert_equals(state, 'redundant');
66 assert_equals(registration.installing, null); 80 assert_equals(registration.installing, null);
67 assert_equals(registration.waiting, null); 81 assert_equals(registration.waiting, null);
68 assert_equals(registration.active, null); 82 assert_equals(registration.active, null);
69 return registration.paymentAppManager.setManifest({ 83 return registration.paymentAppManager.setManifest({
70 label: 'Payment App' 84 name: 'Payment App',
85 icon: 'payment-app-icon',
86 options: [{
87 name: 'Visa ****',
88 icon: 'payment-app-icon',
89 id: 'payment-app-id',
90 enabledMethods: ['visa']
91 }]
71 }); 92 });
72 }) 93 })
73 .then(unreached_fulfillment(test)) 94 .then(unreached_fulfillment(test))
74 .catch(error => { 95 .catch(error => {
75 assert_equals(error.name, 'InvalidStateError'); 96 assert_equals(error.name, 'InvalidStateError');
76 }); 97 });
77 }, 'If registration has no active worker, no waiting worker and ' 98 }, 'If registration has no active worker, no waiting worker and '
78 + 'no installing worker, then throws InvalidStateError.'); 99 + 'no installing worker, then throws InvalidStateError.');
79 100
80 promise_test(test => { 101 promise_test(test => {
81 var registration; 102 var registration;
82 var script_url = 'resources/empty-worker.js'; 103 var script_url = 'resources/empty-worker.js';
83 var scope = 'resources/'; 104 var scope = 'resources/';
84 var manifest = { 105 var manifest = {
85 label: 'Payment App', 106 name: 'Payment App',
86 icon: 'payment-app-icon', 107 icon: 'payment-app-icon',
87 options: [{ 108 options: [{
88 label: 'Visa ****', 109 name: 'Visa ****',
89 icon: 'payment-app-icon', 110 icon: 'payment-app-icon',
90 id: 'payment-app-id', 111 id: 'payment-app-id',
91 enabledMethods: ['visa2'] 112 enabledMethods: ['visa2']
92 }] 113 }]
93 }; 114 };
94 115
95 return service_worker_unregister_and_register(test, script_url, scope) 116 return service_worker_unregister_and_register(test, script_url, scope)
96 .then(r => { 117 .then(r => {
97 registration = r; 118 registration = r;
98 return wait_for_state(test, registration.installing, 'activated'); 119 return wait_for_state(test, registration.installing, 'activated');
(...skipping 10 matching lines...) Expand all
109 assert_object_equals(read_manifest, manifest); 130 assert_object_equals(read_manifest, manifest);
110 }) 131 })
111 .catch(unreached_rejection(test)); 132 .catch(unreached_rejection(test));
112 }, 'If getManifest() is succeeded, then resolves stored manifest data.'); 133 }, 'If getManifest() is succeeded, then resolves stored manifest data.');
113 134
114 promise_test(test => { 135 promise_test(test => {
115 var registration; 136 var registration;
116 var script_url = 'resources/empty-worker.js'; 137 var script_url = 'resources/empty-worker.js';
117 var scope = 'resources/'; 138 var scope = 'resources/';
118 var manifest = { 139 var manifest = {
119 label: 'Payment App', 140 name: 'Payment App',
120 icon: 'payment-app-icon', 141 icon: 'payment-app-icon',
121 options: [{ 142 options: [{
122 label: 'Visa ****', 143 name: 'Visa ****',
123 icon: 'payment-app-icon', 144 icon: 'payment-app-icon',
124 id: 'payment-app-id', 145 id: 'payment-app-id',
125 enabledMethods: ['visa2'] 146 enabledMethods: ['visa2']
126 }] 147 }]
127 }; 148 };
128 149
129 return service_worker_unregister_and_register(test, script_url, scope) 150 return service_worker_unregister_and_register(test, script_url, scope)
130 .then(r => { 151 .then(r => {
131 registration = r; 152 registration = r;
132 return wait_for_state(test, registration.installing, 'activated'); 153 return wait_for_state(test, registration.installing, 'activated');
(...skipping 30 matching lines...) Expand all
163 assert_equals(state, 'activated'); 184 assert_equals(state, 'activated');
164 return registration.paymentAppManager.getManifest(); 185 return registration.paymentAppManager.getManifest();
165 }) 186 })
166 .then(unreached_fulfillment(test)) 187 .then(unreached_fulfillment(test))
167 .catch(error => { 188 .catch(error => {
168 assert_equals(error.name, 'AbortError'); 189 assert_equals(error.name, 'AbortError');
169 }); 190 });
170 }, 'If there is no manifest data, then throws AbortError.'); 191 }, 'If there is no manifest data, then throws AbortError.');
171 192
172 </script> 193 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698