|
46 | 46 | nfc_test(async (t, mockNFC) => {
|
47 | 47 | mockNFC.simulateClosedPipe();
|
48 | 48 | const reader = new NDEFReader();
|
49 |
| - const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]); |
50 |
| - const promise = readerWatcher.wait_for("error").then(event => { |
51 |
| - assert_true(event instanceof ErrorEvent); |
52 |
| - }); |
53 | 49 | await promise_rejects_dom(t, 'NotSupportedError', reader.scan());
|
54 |
| - await promise; |
55 |
| -}, "Test that an error event happens if no implementation for NFC Mojo interface \ |
56 |
| -is available."); |
| 50 | +}, "NDEFReader.scan should faild if no implementation for NFC Mojo interface."); |
57 | 51 |
|
58 | 52 | nfc_test(async (t, mockNFC) => {
|
59 | 53 | mockNFC.setHWStatus(NFCHWStatus.DISABLED);
|
|
70 | 64 | nfc_test(async (t, mockNFC) => {
|
71 | 65 | const reader = new NDEFReader();
|
72 | 66 | const controller = new AbortController();
|
73 |
| - const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]); |
| 67 | + const readerWatcher = new EventWatcher(t, reader, ["reading", "readingerror"]); |
74 | 68 | const promise = readerWatcher.wait_for("reading").then(event => {
|
75 | 69 | assert_true(event instanceof NDEFReadingEvent);
|
76 | 70 | controller.abort();
|
|
84 | 78 | nfc_test(async (t, mockNFC) => {
|
85 | 79 | const reader = new NDEFReader();
|
86 | 80 | const controller = new AbortController();
|
87 |
| - const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]); |
| 81 | + const readerWatcher = new EventWatcher(t, reader, ["reading", "readingerror"]); |
88 | 82 | const promise = readerWatcher.wait_for("reading").then(event => {
|
89 | 83 | assert_true(event instanceof NDEFReadingEvent);
|
90 | 84 | controller.abort();
|
|
114 | 108 | nfc_test(async (t, mockNFC) => {
|
115 | 109 | const reader = new NDEFReader();
|
116 | 110 | const controller = new AbortController();
|
117 |
| - const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]); |
| 111 | + const readerWatcher = new EventWatcher(t, reader, ["reading", "readingerror"]); |
118 | 112 | const message = createMessage([createTextRecord(test_text_data)]);
|
119 | 113 | const promise = readerWatcher.wait_for("reading").then(event => {
|
120 | 114 | assert_true(event instanceof NDEFReadingEvent);
|
|
135 | 129 | nfc_test(async (t, mockNFC) => {
|
136 | 130 | const reader = new NDEFReader();
|
137 | 131 | const controller = new AbortController();
|
138 |
| - const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]); |
| 132 | + const readerWatcher = new EventWatcher(t, reader, ["reading", "readingerror"]); |
139 | 133 | const promise = readerWatcher.wait_for("reading").then(event => {
|
140 | 134 | controller.abort();
|
141 | 135 | assert_true(event instanceof NDEFReadingEvent);
|
|
172 | 166 | nfc_test(async (t, mockNFC) => {
|
173 | 167 | const reader = new NDEFReader();
|
174 | 168 | const controller = new AbortController();
|
175 |
| - const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]); |
| 169 | + const readerWatcher = new EventWatcher(t, reader, ["reading", "readingerror"]); |
176 | 170 | const promise = readerWatcher.wait_for("reading").then(event => {
|
177 | 171 | controller.abort();
|
178 | 172 | assert_true(event instanceof NDEFReadingEvent);
|
|
225 | 219 | const promises = [];
|
226 | 220 |
|
227 | 221 | const reader1 = new NDEFReader();
|
228 |
| - const readerWatcher1 = new EventWatcher(t, reader1, ["reading", "error"]); |
229 |
| - const promise1 = readerWatcher1.wait_for("error").then(event => { |
230 |
| - assert_true(event instanceof ErrorEvent); |
231 |
| - }); |
| 222 | + const readerWatcher1 = new EventWatcher(t, reader1, ["reading", "readingerror"]); |
| 223 | + const promise1 = readerWatcher1.wait_for("readingerror"); |
232 | 224 | promises.push(promise1);
|
233 | 225 | await reader1.scan();
|
234 | 226 |
|
235 | 227 | const reader2 = new NDEFReader();
|
236 |
| - const readerWatcher2 = new EventWatcher(t, reader2, ["reading", "error"]); |
237 |
| - const promise2 = readerWatcher2.wait_for("error").then(event => { |
238 |
| - assert_true(event instanceof ErrorEvent); |
239 |
| - }); |
| 228 | + const readerWatcher2 = new EventWatcher(t, reader2, ["reading", "readingerror"]); |
| 229 | + const promise2 = readerWatcher2.wait_for("readingerror"); |
240 | 230 | promises.push(promise2);
|
241 | 231 | await reader2.scan();
|
242 | 232 |
|
243 | 233 | mockNFC.simulateNonNDEFTagDiscovered();
|
244 | 234 | await Promise.all(promises);
|
245 |
| -}, "Test that NDEFReader.onerror should be fired if the NFC tag does not \ |
| 235 | +}, "Test that NDEFReader.onreadingerror should be fired if the NFC tag does not \ |
246 | 236 | expose NDEF technology.");
|
247 | 237 |
|
248 | 238 | nfc_test(async (t, mockNFC) => {
|
249 | 239 | const reader = new NDEFReader();
|
250 | 240 | const controller = new AbortController();
|
251 |
| - const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]); |
| 241 | + const readerWatcher = new EventWatcher(t, reader, ["reading", "readingerror"]); |
252 | 242 | const promise = readerWatcher.wait_for("reading").then(event => {
|
253 | 243 | assert_equals(event.serialNumber, fake_tag_serial_number);
|
254 | 244 | assert_equals(event.message.records.length, 0);
|
|
272 | 262 | createUrlRecord(test_url_data, true),
|
273 | 263 | createRecord('w3.org:xyz', test_buffer_data)],
|
274 | 264 | test_message_origin);
|
275 |
| - const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]); |
| 265 | + const readerWatcher = new EventWatcher(t, reader, ["reading", "readingerror"]); |
276 | 266 | const promise = readerWatcher.wait_for("reading").then(event => {
|
277 | 267 | assert_equals(event.serialNumber, fake_tag_serial_number);
|
278 | 268 | assertWebNDEFMessagesEqual(event.message, new NDEFMessage(message));
|
|
0 commit comments