| 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> | 4 <script> |
| 5 | 5 |
| 6 var prompt_test_cases = [ | 6 var prompt_test_cases = [ |
| 7 { | 7 { |
| 8 name: 'prompt-accept', | 8 name: 'prompt-accept', |
| 9 cancel: true, | 9 cancel: true, |
| 10 late: false, | 10 late: false, |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // A call to prompt() before preventDefault should reject. | 107 // A call to prompt() before preventDefault should reject. |
| 108 verify_prompt_reject(e, t); | 108 verify_prompt_reject(e, t); |
| 109 } | 109 } |
| 110 | 110 |
| 111 // prompt() has been fired or the event has not been canceled, so ch
eck | 111 // prompt() has been fired or the event has not been canceled, so ch
eck |
| 112 // the userChoice promise and call the next test. | 112 // the userChoice promise and call the next test. |
| 113 verify_userChoice(e, t, test_case, index); | 113 verify_userChoice(e, t, test_case, index); |
| 114 }); | 114 }); |
| 115 window.addEventListener('beforeinstallprompt', event_handler); | 115 window.addEventListener('beforeinstallprompt', event_handler); |
| 116 | 116 |
| 117 testRunner.dispatchBeforeInstallPromptEvent(index, ['foo', 'bar'], t.ste
p_func(function(result) { | 117 testRunner.dispatchBeforeInstallPromptEvent(['foo', 'bar'], t.step_func(
function(result) { |
| 118 testRunner.resolveBeforeInstallPromptPromise(index, test_case.platfo
rm); | 118 testRunner.resolveBeforeInstallPromptPromise(test_case.platform); |
| 119 })); | 119 })); |
| 120 | 120 |
| 121 // Test that firing prompt() outside of the handler resolves or rejects
correctly. | 121 // Test that firing prompt() outside of the handler resolves or rejects
correctly. |
| 122 if (test_case.late) { | 122 if (test_case.late) { |
| 123 if (test_case.cancel) { | 123 if (test_case.cancel) { |
| 124 verify_prompt_resolve(event, t); | 124 verify_prompt_resolve(event, t); |
| 125 } else { | 125 } else { |
| 126 verify_prompt_reject(event, t); | 126 verify_prompt_reject(event, t); |
| 127 } | 127 } |
| 128 // Check userChoice and call the next test. | 128 // Check userChoice and call the next test. |
| 129 verify_userChoice(event, t, test_case, index); | 129 verify_userChoice(event, t, test_case, index); |
| 130 } | 130 } |
| 131 }, test_case.name); | 131 }, test_case.name); |
| 132 } | 132 } |
| 133 | 133 |
| 134 prompt_test(0); | 134 prompt_test(0); |
| 135 </script> | 135 </script> |
| OLD | NEW |