diff --git a/testing/web-platform/tests/storage/estimate-usage-details-application-cache.https.tentative.html b/testing/web-platform/tests/storage/estimate-usage-details-application-cache.https.tentative.html new file mode 100644 index 000000000000..464a99887bdb --- /dev/null +++ b/testing/web-platform/tests/storage/estimate-usage-details-application-cache.https.tentative.html @@ -0,0 +1,29 @@ + + +Quota Estimate: usage details reflect application cache changes. + + + + + + + diff --git a/testing/web-platform/tests/storage/estimate-usage-details-caches.https.tentative.any.js b/testing/web-platform/tests/storage/estimate-usage-details-caches.https.tentative.any.js new file mode 100644 index 000000000000..bf889f84184f --- /dev/null +++ b/testing/web-platform/tests/storage/estimate-usage-details-caches.https.tentative.any.js @@ -0,0 +1,20 @@ +// META: title=StorageManager: estimate() for caches + +promise_test(async t => { + let estimate = await navigator.storage.estimate(); + + const cachesUsageBeforeCreate = estimate.usageDetails.caches || 0; + + const cacheName = 'testCache'; + const cache = await caches.open(cacheName); + t.add_cleanup(() => caches.delete(cacheName)); + + await cache.put('/test.json', new Response('x'.repeat(1024*1024))); + + estimate = await navigator.storage.estimate(); + assert_true('caches' in estimate.usageDetails); + const cachesUsageAfterPut = estimate.usageDetails.caches; + assert_greater_than( + cachesUsageAfterPut, cachesUsageBeforeCreate, + 'estimated usage should increase after value is stored'); +}, 'estimate() shows usage increase after large value is stored'); diff --git a/testing/web-platform/tests/storage/estimate-usage-details.https.tentative.any.js b/testing/web-platform/tests/storage/estimate-usage-details.https.tentative.any.js new file mode 100644 index 000000000000..2a1cea5fb8df --- /dev/null +++ b/testing/web-platform/tests/storage/estimate-usage-details.https.tentative.any.js @@ -0,0 +1,12 @@ +// META: title=StorageManager: estimate() should have usage details + +promise_test(async t => { + const estimate = await navigator.storage.estimate(); + assert_equals(typeof estimate, 'object'); + assert_true('usage' in estimate); + assert_equals(typeof estimate.usage, 'number'); + assert_true('quota' in estimate); + assert_equals(typeof estimate.quota, 'number'); + assert_true('usageDetails' in estimate); + assert_equals(typeof estimate.usageDetails, 'object'); +}, 'estimate() resolves to dictionary with members, including usageDetails'); diff --git a/testing/web-platform/tests/storage/resources/appcache.manifest b/testing/web-platform/tests/storage/resources/appcache.manifest new file mode 100644 index 000000000000..ce90bafd21fe --- /dev/null +++ b/testing/web-platform/tests/storage/resources/appcache.manifest @@ -0,0 +1,3 @@ +CACHE MANIFEST +# iframe_with_appcache_manifest.html references this manifest to get cached in +# AppCache. diff --git a/testing/web-platform/tests/storage/resources/iframe_with_appcache_manifest.html b/testing/web-platform/tests/storage/resources/iframe_with_appcache_manifest.html new file mode 100644 index 000000000000..8365ce41f494 --- /dev/null +++ b/testing/web-platform/tests/storage/resources/iframe_with_appcache_manifest.html @@ -0,0 +1,17 @@ + + +Iframe that will be cached using application cache. + + + +