| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <title>navigator.storage methods return promises that are fulfilled</title> | |
| 3 <script src="/resources/testharness.js"></script> | |
| 4 <script src="/resources/testharnessreport.js"></script> | |
| 5 <script> | |
| 6 | |
| 7 test(function() { assert_true(!!navigator.storage); }, | |
| 8 "These tests requires navigator.storage"); | |
| 9 | |
| 10 promise_test(function() { | |
| 11 var promise = navigator.storage.persist(); | |
| 12 assert_true(promise instanceof Promise, | |
| 13 "navigator.storage.persist() returned a Promise."); | |
| 14 return promise.then(function (result) { | |
| 15 // Layout tests get canned results, not the value per spec. So testing | |
| 16 // their values here would only be testing our test plumbing. But we can | |
| 17 // test that the type of the returned value is correct. | |
| 18 assert_equals(typeof result, "boolean", result + " should be boolean"); | |
| 19 }); | |
| 20 }, "navigator.storage.persist returns a promise that resolves."); | |
| 21 | |
| 22 promise_test(function() { | |
| 23 var promise = navigator.storage.persisted(); | |
| 24 assert_true(promise instanceof Promise, | |
| 25 "navigator.storage.persisted() returned a Promise."); | |
| 26 return promise.then(function (result) { | |
| 27 // See comment above about why the result value isn't being tested here. | |
| 28 assert_equals(typeof result, "boolean", result + " should be boolean"); | |
| 29 }); | |
| 30 }, "navigator.storage.persisted returns a promise that resolves."); | |
| 31 | |
| 32 </script> | |
| OLD | NEW |