browser/devtools/debugger/test/browser_dbg_addon-sources.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/debugger/test/browser_dbg_addon-sources.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,35 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +// Ensure that the sources listed when debugging an addon are either from the 
     1.8 +// addon itself, or the SDK, with proper groups and labels.
     1.9 +
    1.10 +const ADDON_URL = EXAMPLE_URL + "addon3.xpi";
    1.11 +
    1.12 +function test() {
    1.13 +  Task.spawn(function () {
    1.14 +    let addon = yield addAddon(ADDON_URL);
    1.15 +    let addonDebugger = yield initAddonDebugger(ADDON_URL);
    1.16 +
    1.17 +    is(addonDebugger.title, "Debugger - browser_dbg_addon3", "Saw the right toolbox title.");
    1.18 +
    1.19 +    // Check the inital list of sources is correct
    1.20 +    let groups = yield addonDebugger.getSourceGroups();
    1.21 +    is(groups[0].name, "jid1-ami3akps3baaeg@jetpack", "Add-on code should be the first group");
    1.22 +    is(groups[1].name, "Add-on SDK", "Add-on SDK should be the second group");
    1.23 +    is(groups.length, 2, "Should be only two groups.");
    1.24 +
    1.25 +    let sources = groups[0].sources;
    1.26 +    is(sources.length, 2, "Should be two sources");
    1.27 +    ok(sources[0].url.endsWith("/jid1-ami3akps3baaeg@jetpack.xpi!/bootstrap.js"), "correct url for bootstrap code")
    1.28 +    is(sources[0].label, "bootstrap.js", "correct label for bootstrap code")
    1.29 +    is(sources[1].url, "resource://jid1-ami3akps3baaeg-at-jetpack/browser_dbg_addon3/lib/main.js", "correct url for add-on code")
    1.30 +    is(sources[1].label, "resources/browser_dbg_addon3/lib/main.js", "correct label for add-on code")
    1.31 +
    1.32 +    ok(groups[1].sources.length > 10, "SDK modules are listed");
    1.33 +
    1.34 +    yield addonDebugger.destroy();
    1.35 +    yield removeAddon(addon);
    1.36 +    finish();
    1.37 +  });
    1.38 +}

mercurial