зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1486832
[wpt PR 12723] - Storage API: Use .any.js (etc) in Web Platform Tests, a=testonly
Automatic update from web-platform-testsStorage API: Use .any.js (etc) in Web Platform Tests Use ".any.js" tests [1] rather than redundant files for window and worker variations, and increase coverage where window-only tests existed. Also use ".worker.js" and ".window.js" to eliminate some boilerplate. The one manual test is left untouched for ease of running... manually. [1] https://web-platform-tests.org/writing-tests/testharness.html Change-Id: I7be790e0134854c804dbf82072589f07fa6e0bfb Reviewed-on: https://chromium-review.googlesource.com/1194324 Reviewed-by: Chase Phillips <cmp@chromium.org> Commit-Queue: Joshua Bell <jsbell@chromium.org> Cr-Commit-Position: refs/heads/master@{#586773} -- wpt-commits: ba92a402d8f994a92c73b22a153fd7aea89247c3 wpt-pr: 12723
This commit is contained in:
Родитель
67138da985
Коммит
2d0b83d996
|
@ -300854,26 +300854,6 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"storage/resources/storagemanager-persist-worker.js": [
|
||||
[
|
||||
{}
|
||||
]
|
||||
],
|
||||
"storage/resources/storagemanager-persisted-worker.js": [
|
||||
[
|
||||
{}
|
||||
]
|
||||
],
|
||||
"storage/storage-estimate-indexeddb.js": [
|
||||
[
|
||||
{}
|
||||
]
|
||||
],
|
||||
"storage/storage-persisted.js": [
|
||||
[
|
||||
{}
|
||||
]
|
||||
],
|
||||
"streams/META.yml": [
|
||||
[
|
||||
{}
|
||||
|
@ -392190,21 +392170,23 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"storage/estimate-indexeddb-worker.https.html": [
|
||||
"storage/estimate-indexeddb.https.any.js": [
|
||||
[
|
||||
"/storage/estimate-indexeddb-worker.https.html",
|
||||
"/storage/estimate-indexeddb.https.any.html",
|
||||
{}
|
||||
],
|
||||
[
|
||||
"/storage/estimate-indexeddb.https.any.worker.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"storage/estimate-indexeddb.https.html": [
|
||||
"storage/estimate-parallel.https.any.js": [
|
||||
[
|
||||
"/storage/estimate-indexeddb.https.html",
|
||||
"/storage/estimate-parallel.https.any.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"storage/estimate-parallel.https.html": [
|
||||
],
|
||||
[
|
||||
"/storage/estimate-parallel.https.html",
|
||||
"/storage/estimate-parallel.https.any.worker.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
|
@ -392218,51 +392200,51 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"storage/opaque-origin.https.html": [
|
||||
"storage/opaque-origin.https.window.js": [
|
||||
[
|
||||
"/storage/opaque-origin.https.html",
|
||||
"/storage/opaque-origin.https.window.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"storage/persisted-worker.https.html": [
|
||||
"storage/persisted.https.any.js": [
|
||||
[
|
||||
"/storage/persisted-worker.https.html",
|
||||
"/storage/persisted.https.any.html",
|
||||
{}
|
||||
],
|
||||
[
|
||||
"/storage/persisted.https.any.worker.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"storage/persisted.https.html": [
|
||||
"storage/storagemanager-estimate.https.any.js": [
|
||||
[
|
||||
"/storage/persisted.https.html",
|
||||
"/storage/storagemanager-estimate.https.any.html",
|
||||
{}
|
||||
],
|
||||
[
|
||||
"/storage/storagemanager-estimate.https.any.worker.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"storage/storagemanager-estimate.https.html": [
|
||||
"storage/storagemanager-persist.https.window.js": [
|
||||
[
|
||||
"/storage/storagemanager-estimate.https.html",
|
||||
"/storage/storagemanager-persist.https.window.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"storage/storagemanager-persist-worker.https.html": [
|
||||
"storage/storagemanager-persist.https.worker.js": [
|
||||
[
|
||||
"/storage/storagemanager-persist-worker.https.html",
|
||||
"/storage/storagemanager-persist.https.worker.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"storage/storagemanager-persist.https.html": [
|
||||
"storage/storagemanager-persisted.https.any.js": [
|
||||
[
|
||||
"/storage/storagemanager-persist.https.html",
|
||||
"/storage/storagemanager-persisted.https.any.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"storage/storagemanager-persisted-worker.https.html": [
|
||||
],
|
||||
[
|
||||
"/storage/storagemanager-persisted-worker.https.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"storage/storagemanager-persisted.https.html": [
|
||||
[
|
||||
"/storage/storagemanager-persisted.https.html",
|
||||
"/storage/storagemanager-persisted.https.any.worker.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
|
@ -636357,72 +636339,44 @@
|
|||
"d95c3ce8cff5d5f5428ee14c555c556c68f7f2a4",
|
||||
"support"
|
||||
],
|
||||
"storage/estimate-indexeddb-worker.https.html": [
|
||||
"2366760bdbed833b382a1adad350771bf3da7bb7",
|
||||
"storage/estimate-indexeddb.https.any.js": [
|
||||
"3e34ad19babf53da04974ceafe0fd4cb7be33621",
|
||||
"testharness"
|
||||
],
|
||||
"storage/estimate-indexeddb.https.html": [
|
||||
"3f5e1589d346e075e93fb08f5edf1b64d23643ec",
|
||||
"testharness"
|
||||
],
|
||||
"storage/estimate-parallel.https.html": [
|
||||
"571b08cd5e211424035ec4fd7632d07548e4261c",
|
||||
"storage/estimate-parallel.https.any.js": [
|
||||
"090f004b8514bc9c99e8f85f9e8f9073dff2a263",
|
||||
"testharness"
|
||||
],
|
||||
"storage/idlharness.https.any.js": [
|
||||
"0ce4d5a0c8fccf07f6908a7a9ac9ac5ab5df6624",
|
||||
"testharness"
|
||||
],
|
||||
"storage/opaque-origin.https.html": [
|
||||
"563f2fea3c51627d919451cde1664703e4e87fe4",
|
||||
"storage/opaque-origin.https.window.js": [
|
||||
"3e101dde6759b2b8c379d6adc95190742328630f",
|
||||
"testharness"
|
||||
],
|
||||
"storage/persist-permission-manual.https.html": [
|
||||
"aa49900d69562284e35d8d1a4c4d5946586464ac",
|
||||
"manual"
|
||||
],
|
||||
"storage/persisted-worker.https.html": [
|
||||
"21f5c8bd92d849851994267c3d3459237f4bfa5c",
|
||||
"storage/persisted.https.any.js": [
|
||||
"57e15f0e811de3e94652b2f16c5482a94be63c24",
|
||||
"testharness"
|
||||
],
|
||||
"storage/persisted.https.html": [
|
||||
"a5a91ff0b2632d07d9b5ae681f1f9786afa686e6",
|
||||
"storage/storagemanager-estimate.https.any.js": [
|
||||
"d1d2e21924cd016165b02436dea994f44c193cd9",
|
||||
"testharness"
|
||||
],
|
||||
"storage/resources/storagemanager-persist-worker.js": [
|
||||
"1152e4ec7349b5cfccb2cad5d267c910c85632d2",
|
||||
"support"
|
||||
],
|
||||
"storage/resources/storagemanager-persisted-worker.js": [
|
||||
"979c8be3cd39377df9ef4e4a42a8601612a471e3",
|
||||
"support"
|
||||
],
|
||||
"storage/storage-estimate-indexeddb.js": [
|
||||
"5f7895350ef5235099d9d0fd343578b30b47883e",
|
||||
"support"
|
||||
],
|
||||
"storage/storage-persisted.js": [
|
||||
"5bc86fea951973180570434b572604c0fcc2eb22",
|
||||
"support"
|
||||
],
|
||||
"storage/storagemanager-estimate.https.html": [
|
||||
"08a699adfb001a7cfded79f462d2f0261c2f5149",
|
||||
"storage/storagemanager-persist.https.window.js": [
|
||||
"13e17a16e14198e21b0b5984ed46c93a50daed41",
|
||||
"testharness"
|
||||
],
|
||||
"storage/storagemanager-persist-worker.https.html": [
|
||||
"9c89a2f6712575001da0a4758d25ca6716bae3ae",
|
||||
"storage/storagemanager-persist.https.worker.js": [
|
||||
"fcf8175f706fe131c84ed2ac2a022e676d618c40",
|
||||
"testharness"
|
||||
],
|
||||
"storage/storagemanager-persist.https.html": [
|
||||
"61624fe272a610d3454ea2e245cdc6dbf6f59647",
|
||||
"testharness"
|
||||
],
|
||||
"storage/storagemanager-persisted-worker.https.html": [
|
||||
"75004946164d59032228861cb854ae3e470723a0",
|
||||
"testharness"
|
||||
],
|
||||
"storage/storagemanager-persisted.https.html": [
|
||||
"1d88c11bd8aace12223fb94845f1fb270a7b8877",
|
||||
"storage/storagemanager-persisted.https.any.js": [
|
||||
"70999406690fb26b7bc154093d826d7c0b8cf72c",
|
||||
"testharness"
|
||||
],
|
||||
"streams/META.yml": [
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>StorageManager: estimate() for indexeddb from worker</title>
|
||||
<meta name="help" href="https://storage.spec.whatwg.org/#dom-storagemanager-estimate">
|
||||
<meta name="author" title="Mozilla" href="https://www.mozilla.org">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
fetch_tests_from_worker(new Worker("storage-estimate-indexeddb.js"));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,15 +1,13 @@
|
|||
if (this.document === undefined) {
|
||||
importScripts("/resources/testharness.js");
|
||||
}
|
||||
// META: title=StorageManager: estimate() for indexeddb
|
||||
|
||||
test(function(t) {
|
||||
test(t => {
|
||||
assert_true('estimate' in navigator.storage);
|
||||
assert_equals(typeof navigator.storage.estimate, 'function');
|
||||
assert_true(navigator.storage.estimate() instanceof Promise);
|
||||
}, 'estimate() method exists and returns a Promise');
|
||||
|
||||
promise_test(function(t) {
|
||||
return navigator.storage.estimate().then(function(result) {
|
||||
promise_test(t => {
|
||||
return navigator.storage.estimate().then(result => {
|
||||
assert_true(typeof result === 'object');
|
||||
assert_true('usage' in result);
|
||||
assert_equals(typeof result.usage, 'number');
|
||||
|
@ -18,20 +16,20 @@ promise_test(function(t) {
|
|||
});
|
||||
}, 'estimate() resolves to dictionary with members');
|
||||
|
||||
promise_test(function(t) {
|
||||
promise_test(t => {
|
||||
const arraySize = 1e6;
|
||||
const objectStoreName = "storageManager";
|
||||
const dbname = this.window ? window.location.pathname :
|
||||
"estimate-worker.https.html";
|
||||
"estimate-worker.https.html";
|
||||
|
||||
let db;
|
||||
let usageBeforeCreate, usageAfterCreate, usageAfterPut;
|
||||
|
||||
function deleteDB(name) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let deleteRequest = indexedDB.deleteDatabase(name);
|
||||
deleteRequest.onerror = function() { reject(deleteRequest.error); };
|
||||
deleteRequest.onsuccess = function() { resolve(); };
|
||||
deleteRequest.onerror = () => { reject(deleteRequest.error); };
|
||||
deleteRequest.onsuccess = () => { resolve(); };
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -41,13 +39,13 @@ promise_test(function(t) {
|
|||
})
|
||||
.then(estimate => {
|
||||
usageBeforeCreate = estimate.usage;
|
||||
return new Promise(function(resolve, reject) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let openRequest = indexedDB.open(dbname);
|
||||
openRequest.onerror = function() { reject(openRequest.error); };
|
||||
openRequest.onupgradeneeded = function(event) {
|
||||
openRequest.onerror = () => { reject(openRequest.error); };
|
||||
openRequest.onupgradeneeded = event => {
|
||||
openRequest.result.createObjectStore(objectStoreName);
|
||||
};
|
||||
openRequest.onsuccess = function() { resolve(openRequest.result); };
|
||||
openRequest.onsuccess = () => { resolve(openRequest.result); };
|
||||
});
|
||||
})
|
||||
.then(connection => {
|
||||
|
@ -56,8 +54,9 @@ promise_test(function(t) {
|
|||
})
|
||||
.then(estimate => {
|
||||
usageAfterCreate = estimate.usage;
|
||||
assert_greater_than(usageAfterCreate, usageBeforeCreate,
|
||||
'estimated usage should increase after object store is created');
|
||||
assert_greater_than(
|
||||
usageAfterCreate, usageBeforeCreate,
|
||||
'estimated usage should increase after object store is created');
|
||||
|
||||
let txn = db.transaction(objectStoreName, 'readwrite');
|
||||
let buffer = new ArrayBuffer(arraySize);
|
||||
|
@ -70,9 +69,9 @@ promise_test(function(t) {
|
|||
let testBlob = new Blob([buffer], {type: "binary/random"});
|
||||
txn.objectStore(objectStoreName).add(testBlob, 1);
|
||||
|
||||
return new Promise(function(resolve, reject) {
|
||||
txn.onabort = function() { reject(txn.error); };
|
||||
txn.oncomplete = function() { resolve(); };
|
||||
return new Promise((resolve, reject) => {
|
||||
txn.onabort = () => { reject(txn.error); };
|
||||
txn.oncomplete = () => { resolve(); };
|
||||
});
|
||||
})
|
||||
.then(() => {
|
||||
|
@ -80,15 +79,14 @@ promise_test(function(t) {
|
|||
})
|
||||
.then(estimate => {
|
||||
usageAfterPut = estimate.usage;
|
||||
assert_greater_than(usageAfterPut, usageAfterCreate,
|
||||
'estimated usage should increase after large value is stored');
|
||||
assert_greater_than(
|
||||
usageAfterPut, usageAfterCreate,
|
||||
'estimated usage should increase after large value is stored');
|
||||
|
||||
db.close();
|
||||
return deleteDB(dbname)
|
||||
return deleteDB(dbname);
|
||||
})
|
||||
.then(() => {
|
||||
t.done();
|
||||
})
|
||||
});
|
||||
}, 'estimate() shows usage increase after large value is stored');
|
||||
|
||||
done();
|
|
@ -1,14 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>StorageManager: estimate() for indexeddb</title>
|
||||
<meta name="help" href="https://storage.spec.whatwg.org/#dom-storagemanager-estimate">
|
||||
<meta name="author" title="Mozilla" href="https://www.mozilla.org">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script src="storage-estimate-indexeddb.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,10 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>StorageManager: multiple estimate() calls in parallel</title>
|
||||
<meta name="help" href="https://storage.spec.whatwg.org/#dom-storagemanager-estimate">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
// META: title=StorageManager: multiple estimate() calls in parallel
|
||||
|
||||
promise_test(async t => {
|
||||
let r1, r2;
|
||||
await Promise.all([
|
||||
|
@ -16,4 +11,3 @@ promise_test(async t => {
|
|||
assert_true(('usage' in r2) && ('quota' in r2),
|
||||
'second response should have expected fields');
|
||||
}, 'Multiple estimate() calls in parallel should complete');
|
||||
</script>
|
|
@ -1,9 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>StorageManager API and opaque origins</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
// META: title=StorageManager API and opaque origins
|
||||
|
||||
function load_iframe(src, sandbox) {
|
||||
return new Promise(resolve => {
|
||||
|
@ -76,4 +71,3 @@ function make_script(snippet) {
|
|||
});
|
||||
}, `${snippet} in sandboxed iframe should reject with TypeError`);
|
||||
});
|
||||
</script>
|
|
@ -1,16 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>StorageManager: persisted() from worker</title>
|
||||
<meta name="help" href="https://storage.spec.whatwg.org/#dom-storagemanager-persisted">
|
||||
<meta name="author" title="Mozilla" href="https://www.mozilla.org">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
fetch_tests_from_worker(new Worker("storage-persisted.js"));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,6 +1,4 @@
|
|||
if (this.document === undefined) {
|
||||
importScripts("/resources/testharness.js");
|
||||
}
|
||||
// META: title=StorageManager: persisted()
|
||||
|
||||
test(function(t) {
|
||||
assert_true('persisted' in navigator.storage);
|
||||
|
@ -14,5 +12,3 @@ promise_test(function(t) {
|
|||
assert_equals(result, false);
|
||||
});
|
||||
}, 'persisted() returns a promise and resolves as boolean with false');
|
||||
|
||||
done();
|
|
@ -1,14 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>StorageManager: persisted()</title>
|
||||
<meta name="help" href="https://storage.spec.whatwg.org/#dom-storagemanager-persisted">
|
||||
<meta name="author" title="Mozilla" href="https://www.mozilla.org">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script src="storage-persisted.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,13 +0,0 @@
|
|||
importScripts('/resources/testharness.js');
|
||||
|
||||
promise_test(function() {
|
||||
var promise = navigator.storage.persisted();
|
||||
assert_true(promise instanceof Promise,
|
||||
'navigator.storage.persisted() returned a Promise.');
|
||||
return promise.then(function (result) {
|
||||
assert_equals(typeof result, 'boolean',
|
||||
result + ' should be a boolean');
|
||||
});
|
||||
}, 'navigator.storage.persisted returns a promise that resolves.');
|
||||
|
||||
done();
|
|
@ -1,10 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>StorageManager: estimate()</title>
|
||||
<meta name="help" href="https://storage.spec.whatwg.org/#dom-storagemanager-estimate">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
// META: title=StorageManager: estimate()
|
||||
|
||||
test(function(t) {
|
||||
assert_true(navigator.storage.estimate() instanceof Promise);
|
||||
|
@ -64,5 +58,3 @@ promise_test(function(t) {
|
|||
'estimated usage should increase');
|
||||
});
|
||||
}, 'estimate() shows usage increase after 1MB IndexedDB record is stored');
|
||||
|
||||
</script>
|
|
@ -1,10 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>StorageManager: persist() (worker)</title>
|
||||
<meta name="help" href="https://storage.spec.whatwg.org/#dom-storagemanager-persist">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
var worker = new Worker('resources/storagemanager-persist-worker.js');
|
||||
fetch_tests_from_worker(worker);
|
||||
</script>
|
|
@ -1,10 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>StorageManager: persist()</title>
|
||||
<meta name="help" href="https://storage.spec.whatwg.org/#dom-storagemanager-persist">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
// META: title=StorageManager: persist()
|
||||
|
||||
promise_test(function() {
|
||||
var promise = navigator.storage.persist();
|
||||
|
@ -14,5 +8,3 @@ promise_test(function() {
|
|||
assert_equals(typeof result, 'boolean', result + ' should be boolean');
|
||||
});
|
||||
}, 'navigator.storage.persist() returns a promise that resolves.');
|
||||
|
||||
</script>
|
|
@ -1,4 +1,5 @@
|
|||
importScripts('/resources/testharness.js');
|
||||
// META: title=StorageManager: persist() (worker)
|
||||
importScripts("/resources/testharness.js");
|
||||
|
||||
test(function() {
|
||||
assert_false('persist' in navigator.storage);
|
|
@ -1,10 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>StorageManager: persisted() (worker)</title>
|
||||
<meta name="help" href="https://storage.spec.whatwg.org/#dom-storagemanager-persisted">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
var worker = new Worker('resources/storagemanager-persisted-worker.js');
|
||||
fetch_tests_from_worker(worker);
|
||||
</script>
|
|
@ -1,10 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>StorageManager: persist()</title>
|
||||
<meta name="help" href="https://storage.spec.whatwg.org/#dom-storagemanager-persist">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
// META: title=StorageManager: persisted()
|
||||
|
||||
promise_test(function() {
|
||||
var promise = navigator.storage.persisted();
|
||||
|
@ -14,5 +8,3 @@ promise_test(function() {
|
|||
assert_equals(typeof result, 'boolean', result + ' should be boolean');
|
||||
});
|
||||
}, 'navigator.storage.persisted() returns a promise that resolves.');
|
||||
|
||||
</script>
|
Загрузка…
Ссылка в новой задаче