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

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

Issue 1302643002: Update Durable Storage API method signature (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix assert string 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/modules/quota/OWNERS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>navigator.storage methods return promises that are fulfilled</title> 2 <title>navigator.storage methods return promises that are fulfilled</title>
3 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharness.js"></script>
4 <script src="/resources/testharnessreport.js"></script> 4 <script src="/resources/testharnessreport.js"></script>
5 <script> 5 <script>
6 6
7 test(function() { assert_true(!!navigator.storage); }, 7 test(function() { assert_true(!!navigator.storage); },
8 "These tests requires navigator.storage"); 8 "These tests requires navigator.storage");
9 9
10 promise_test(function() { 10 promise_test(function() {
11 var promise = navigator.storage.requestPersistent(); 11 var promise = navigator.storage.requestPersistent();
12 assert_true(promise instanceof Promise, 12 assert_true(promise instanceof Promise,
13 "navigator.storage.requestPersistent() returned a Promise.") 13 "navigator.storage.requestPersistent() returned a Promise.")
14 return promise.then(function (result) { 14 return promise.then(function (result) {
15 // Layout tests get canned results, not the strings per spec. So testing 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 16 // their values here would only be testing our test plumbing. But we can
17 // test that a string is being returned instead of something else. 17 // test that the type of the returned value is correct.
18 assert_equals(typeof result, "string", result + " should be a string"); 18 assert_equals(typeof result, "boolean", result + " should be boolean");
19 assert_greater_than(result.length, 0, "result should have length >0");
20 }); 19 });
21 }, "navigator.storage.requestPersistent returns a promise that resolves."); 20 }, "navigator.storage.requestPersistent returns a promise that resolves.");
22 21
23 promise_test(function() { 22 promise_test(function() {
24 var promise = navigator.storage.persistentPermission(); 23 var promise = navigator.storage.persistentPermission();
25 assert_true(promise instanceof Promise, 24 assert_true(promise instanceof Promise,
26 "navigator.storage.persistentPermission() returned a Promise.") 25 "navigator.storage.persistentPermission() returned a Promise.")
27 return promise.then(function (result) { 26 return promise.then(function (result) {
28 // See comment above about why the result value isn't being tested here. 27 // See comment above about why the result value isn't being tested here.
29 assert_equals(typeof result, "string", result + " should be a string"); 28 assert_equals(typeof result, "string", result + " should be a string");
30 assert_greater_than(result.length, 0, "result should have length >0"); 29 assert_greater_than(result.length, 0, "result should have length >0");
31 }); 30 });
32 }, "navigator.storage.persistentPermission returns a promise that resolves."); 31 }, "navigator.storage.persistentPermission returns a promise that resolves.");
33 32
34 </script> 33 </script>
OLDNEW
« no previous file with comments | « no previous file | Source/modules/quota/OWNERS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698