commit d80f6077e1ca8e7684aece00c5484ae6923bbec9 parent 9bd442c764b616066774a3199c7f0d5380518987 Author: Brian Lefler <bcl@google.com> Date: Mon, 8 Dec 2025 12:28:34 +0000 Bug 2004435 [wpt PR 56526] - Add a fieldtrial testing entry for StaticStorageQuota and update tests., a=testonly Automatic update from web-platform-tests Add a fieldtrial testing entry for StaticStorageQuota and update tests. There is no single spec-defined correct value for estimated quota and the associated WPTs are marked as tentative, so this change relaxes the related asserts so the WPTs pass with StaticStorageQuota both on and off. Note that Safari and FF both have their own distinct, but within spec, behavior for estimated quota and so there might need to be more relaxation of these WPTs to make them non-tentative. Bug: 369865059 Change-Id: Ifd10f007248760a8278fbb9ecaea165823aa9b54 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7188470 Reviewed-by: Zainab Rizvi <rizvis@google.com> Auto-Submit: Brian Lefler <bcl@google.com> Reviewed-by: Tsuyoshi Horo <horo@chromium.org> Commit-Queue: Zainab Rizvi <rizvis@google.com> Cr-Commit-Position: refs/heads/main@{#1554612} -- wpt-commits: face75f100a5a5dcb24aabd578306df575e15e25 wpt-pr: 56526 Diffstat:
2 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/testing/web-platform/tests/storage/buckets/buckets_storage_policy.tentative.https.any.js b/testing/web-platform/tests/storage/buckets/buckets_storage_policy.tentative.https.any.js @@ -8,11 +8,11 @@ function sanitizeQuota(quota) { return Math.max(1, Math.min(Number.MAX_SAFE_INTEGER, Math.floor(quota))); } -async function testQuota(storageKeyQuota, quota, name) { +async function testQuota(quota, name) { const safeQuota = sanitizeQuota(quota); const bucket = await navigator.storageBuckets.open(name, { quota: safeQuota }); const estimateQuota = (await bucket.estimate()).quota; - assert_equals(estimateQuota, Math.min(safeQuota, storageKeyQuota)); + assert_equals(estimateQuota, safeQuota); } promise_test(async testCase => { @@ -20,13 +20,9 @@ promise_test(async testCase => { const storageKeyQuota = (await navigator.storage.estimate()).quota; - testQuota(storageKeyQuota, 1, 'one'); - testQuota(storageKeyQuota, storageKeyQuota / 4, 'quarter'); - testQuota(storageKeyQuota, storageKeyQuota / 2, 'half'); - testQuota(storageKeyQuota, storageKeyQuota - 1, 'one_less'); - testQuota(storageKeyQuota, storageKeyQuota, 'origin_quota'); - testQuota(storageKeyQuota, storageKeyQuota + 1, 'one_more'); - testQuota(storageKeyQuota, storageKeyQuota * 2, 'twice'); - testQuota(storageKeyQuota, storageKeyQuota * 4, 'four_times'); - testQuota(storageKeyQuota, Number.MAX_SAFE_INTEGER, 'max_safe_int'); -}, 'For an individual bucket, the quota is the minimum of the requested quota and the StorageKey quota.'); + testQuota(1, 'one'); + testQuota(storageKeyQuota / 4, 'quarter'); + testQuota(storageKeyQuota / 2, 'half'); + testQuota(storageKeyQuota - 1, 'one_less'); + testQuota(storageKeyQuota, 'origin_quota'); +}, 'Bucket quota is properly set as long as it is within the storage quota'); diff --git a/testing/web-platform/tests/storage/buckets/storage_bucket_object.tentative.https.any.js b/testing/web-platform/tests/storage/buckets/storage_bucket_object.tentative.https.any.js @@ -31,7 +31,7 @@ promise_test(async testCase => { await inboxCache.put(cacheKey, new Response('bread x 2')) const estimate2 = await bucket.estimate(); - assert_equals(estimate.quota, estimate2.quota); + assert_greater_than(estimate2.quota, 0); assert_less_than(estimate.usage, estimate2.usage); }, 'estimate() should retrieve quota usage');