Bug 1608025 - Clean up the test for the upgrade from flat origin directories; r=asuth

Differential Revision: https://phabricator.services.mozilla.com/D59664

--HG--
rename : dom/quota/test/unit/upgrades/idbSubdirUpgrade1_profile.zip => dom/quota/test/unit/upgrades/indexedDBDirectory_flatOriginDirectories_profile.zip
rename : dom/quota/test/unit/upgrades/idbSubdirUpgrade2_profile.zip => dom/quota/test/unit/upgrades/persistentStorageDirectory_flatOriginDirectories_profile.zip
rename : dom/quota/test/unit/upgrades/test_idbSubdirUpgrade.js => dom/quota/test/unit/upgrades/test_upgradeFromFlatOriginDirectories.js
extra : moz-landing-system : lando
This commit is contained in:
Jan Varga 2020-01-14 02:49:43 +00:00
Родитель e575c0d8c6
Коммит f8f9157438
4 изменённых файлов: 56 добавлений и 38 удалений

Просмотреть файл

@ -3,58 +3,76 @@
* http://creativecommons.org/publicdomain/zero/1.0/ * http://creativecommons.org/publicdomain/zero/1.0/
*/ */
// A flat origin directory is an origin directory with no sub directories for
// quota clients. The upgrade was initially done lazily and an empty .metadata
// file was used to indicate a successful upgrade.
var testGenerator = testSteps(); var testGenerator = testSteps();
function* testSteps() { function* testSteps() {
const origins = [ const setups = [
[ {
{ // Storage used prior FF 22 (indexedDB/ directory with flat origin
oldPath: "indexedDB/1007+f+app+++system.gaiamobile.org", // directories).
}, // FF 26 renamed indexedDB/ to storage/persistent and the lazy upgrade
// of flat origin directories remained. There's a test for that below.
package: "indexedDBDirectory_flatOriginDirectories_profile",
origins: [
{
oldPath: "indexedDB/1007+f+app+++system.gaiamobile.org",
},
{ {
oldPath: "indexedDB/1007+t+https+++developer.cdn.mozilla.net", oldPath: "indexedDB/1007+t+https+++developer.cdn.mozilla.net",
}, },
{ {
oldPath: "indexedDB/http+++www.mozilla.org", oldPath: "indexedDB/http+++www.mozilla.org",
newPath: "storage/default/http+++www.mozilla.org", newPath: "storage/default/http+++www.mozilla.org",
url: "http://www.mozilla.org", url: "http://www.mozilla.org",
persistence: "default", persistence: "default",
}, },
], ],
},
[ {
{ // Storage used by FF 26-35 (storage/persistent/ directory with not yet
oldPath: "storage/persistent/1007+f+app+++system.gaiamobile.org", // upgraded flat origin directories).
}, // FF 36 renamed storage/persistent/ to storage/default/ and all not yet
// upgraded flat origin directories were upgraded. There's a separate
// test for that.
package: "persistentStorageDirectory_flatOriginDirectories_profile",
origins: [
{
oldPath: "storage/persistent/1007+f+app+++system.gaiamobile.org",
},
{ {
oldPath: "storage/persistent/1007+t+https+++developer.cdn.mozilla.net", oldPath:
}, "storage/persistent/1007+t+https+++developer.cdn.mozilla.net",
},
{ {
oldPath: "storage/persistent/http+++www.mozilla.org", oldPath: "storage/persistent/http+++www.mozilla.org",
newPath: "storage/default/http+++www.mozilla.org", newPath: "storage/default/http+++www.mozilla.org",
url: "http://www.mozilla.org", url: "http://www.mozilla.org",
persistence: "default", persistence: "default",
}, },
], ],
},
]; ];
const metadataFileName = ".metadata"; const metadataFileName = ".metadata";
// Test upgrade from FF 21 (no idb subdirs). for (const setup of setups) {
for (let i = 1; i <= 2; i++) {
clear(continueToNextStepSync); clear(continueToNextStepSync);
yield undefined; yield undefined;
installPackage("idbSubdirUpgrade" + i + "_profile"); installPackage(setup.package);
info("Checking origin directories"); info("Checking origin directories");
for (let origin of origins[i - 1]) { for (const origin of setup.origins) {
let originDir = getRelativeFile(origin.oldPath); let originDir = getRelativeFile(origin.oldPath);
let exists = originDir.exists(); let exists = originDir.exists();
ok(exists, "Origin directory does exist"); ok(exists, "Origin directory does exist");
@ -87,7 +105,7 @@ function* testSteps() {
info("Checking origin directories"); info("Checking origin directories");
for (let origin of origins[i - 1]) { for (const origin of setup.origins) {
let originDir = getRelativeFile(origin.oldPath); let originDir = getRelativeFile(origin.oldPath);
let exists = originDir.exists(); let exists = originDir.exists();
ok(!exists, "Origin directory doesn't exist"); ok(!exists, "Origin directory doesn't exist");

Просмотреть файл

@ -6,20 +6,19 @@
head = head.js head = head.js
support-files = support-files =
defaultStorageUpgrade_profile.zip defaultStorageUpgrade_profile.zip
idbSubdirUpgrade1_profile.zip indexedDBDirectory_flatOriginDirectories_profile.zip
idbSubdirUpgrade2_profile.zip
localStorageArchive1upgrade_profile.zip localStorageArchive1upgrade_profile.zip
localStorageArchive4upgrade_profile.zip localStorageArchive4upgrade_profile.zip
localStorageArchiveDowngrade_profile.zip localStorageArchiveDowngrade_profile.zip
morgueCleanup_profile.zip morgueCleanup_profile.zip
obsoleteOriginAttributes_profile.zip obsoleteOriginAttributes_profile.zip
originAttributesUpgrade_profile.zip originAttributesUpgrade_profile.zip
persistentStorageDirectory_flatOriginDirectories_profile.zip
storagePersistentUpgrade_profile.zip storagePersistentUpgrade_profile.zip
version2_1upgrade_profile.zip version2_1upgrade_profile.zip
version2_2upgrade_profile.zip version2_2upgrade_profile.zip
[test_defaultStorageUpgrade.js] [test_defaultStorageUpgrade.js]
[test_idbSubdirUpgrade.js]
[test_localStorageArchive1upgrade.js] [test_localStorageArchive1upgrade.js]
[test_localStorageArchive4upgrade.js] [test_localStorageArchive4upgrade.js]
[test_localStorageArchiveDowngrade.js] [test_localStorageArchiveDowngrade.js]
@ -28,4 +27,5 @@ support-files =
[test_obsoleteOrigins.js] [test_obsoleteOrigins.js]
[test_originAttributesUpgrade.js] [test_originAttributesUpgrade.js]
[test_storagePersistentUpgrade.js] [test_storagePersistentUpgrade.js]
[test_upgradeFromFlatOriginDirectories.js]
[test_version2_1upgrade.js] [test_version2_1upgrade.js]