3 dummyid:
"fuel-dummy-extension@mozilla.org",
4 dummyname:
"Dummy Extension",
5 inspectorid:
"inspector@mozilla.org",
6 inspectorname:
"DOM Inspector",
7 missing:
"fuel.fuel-test-missing",
8 dummy:
"fuel.fuel-test"
14 ok(
Application.extensions,
"Check for the 'Extensions' object");
17 ok(!
Application.extensions.has(
testdata.dummyid),
"Check non-existant extension for existance");
26 is(inspector.id,
testdata.inspectorid,
"Check 'Extension.id' for known extension");
27 is(inspector.name,
testdata.inspectorname,
"Check 'Extension.name' for known extension");
29 ok(inspector.version,
"Check 'Extension.version' for known extension");
30 ok(inspector.firstRun,
"Check 'Extension.firstRun' for known extension");
31 ok(inspector.enabled,
"Check 'Extension.enabled' for known extension");
34 is(
Application.extensions.all.length, 1,
"Check a find for all extensions");
37 inspector.storage.set(
"test",
"simple check");
38 ok(inspector.storage.has(
"test"),
"Checking that extension storage worked");
41 is(inspector2.id,
testdata.inspectorid,
"Check 'Extension.id' for known extension - from cache");
42 ok(inspector.storage.has(
"test"),
"Checking that extension storage worked - from cache");
43 is(inspector2.storage.get(
"test",
"cache"), inspector.storage.get(
"test",
"original"),
"Checking that the storage of same extension is correct - from cache");
50 var extmgr = Components.classes[
"@mozilla.org/extensions/manager;1"]
51 .getService(Components.interfaces.nsIExtensionManager);
53 extmgr.disableItem(
testdata.inspectorid);
54 is(
gLastEvent,
"disable",
"Checking that disable event is fired");
58 extmgr.enableItem(
testdata.inspectorid);
59 is(
gLastEvent,
"cancel",
"Checking that enable (cancel) event is fired");
61 extmgr.uninstallItem(
testdata.inspectorid);
62 is(
gLastEvent,
"uninstall",
"Checking that uninstall event is fired");
64 extmgr.cancelUninstallItem(
testdata.inspectorid);
65 is(
gLastEvent,
"cancel",
"Checking that cancel event is fired");
69 inspector.prefs.get(
"install-event-fired").reset();
72 is(
Application.extensions.all[0].prefs.root,
"extensions.inspector@mozilla.org.",
"Check an extension preference root");
75 var itemValue = inspector.prefs.getValue(
testdata.missing,
"default");
76 is(itemValue,
"default",
"Check 'Extension.prefs.getValue' for non-existing item");
78 is(inspector.prefs.get(
testdata.missing),
null,
"Check 'Extension.prefs.get' for non-existing item");
81 inspector.prefs.setValue(
testdata.dummy,
"dummy");
82 itemValue = inspector.prefs.getValue(
testdata.dummy,
"default");
83 is(itemValue,
"dummy",
"Check 'Extension.prefs.getValue' for existing item");
86 inspector.prefs.setValue(
testdata.dummy,
"smarty");
87 itemValue = inspector.prefs.getValue(
testdata.dummy,
"default");
88 is(itemValue,
"smarty",
"Check 'Extension.prefs.getValue' for overwritten item");
91 inspector.prefs.get(
testdata.dummy).value =
"dummy2";
92 itemValue = inspector.prefs.get(
testdata.dummy).value;
93 is(itemValue,
"dummy2",
"Check 'Extension.prefs.get().value' for existing item");
96 inspector.prefs.get(
testdata.dummy).reset();
97 var itemValue = inspector.prefs.getValue(
testdata.dummy,
"default");
98 is(itemValue,
"default",
"Check 'Extension.prefs.getValue' for reset pref");
101 ok(!inspector.prefs.has(
testdata.dummy),
"Check non-existant property for existance");
104 inspector.prefs.events.addListener(
"change",
onPrefChange);
105 inspector.prefs.setValue(
"fuel.fuel-test",
"change event");
115 is(evt.data,
testdata.dummy,
"Check 'Extension.prefs.set' fired a change event");
116 inspector3.prefs.events.removeListener(
"change",
onPrefChange);
118 inspector3.prefs.get(
"fuel.fuel-test").events.addListener(
"change",
onPrefChange2);
119 inspector3.prefs.setValue(
"fuel.fuel-test",
"change event2");
123 is(evt.data,
testdata.dummy,
"Check 'Extension.prefs.set' fired a change event for a single preference");
function onPrefChange2(evt)
function onGenericEvent(event)
function onPrefChange(evt)