blob: e101d9d505df0e0f8e36d4d5512a846b0a2006fc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable no-shadow */
"use strict";
async function connect() {
DevToolsServer.init();
DevToolsServer.registerAllActors();
const client = new DevToolsClient(DevToolsServer.connectPipe());
await client.connect();
const addons = await client.mainRoot.getFront("addons");
return [client, addons];
}
// The AddonsManager test helper can only be called once per test script.
// This `setup` task will run first.
add_task(async function setup() {
await startupAddonsManager();
});
add_task(async function testSuccessfulInstall() {
const [client, addons] = await connect();
const allowMissing = false;
const usePlatformSeparator = true;
const addonPath = getFilePath(
"addons/web-extension",
allowMissing,
usePlatformSeparator
);
const installedAddon = await addons.installTemporaryAddon(addonPath);
equal(installedAddon.id, "test-addons-actor@mozilla.org");
// The returned object is currently not a proper actor.
equal(installedAddon.actor, false);
const addonList = await client.mainRoot.listAddons();
ok(addonList && addonList.map(a => a.name), "Received list of add-ons");
const addon = addonList.find(a => a.id === installedAddon.id);
ok(addon, "Test add-on appeared in root install list");
await close(client);
});
add_task(async function testNonExistantPath() {
const [client, addons] = await connect();
await Assert.rejects(
addons.installTemporaryAddon("some-non-existant-path"),
/Could not install add-on.*Component returned failure/
);
await close(client);
});
|