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

Unified Diff: third_party/WebKit/LayoutTests/app_banner/before-install-prompt-event-constructor.html

Issue 2393513004: Convert app banners to use Mojo. (Closed)
Patch Set: Add TODO Created 4 years, 2 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
Index: third_party/WebKit/LayoutTests/app_banner/before-install-prompt-event-constructor.html
diff --git a/third_party/WebKit/LayoutTests/app_banner/before-install-prompt-event-constructor.html b/third_party/WebKit/LayoutTests/app_banner/before-install-prompt-event-constructor.html
index a10fab266a2cf56adcba1ff4d6b383e1c17182a6..f8763d2f686f135e411d1d8882854455692fba46 100644
--- a/third_party/WebKit/LayoutTests/app_banner/before-install-prompt-event-constructor.html
+++ b/third_party/WebKit/LayoutTests/app_banner/before-install-prompt-event-constructor.html
@@ -11,6 +11,40 @@ test(function() {
test(function() {
var event = new BeforeInstallPromptEvent('eventType', { platforms: ['a'] });
assert_array_equals(['a'], event.platforms, 'platforms');
-}, 'paltforms is passed');
-</script>
+}, 'platforms is passed');
+
+test(function() {
+ var event = new BeforeInstallPromptEvent('eventType', { platforms: ['a'] });
+ event.preventDefault();
+}, 'preventDefault called');
+
+async_test(function(t) {
+ var event = new BeforeInstallPromptEvent('eventType', { platforms: ['a'] });
+ var thrown = false;
+ var rejected = false;
+ event.prompt()
+ .then(t.unreached_func('prompt() should not resolve'), function(){
+ rejected = true;
+ })
+ .catch(function(reason) { thrown = true; });
+ t.done();
+
+ assert_true(rejected);
+ assert_true(thrown);
+}, 'prompt() called and rejected');
+async_test(function(t) {
+ var event = new BeforeInstallPromptEvent('eventType', { platforms: ['a'] });
+ var thrown = false;
+ var rejected = false;
+ event.userChoice
+ .then(t.unreached_func('userChoice should not resolve'), function(){
+ rejected = true;
+ })
+ .catch(function(reason) { thrown = true; });
+ t.done();
+
+ assert_true(rejected);
+ assert_true(thrown);
+}, 'userChoice accessed, throws and rejects');
+</script>

Powered by Google App Engine
This is Rietveld 408576698