summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/extensions/test/xpcshell/test_migrateAddonRepository.js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2018-06-26 16:09:08 -0400
committerMatt A. Tobin <email@mattatobin.com>2018-06-26 16:09:08 -0400
commiteda567b364a06e9e63efb865a6b1c73f1cb5232e (patch)
tree912ab15d877f733318e2c0394713bca33b830547 /toolkit/mozapps/extensions/test/xpcshell/test_migrateAddonRepository.js
parent80eb356d57fc310cdf812cae63de30d6e56c1788 (diff)
downloadUXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.tar
UXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.tar.gz
UXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.tar.lz
UXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.tar.xz
UXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.zip
[AllAM] Remove Mozilla Tests
Diffstat (limited to 'toolkit/mozapps/extensions/test/xpcshell/test_migrateAddonRepository.js')
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_migrateAddonRepository.js127
1 files changed, 0 insertions, 127 deletions
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_migrateAddonRepository.js b/toolkit/mozapps/extensions/test/xpcshell/test_migrateAddonRepository.js
deleted file mode 100644
index ad8bd5bca..000000000
--- a/toolkit/mozapps/extensions/test/xpcshell/test_migrateAddonRepository.js
+++ /dev/null
@@ -1,127 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-const EXPECTED_SCHEMA_VERSION = 4;
-let dbfile;
-
-function run_test() {
- do_test_pending();
- createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
-
- // Write out a minimal database.
- dbfile = gProfD.clone();
- dbfile.append("addons.sqlite");
- let db = AM_Cc["@mozilla.org/storage/service;1"].
- getService(AM_Ci.mozIStorageService).
- openDatabase(dbfile);
-
- db.createTable("addon",
- "internal_id INTEGER PRIMARY KEY AUTOINCREMENT, " +
- "id TEXT UNIQUE, " +
- "type TEXT, " +
- "name TEXT, " +
- "version TEXT, " +
- "creator TEXT, " +
- "creatorURL TEXT, " +
- "description TEXT, " +
- "fullDescription TEXT, " +
- "developerComments TEXT, " +
- "eula TEXT, " +
- "iconURL TEXT, " +
- "homepageURL TEXT, " +
- "supportURL TEXT, " +
- "contributionURL TEXT, " +
- "contributionAmount TEXT, " +
- "averageRating INTEGER, " +
- "reviewCount INTEGER, " +
- "reviewURL TEXT, " +
- "totalDownloads INTEGER, " +
- "weeklyDownloads INTEGER, " +
- "dailyUsers INTEGER, " +
- "sourceURI TEXT, " +
- "repositoryStatus INTEGER, " +
- "size INTEGER, " +
- "updateDate INTEGER");
-
- db.createTable("developer",
- "addon_internal_id INTEGER, " +
- "num INTEGER, " +
- "name TEXT, " +
- "url TEXT, " +
- "PRIMARY KEY (addon_internal_id, num)");
-
- db.createTable("screenshot",
- "addon_internal_id INTEGER, " +
- "num INTEGER, " +
- "url TEXT, " +
- "thumbnailURL TEXT, " +
- "caption TEXT, " +
- "PRIMARY KEY (addon_internal_id, num)");
-
- let stmt = db.createStatement("INSERT INTO addon (id) VALUES (:id)");
- stmt.params.id = "test1@tests.mozilla.org";
- stmt.execute();
- stmt.finalize();
-
- stmt = db.createStatement("INSERT INTO screenshot VALUES " +
- "(:addon_internal_id, :num, :url, :thumbnailURL, :caption)");
-
- stmt.params.addon_internal_id = 1;
- stmt.params.num = 0;
- stmt.params.url = "http://localhost/full1-1.png";
- stmt.params.thumbnailURL = "http://localhost/thumbnail1-1.png";
- stmt.params.caption = "Caption 1 - 1";
- stmt.execute();
- stmt.finalize();
-
- db.schemaVersion = 1;
- db.close();
-
-
- Services.prefs.setBoolPref("extensions.getAddons.cache.enabled", true);
- AddonRepository.getCachedAddonByID("test1@tests.mozilla.org", function (aAddon) {
- do_check_neq(aAddon, null);
- do_check_eq(aAddon.screenshots.length, 1);
- do_check_true(aAddon.screenshots[0].width === null);
- do_check_true(aAddon.screenshots[0].height === null);
- do_check_true(aAddon.screenshots[0].thumbnailWidth === null);
- do_check_true(aAddon.screenshots[0].thumbnailHeight === null);
- do_check_eq(aAddon.iconURL, undefined);
- do_check_eq(JSON.stringify(aAddon.icons), "{}");
- AddonRepository.shutdown().then(
- function checkAfterRepoShutdown() {
- // Check the DB schema has changed once AddonRepository has freed it.
- db = AM_Cc["@mozilla.org/storage/service;1"].
- getService(AM_Ci.mozIStorageService).
- openDatabase(dbfile);
- do_check_eq(db.schemaVersion, EXPECTED_SCHEMA_VERSION);
- do_check_true(db.indexExists("developer_idx"));
- do_check_true(db.indexExists("screenshot_idx"));
- do_check_true(db.indexExists("compatibility_override_idx"));
- do_check_true(db.tableExists("compatibility_override"));
- do_check_true(db.indexExists("icon_idx"));
- do_check_true(db.tableExists("icon"));
-
- // Check the trigger is working
- db.executeSimpleSQL("INSERT INTO addon (id, type, name) VALUES('test_addon', 'extension', 'Test Addon')");
- let internalID = db.lastInsertRowID;
- db.executeSimpleSQL("INSERT INTO compatibility_override (addon_internal_id, num, type) VALUES('" + internalID + "', '1', 'incompatible')");
-
- let stmt = db.createStatement("SELECT COUNT(*) AS count FROM compatibility_override");
- stmt.executeStep();
- do_check_eq(stmt.row.count, 1);
- stmt.reset();
-
- db.executeSimpleSQL("DELETE FROM addon");
- stmt.executeStep();
- do_check_eq(stmt.row.count, 0);
- stmt.finalize();
-
- db.close();
- do_test_finished();
- },
- do_report_unexpected_exception
- );
- });
-}