Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(421)

Unified Diff: LayoutTests/app_banner/app-banner-event-prompt.html

Issue 1257823003: Revert of Refactor BeforeInstallPromptEvent to use ScriptPromiseProperty (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/LeakExpectations ('k') | Source/bindings/core/v8/ScriptPromiseProperties.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « LayoutTests/LeakExpectations ('k') | Source/bindings/core/v8/ScriptPromiseProperties.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698