| Index: LayoutTests/app_banner/app-banner-event-prompt.html
|
| diff --git a/LayoutTests/app_banner/app-banner-event-prompt.html b/LayoutTests/app_banner/app-banner-event-prompt.html
|
| index b5edae164c381abd3475a70c2f4f61f631bfeee5..9fc78cb391d9e6f68045e98b6b780d16ae74aae7 100644
|
| --- a/LayoutTests/app_banner/app-banner-event-prompt.html
|
| +++ b/LayoutTests/app_banner/app-banner-event-prompt.html
|
| @@ -63,12 +63,16 @@ function verify_prompt_reject(e, t) {
|
| );
|
| }
|
|
|
| -function verify_userChoice(e, t, test_case, index) {
|
| +function verify_userChoice(e, t, test_case, index, prompt_called) {
|
| e.userChoice.then(t.step_func(function(result) {
|
| assert_equals(result.platform, test_case.platform, 'Resolved platform');
|
| assert_equals(result.outcome, test_case.outcome, 'Outcome');
|
| })).then(t.step_func(function() {
|
| - verify_prompt_reject(e, t);
|
| + if (prompt_called) {
|
| + verify_prompt_resolve(e, t);
|
| + } else {
|
| + verify_prompt_reject(e, t);
|
| + }
|
| })).then(t.step_func(function() {
|
| prompt_test(index + 1);
|
| t.done();
|
| @@ -92,13 +96,16 @@ function prompt_test(index) {
|
| assert_equals(e.platforms[0], 'foo', 'First platform');
|
| assert_equals(e.platforms[1], 'bar', 'Second platform');
|
|
|
| + if (test_case.cancel) {
|
| + e.preventDefault();
|
| + }
|
| +
|
| if (test_case.late) {
|
| return;
|
| }
|
|
|
| if (test_case.cancel) {
|
| - // Cancel the event, then call prompt() to restart the display pipeline.
|
| - e.preventDefault();
|
| + // Call prompt() to restart the pipeline.
|
| verify_prompt_resolve(e, t);
|
| } else {
|
| // A call to prompt() before preventDefault should reject.
|
| @@ -107,7 +114,7 @@ function prompt_test(index) {
|
|
|
| // prompt() has been fired or the event has not been canceled, so check
|
| // the userChoice promise and call the next test.
|
| - verify_userChoice(e, t, test_case, index);
|
| + verify_userChoice(e, t, test_case, index, test_case.cancel);
|
| });
|
| window.addEventListener('beforeinstallprompt', event_handler);
|
|
|
| @@ -118,13 +125,12 @@ function prompt_test(index) {
|
| // Test that firing prompt() outside of the handler resolves or rejects correctly.
|
| if (test_case.late) {
|
| if (test_case.cancel) {
|
| - event.preventDefault();
|
| verify_prompt_resolve(event, t);
|
| } else {
|
| verify_prompt_reject(event, t);
|
| }
|
| // Check userChoice and call the next test.
|
| - verify_userChoice(event, t, test_case, index);
|
| + verify_userChoice(event, t, test_case, index, test_case.cancel);
|
| }
|
| }, test_case.name);
|
| }
|
|
|