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

Unified Diff: LayoutTests/http/tests/storage/durability-basics.html

Issue 1154573005: Expose Durable Storage API to script (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: change DEPS comment, clean stuff up Created 5 years, 4 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: LayoutTests/http/tests/storage/durability-basics.html
diff --git a/LayoutTests/http/tests/storage/durability-basics.html b/LayoutTests/http/tests/storage/durability-basics.html
new file mode 100644
index 0000000000000000000000000000000000000000..b6369ebe4e0ae47737f8f335aceaa8b53d3e3f4c
--- /dev/null
+++ b/LayoutTests/http/tests/storage/durability-basics.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<title>navigator.storage methods return promises that are fulfilled</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+
+test(function() { assert_true(!!navigator.storage); },
+ "These tests requires navigator.storage");
+
+promise_test(function() {
+ var promise = navigator.storage.requestPersistent();
+ assert_true(promise instanceof Promise,
+ "navigator.storage.requestPersistent() returned a Promise.")
+ return promise.then(function (result) {
+ // Layout tests get canned results, not the strings per spec. So testing
+ // their values here would only be testing our test plumbing. But we can
+ // test that a string is being returned instead of something else.
+ assert_equals(typeof result, "string", result + " should be a string");
+ assert_greater_than(result.length, 0, "result should have length >0");
+ });
+}, "navigator.storage.requestPersistent returns a promise that resolves.");
+
+promise_test(function() {
+ var promise = navigator.storage.persistentPermission();
+ assert_true(promise instanceof Promise,
+ "navigator.storage.persistentPermission() returned a Promise.")
+ return promise.then(function (result) {
+ // See comment above about why the result value isn't being tested here.
+ 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.");
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698