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 9fc78cb391d9e6f68045e98b6b780d16ae74aae7..b5edae164c381abd3475a70c2f4f61f631bfeee5 100644 |
--- a/LayoutTests/app_banner/app-banner-event-prompt.html |
+++ b/LayoutTests/app_banner/app-banner-event-prompt.html |
@@ -63,16 +63,12 @@ |
); |
} |
-function verify_userChoice(e, t, test_case, index, prompt_called) { |
+function verify_userChoice(e, t, test_case, index) { |
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() { |
- if (prompt_called) { |
- verify_prompt_resolve(e, t); |
- } else { |
- verify_prompt_reject(e, t); |
- } |
+ verify_prompt_reject(e, t); |
})).then(t.step_func(function() { |
prompt_test(index + 1); |
t.done(); |
@@ -96,16 +92,13 @@ |
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) { |
- // Call prompt() to restart the pipeline. |
+ // Cancel the event, then call prompt() to restart the display pipeline. |
+ e.preventDefault(); |
verify_prompt_resolve(e, t); |
} else { |
// A call to prompt() before preventDefault should reject. |
@@ -114,7 +107,7 @@ |
// 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, test_case.cancel); |
+ verify_userChoice(e, t, test_case, index); |
}); |
window.addEventListener('beforeinstallprompt', event_handler); |
@@ -125,12 +118,13 @@ |
// 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, test_case.cancel); |
+ verify_userChoice(event, t, test_case, index); |
} |
}, test_case.name); |
} |