fune/toolkit/components/extensions/test/xpcshell/test_ext_geckoProfiler_schema.js
Philipp Kewisch 52aa5b978e Bug 1507709 - Move WebExtensions geckoProfiler API to toolkit. r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D12100

--HG--
rename : browser/components/extensions/ProfilerGetSymbols-worker.js => toolkit/components/extensions/ProfilerGetSymbols-worker.js
rename : browser/components/extensions/ProfilerGetSymbols.jsm => toolkit/components/extensions/ProfilerGetSymbols.jsm
rename : browser/components/extensions/parent/ext-geckoProfiler.js => toolkit/components/extensions/parent/ext-geckoProfiler.js
rename : browser/components/extensions/profiler_get_symbols.js => toolkit/components/extensions/profiler_get_symbols.js
rename : browser/components/extensions/schemas/geckoProfiler.json => toolkit/components/extensions/schemas/geckoProfiler.json
rename : browser/components/extensions/test/xpcshell/test_ext_geckoProfiler_control.js => toolkit/components/extensions/test/xpcshell/test_ext_geckoProfiler_control.js
rename : browser/components/extensions/test/xpcshell/test_ext_geckoProfiler_schema.js => toolkit/components/extensions/test/xpcshell/test_ext_geckoProfiler_schema.js
extra : moz-landing-system : lando
2019-03-22 13:18:01 +00:00

43 lines
1.5 KiB
JavaScript

"use strict";
add_task(async function() {
const acceptedExtensionIdsPref = "extensions.geckoProfiler.acceptedExtensionIds";
Services.prefs.setCharPref(acceptedExtensionIdsPref, "profilertest@mozilla.com");
let extension = ExtensionTestUtils.loadExtension({
background: () => {
browser.test.sendMessage(
"features",
Object.values(browser.geckoProfiler.ProfilerFeature));
},
manifest: {
"permissions": ["geckoProfiler"],
"applications": {
"gecko": {
"id": "profilertest@mozilla.com",
},
},
},
});
await extension.startup();
let acceptedFeatures = await extension.awaitMessage("features");
await extension.unload();
Services.prefs.clearUserPref(acceptedExtensionIdsPref);
const allFeaturesAcceptedByProfiler = Services.profiler.GetAllFeatures([]);
ok(allFeaturesAcceptedByProfiler.length >= 2,
"Either we've massively reduced the profiler's feature set, or something is wrong.");
// Check that the list of available values in the ProfilerFeature enum
// matches the list of features supported by the profiler.
for (const feature of allFeaturesAcceptedByProfiler) {
ok(acceptedFeatures.includes(feature),
`The schema of the geckoProfiler.start() method should accept the "${feature}" feature.`);
}
for (const feature of acceptedFeatures) {
ok(allFeaturesAcceptedByProfiler.includes(feature),
`The schema of the geckoProfiler.start() method mentions a "${feature}" feature which is not supported by the profiler.`);
}
});