| OLD | NEW |
| 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="../resources/mojo-helpers.js"></script> | 4 <script src="../resources/mojo-helpers.js"></script> |
| 5 <script src="resources/nfc-helpers.js"></script> | 5 <script src="resources/nfc-helpers.js"></script> |
| 6 <script> | 6 <script> |
| 7 | 7 |
| 8 'use strict'; | 8 'use strict'; |
| 9 | 9 |
| 10 const invalid_messages = | 10 const invalid_messages = |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 nfc.mockNFC.setHWStatus(NFCHWStatus.NOT_SUPPORTED); | 79 nfc.mockNFC.setHWStatus(NFCHWStatus.NOT_SUPPORTED); |
| 80 return assertRejectsWithError(navigator.nfc.push(test_text_data), | 80 return assertRejectsWithError(navigator.nfc.push(test_text_data), |
| 81 'NotSupportedError'); | 81 'NotSupportedError'); |
| 82 }, 'nfc.push should fail when NFC HW is not supported.') | 82 }, 'nfc.push should fail when NFC HW is not supported.') |
| 83 | 83 |
| 84 nfc_test(nfc => { | 84 nfc_test(nfc => { |
| 85 return navigator.nfc.push(test_text_data, { timeout: 1 }); | 85 return navigator.nfc.push(test_text_data, { timeout: 1 }); |
| 86 }, 'nfc.push should succeed when NFC HW is enabled'); | 86 }, 'nfc.push should succeed when NFC HW is enabled'); |
| 87 | 87 |
| 88 nfc_test(nfc => { | 88 nfc_test(nfc => { |
| 89 return assertRejectsWithError( |
| 90 navigator.nfc.push(test_text_data, { timeout: 'invalid' }), 'TypeError'); |
| 91 }, 'nfc.push should fail when invalid timeout is provided'); |
| 92 |
| 93 nfc_test(nfc => { |
| 94 return assertRejectsWithError( |
| 95 navigator.nfc.push(test_text_data, { timeout: -1 }), 'TypeError'); |
| 96 }, 'nfc.push should fail when invalid negative timeout value is provided'); |
| 97 |
| 98 nfc_test(nfc => { |
| 89 nfc.mockNFC.setPendingPushCompleted(false); | 99 nfc.mockNFC.setPendingPushCompleted(false); |
| 90 return assertRejectsWithError( | 100 return assertRejectsWithError( |
| 91 navigator.nfc.push(test_text_data,{ timeout: 1 }), | 101 navigator.nfc.push(test_text_data,{ timeout: 1 }), |
| 92 'TimeoutError'); | 102 'TimeoutError'); |
| 93 }, 'nfc.push should fail with TimeoutError when push operation is not' + | 103 }, 'nfc.push should fail with TimeoutError when push operation is not' + |
| 94 ' completed before specified timeout value.') | 104 ' completed before specified timeout value.') |
| 95 | 105 |
| 96 nfc_test(nfc => { | 106 nfc_test(nfc => { |
| 97 let message = createMessage([createTextRecord(test_text_data), | 107 let message = createMessage([createTextRecord(test_text_data), |
| 98 createJsonRecord(test_json_data), | 108 createJsonRecord(test_json_data), |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 return assertRejectsWithError(promise, 'AbortError'); | 154 return assertRejectsWithError(promise, 'AbortError'); |
| 145 }, 'nfc.cancelPush should reject pending promise with AbortError.') | 155 }, 'nfc.cancelPush should reject pending promise with AbortError.') |
| 146 | 156 |
| 147 nfc_test(nfc => { | 157 nfc_test(nfc => { |
| 148 return assertRejectsWithError( | 158 return assertRejectsWithError( |
| 149 navigator.nfc.push(new ArrayBuffer(32 * 1024 + 1)), | 159 navigator.nfc.push(new ArrayBuffer(32 * 1024 + 1)), |
| 150 'NotSupportedError'); | 160 'NotSupportedError'); |
| 151 }, 'Reject promise with NotSupportedError if NFC message size exceeds 32KB.'); | 161 }, 'Reject promise with NotSupportedError if NFC message size exceeds 32KB.'); |
| 152 | 162 |
| 153 </script> | 163 </script> |
| OLD | NEW |