diff --git a/testing/web-platform/tests/storage/estimate-indexeddb.https.any.js b/testing/web-platform/tests/storage/estimate-indexeddb.https.any.js index 7e84ae0f0ee12..43511e29a9bd0 100644 --- a/testing/web-platform/tests/storage/estimate-indexeddb.https.any.js +++ b/testing/web-platform/tests/storage/estimate-indexeddb.https.any.js @@ -27,144 +27,37 @@ resources util . js -test -( -t -= -> -{ -assert_true -( -' -estimate -' -in -navigator -. -storage -) -; -assert_equals -( -typeof -navigator -. -storage -. -estimate -' -function -' -) -; -assert_true -( -navigator -. -storage +/ +/ +Technically +this +verifies +unspecced +behavior . -estimate -( -) -instanceof -Promise -) -; -} -' -estimate -( -) -method -exists -and -returns -a -Promise -' -) -; -promise_test -( -async -t -= -> -{ -const -estimate -= -await -navigator +See +/ +/ +https +: +/ +/ +github . +com +/ +whatwg +/ storage +/ +issues +/ +110 +for +defining +this +behavior . -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 -' -) -; -} -' -estimate -( -) -resolves -to -dictionary -with -members -' -) -; promise_test ( async diff --git a/testing/web-platform/tests/storage/storagemanager-estimate.https.any.js b/testing/web-platform/tests/storage/storagemanager-estimate.https.any.js index 3e3f076c40c22..d3cc652221420 100644 --- a/testing/web-platform/tests/storage/storagemanager-estimate.https.any.js +++ b/testing/web-platform/tests/storage/storagemanager-estimate.https.any.js @@ -11,13 +11,36 @@ estimate ) test ( -function -( t -) += +> { assert_true ( +' +estimate +' +in +navigator +. +storage +) +; +assert_equals +( +typeof +navigator +. +storage +. +estimate +' +function +' +) +; +assert_true +( navigator . storage @@ -35,6 +58,8 @@ estimate ( ) method +exists +and returns a Promise @@ -43,12 +68,15 @@ Promise ; promise_test ( -function -( +async t -) += +> { -return +const +result += +await navigator . storage @@ -56,14 +84,7 @@ storage estimate ( ) -. -then -( -function -( -result -) -{ +; assert_equals ( typeof @@ -114,9 +135,6 @@ number ) ; } -) -; -} ' estimate ( @@ -129,342 +147,3 @@ members ' ) ; -promise_test -( -function -( -t -) -{ -const -large_value -= -new -Uint8Array -( -1e6 -) -; -const -dbname -= -db -- -{ -location -} -- -{ -t -. -name -} -; -let -db -before -after -; -indexedDB -. -deleteDatabase -( -dbname -) -; -return -new -Promise -( -( -resolve -reject -) -= -> -{ -const -open -= -indexedDB -. -open -( -dbname -) -; -open -. -onerror -= -( -) -= -> -{ -reject -( -open -. -error -) -; -} -; -open -. -onupgradeneeded -= -( -) -= -> -{ -const -connection -= -open -. -result -; -connection -. -createObjectStore -( -' -store -' -) -; -} -; -open -. -onsuccess -= -( -) -= -> -{ -const -connection -= -open -. -result -; -t -. -add_cleanup -( -( -) -= -> -{ -connection -. -close -( -) -; -indexedDB -. -deleteDatabase -( -dbname -) -; -} -) -; -resolve -( -connection -) -; -} -; -} -) -. -then -( -connection -= -> -{ -db -= -connection -; -return -navigator -. -storage -. -estimate -( -) -; -} -) -. -then -( -estimate -= -> -{ -before -= -estimate -. -usage -; -return -new -Promise -( -( -resolve -reject -) -= -> -{ -const -tx -= -db -. -transaction -( -' -store -' -' -readwrite -' -) -; -tx -. -objectStore -( -' -store -' -) -. -put -( -large_value -' -key -' -) -; -tx -. -onabort -= -( -) -= -> -{ -reject -( -tx -. -error -) -; -} -; -tx -. -oncomplete -= -( -) -= -> -{ -resolve -( -) -; -} -; -} -) -; -} -) -. -then -( -( -) -= -> -{ -return -navigator -. -storage -. -estimate -( -) -; -} -) -. -then -( -estimate -= -> -{ -after -= -estimate -. -usage -; -assert_greater_than -( -after -before -' -estimated -usage -should -increase -' -) -; -} -) -; -} -' -estimate -( -) -shows -usage -increase -after -1MB -IndexedDB -record -is -stored -' -) -;