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

Side by Side Diff: third_party/WebKit/LayoutTests/storage/quota/storagequota-query-info.html

Issue 2410403002: Remove the experimental navigator.storageQuota API (Closed)
Patch Set: Rebased Created 3 years, 10 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/storage/quota/storagequota-query-info-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script src="../../resources/js-test.js"></script>
4 </head>
5 <body>
6 <script type="text/javascript">
7 description("This tests navigator.storageQuota.queryInfo.");
8
9 var info;
10 var usage;
11 var quota;
12
13 function onrejected(error) {
14 testFailed(error.name + ": " + error.message);
15 finishJSTest();
16 }
17
18 // Test body functions ----------------------------------------------------
19
20 function runQueryTemporaryTest() {
21 debug("* Querying about temporary storage.");
22 navigator.storageQuota.queryInfo("temporary").then(function(storageInfo) {
23 info = storageInfo;
24 shouldBe("info.__proto__", "Object.prototype");
25
26 usage = storageInfo.usage;
27 quota = storageInfo.quota;
28
29 // Quota value would vary depending on the test environment.
30 shouldBeGreaterThanOrEqual("usage", "0");
31 shouldBeGreaterThanOrEqual("quota", "usage");
32
33 runNextTest();
34 }, onrejected);
35 }
36
37 function runQueryPersistentTest() {
38 debug("* Querying about persistent storage.");
39 navigator.storageQuota.queryInfo("persistent").then(function(storageInfo) {
40 info = storageInfo;
41 shouldBe("info.__proto__", "Object.prototype");
42
43 usage = storageInfo.usage;
44 quota = storageInfo.quota;
45
46 // Quota value would vary depending on the test environment.
47 shouldBeGreaterThanOrEqual("usage", "0");
48 shouldBeGreaterThanOrEqual("quota", "usage");
49
50 runNextTest();
51 }, onrejected);
52 }
53
54 function runQueryUnknownTest() {
55 debug("* Querying about unknown storage.");
56 navigator.storageQuota.queryInfo('unknown').then(function() {
57 testFailed('resolved unexpectedly');
58 }, function(e) {
59 testPassed('rejected as expected: ' + e);
60 }).then(runNextTest);
61 }
62
63 function runQueryWithMissingArgumentTest() {
64 debug("* Querying with missing storage type.");
65 navigator.storageQuota.queryInfo().then(function() {
66 testFailed('resolved unexpectedly');
67 }, function(e) {
68 testPassed('rejected as expected: ' + e);
69 }).then(runNextTest);
70 }
71
72 // End of test body functions ---------------------------------------------
73
74 var testsList = [
75 runQueryTemporaryTest,
76 runQueryPersistentTest,
77 runQueryUnknownTest,
78 runQueryWithMissingArgumentTest,
79 ];
80 var testCounter = 0;
81
82 function runNextTest() {
83 if (testCounter == testsList.length) {
84 debug("Finished running tests.");
85 finishJSTest();
86 } else {
87 testsList[testCounter++]();
88 }
89 }
90
91 if (navigator.storageQuota) {
92 window.jsTestIsAsync = true;
93 runNextTest();
94 } else {
95 debug("This test requires navigator.storageQuota.");
96 }
97 </script>
98 </body>
99 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/storage/quota/storagequota-query-info-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698