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

Side by Side 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, 1 month 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_true(new BeforeInstallPromptEvent('eventType').cancelable, 'cancelabl e');
9 }, 'No initializer passed'); 9 }, 'No initializer passed');
10 10
11 test(function() { 11 test(function() {
12 var event = new BeforeInstallPromptEvent('eventType', { platforms: ['a'] }); 12 var event = new BeforeInstallPromptEvent('eventType', { platforms: ['a'] });
13 assert_array_equals(['a'], event.platforms, 'platforms'); 13 assert_array_equals(['a'], event.platforms, 'platforms');
14 }, 'paltforms is passed'); 14 }, 'platforms is passed');
15
16 test(function() {
17 var event = new BeforeInstallPromptEvent('eventType', { platforms: ['a'] });
18 event.preventDefault();
19 }, 'preventDefault called');
20
21 async_test(function(t) {
22 var event = new BeforeInstallPromptEvent('eventType', { platforms: ['a'] });
23 var thrown = false;
24 var rejected = false;
25 event.prompt()
26 .then(t.unreached_func('prompt() should not resolve'), function(){
27 rejected = true;
28 })
29 .catch(function(reason) { thrown = true; });
30 t.done();
31
32 assert_true(rejected);
33 assert_true(thrown);
34 }, 'prompt() called and rejected');
35
36 async_test(function(t) {
37 var event = new BeforeInstallPromptEvent('eventType', { platforms: ['a'] });
38 var thrown = false;
39 var rejected = false;
40 event.userChoice
41 .then(t.unreached_func('userChoice should not resolve'), function(){
42 rejected = true;
43 })
44 .catch(function(reason) { thrown = true; });
45 t.done();
46
47 assert_true(rejected);
48 assert_true(thrown);
49 }, 'userChoice accessed, throws and rejects');
15 </script> 50 </script>
16
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698