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

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

Issue 2747353002: Make BeforeInstallPromptEvent cancelable (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
OLDNEW
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 test(function() { 6 test(function() {
7 assert_false(new BeforeInstallPromptEvent('eventType').bubbles, 'bubbles'); 7 assert_false(new BeforeInstallPromptEvent('eventType').bubbles, 'bubbles');
8 assert_true(new BeforeInstallPromptEvent('eventType').cancelable, 'cancelabl e'); 8 assert_false(new BeforeInstallPromptEvent('eventType').cancelable, 'cancelab le');
9 }, 'No initializer passed'); 9 }, 'No initializer passed');
10 10
11 test(function() { 11 test(function() {
12 assert_true(new BeforeInstallPromptEvent('eventType', { bubbles: true } ).bu bbles, 'bubbles');
13 assert_true(new BeforeInstallPromptEvent('eventType', { cancelable: true } ) .cancelable, 'cancelable');
14 }, 'Initializer values not respected');
15
16 test(function() {
12 var event = new BeforeInstallPromptEvent('eventType', { platforms: ['a'] }); 17 var event = new BeforeInstallPromptEvent('eventType', { platforms: ['a'] });
13 assert_array_equals(['a'], event.platforms, 'platforms'); 18 assert_array_equals(['a'], event.platforms, 'platforms');
14 }, 'platforms is passed'); 19 }, 'platforms is passed');
15 20
16 test(function() { 21 test(function() {
17 var event = new BeforeInstallPromptEvent('eventType', { platforms: ['a'] }); 22 var event = new BeforeInstallPromptEvent('eventType', { platforms: ['a'] });
18 event.preventDefault(); 23 event.preventDefault();
19 }, 'preventDefault called'); 24 }, 'preventDefault called');
20 25
21 async_test(function(t) { 26 async_test(function(t) {
(...skipping 19 matching lines...) Expand all
41 .then(t.unreached_func('userChoice should not resolve'), function(){ 46 .then(t.unreached_func('userChoice should not resolve'), function(){
42 rejected = true; 47 rejected = true;
43 }) 48 })
44 .catch(function(reason) { thrown = true; }); 49 .catch(function(reason) { thrown = true; });
45 t.done(); 50 t.done();
46 51
47 assert_true(rejected); 52 assert_true(rejected);
48 assert_true(thrown); 53 assert_true(thrown);
49 }, 'userChoice accessed, throws and rejects'); 54 }, 'userChoice accessed, throws and rejects');
50 </script> 55 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698