Chromium Code Reviews| Index: LayoutTests/http/tests/storage/resources/durability-worker.js |
| diff --git a/LayoutTests/http/tests/storage/resources/durability-worker.js b/LayoutTests/http/tests/storage/resources/durability-worker.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a3f03acb19431cf070b6e0824e3d05276f6a0d4e |
| --- /dev/null |
| +++ b/LayoutTests/http/tests/storage/resources/durability-worker.js |
| @@ -0,0 +1,22 @@ |
| +importScripts("/resources/testharness.js"); |
| + |
| +test(function() { assert_true("storage" in navigator); }, |
| + "These worker tests require navigator.storage"); |
| + |
| +test(function() { assert_false("requestPersistent" in navigator.storage); }, |
|
jsbell
2015/08/21 19:05:28
On the TODO list (but low priority): we should add
|
| + "navigator.storage.requestPersistent should not exist in workers"); |
| + |
| +promise_test(function() { |
| + var promise = navigator.storage.persistentPermission(); |
| + assert_true(promise instanceof Promise, |
| + "navigator.storage.persistentPermission() returned a Promise.") |
| + return promise.then(function (result) { |
| + // Layout tests get canned results, not the value per spec. So testing |
| + // their values here would only be testing our test plumbing. But we can |
| + // test that the type of the returned value is correct. |
| + assert_equals(typeof result, "string", result + " should be a string"); |
| + assert_greater_than(result.length, 0, "result should have length >0"); |
| + }); |
| +}, "navigator.storage.persistentPermission returns a promise that resolves."); |
| + |
| +done(); |