Bug 1181852 - Use shared-head.js for devtools/client/shared;r=jryans

This commit is contained in:
Brian Grinstead 2015-11-10 11:48:51 -08:00
parent adf3bd6632
commit e6960dd6a2
95 changed files with 160 additions and 221 deletions

View File

@ -6,7 +6,7 @@ var {colorUtils} = require("devtools/shared/css-color");
var origColorUnit;
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
let [host, win, doc] = yield createHost("bottom", TEST_URI);
info("Creating a test canvas element to test colors");

View File

@ -11,7 +11,7 @@ const {CubicBezierWidget} =
require("devtools/client/shared/widgets/CubicBezierWidget");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
let [host, win, doc] = yield createHost("bottom", TEST_URI);
info("Checking that the graph markup is created in the parent");

View File

@ -12,7 +12,7 @@ const {CubicBezierWidget} =
const {PREDEFINED} = require("devtools/client/shared/widgets/CubicBezierPresets");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
let [host, win, doc] = yield createHost("bottom", TEST_URI);
// Required or widget will be clipped inside of 'bottom'

View File

@ -12,7 +12,7 @@ const {CubicBezierWidget} =
const {PREDEFINED} = require("devtools/client/shared/widgets/CubicBezierPresets");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
let [host, win, doc] = yield createHost("bottom", TEST_URI);
let container = doc.querySelector("#container");

View File

@ -12,7 +12,7 @@ const {CubicBezierPresetWidget} =
const {PRESETS} = require("devtools/client/shared/widgets/CubicBezierPresets");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
let [host, win, doc] = yield createHost("bottom", TEST_URI);
let container = doc.querySelector("#container");

View File

@ -13,7 +13,7 @@ const {PREDEFINED, PRESETS, DEFAULT_PRESET_CATEGORY} =
require("devtools/client/shared/widgets/CubicBezierPresets");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
let [host, win, doc] = yield createHost("bottom", TEST_URI);
let container = doc.querySelector("#container");

View File

@ -13,7 +13,7 @@ const {CubicBezierWidget} =
const {PRESETS} = require("devtools/client/shared/widgets/CubicBezierPresets");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
let [host, win, doc] = yield createHost("bottom", TEST_URI);
let container = doc.querySelector("#container");

View File

@ -9,7 +9,7 @@ const TEST_URI = "chrome://devtools/content/shared/widgets/filter-frame.xhtml";
const {CSSFilterEditorWidget} = require("devtools/client/shared/widgets/FilterWidget");
add_task(function *() {
yield promiseTab("about:blank");
yield addTab("about:blank");
let [host, win, doc] = yield createHost("bottom", TEST_URI);
const container = doc.querySelector("#container");

View File

@ -13,7 +13,7 @@ const STRINGS_URI = "chrome://devtools/locale/filterwidget.properties";
const L10N = new ViewHelpers.L10N(STRINGS_URI);
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
let [host, win, doc] = yield createHost("bottom", TEST_URI);
const TEST_DATA = [

View File

@ -12,7 +12,7 @@ const GRAYSCALE_MAX = 100;
const INVERT_MIN = 0;
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
let [host, win, doc] = yield createHost("bottom", TEST_URI);
const container = doc.querySelector("#container");

View File

@ -10,7 +10,7 @@ const {CSSFilterEditorWidget} = require("devtools/client/shared/widgets/FilterWi
const LIST_ITEM_HEIGHT = 32;
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
let [host, win, doc] = yield createHost("bottom", TEST_URI);
const container = doc.querySelector("#container");

View File

@ -16,7 +16,7 @@ const GRAYSCALE_MAX = 100,
GRAYSCALE_MIN = 0;
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
let [host, win, doc] = yield createHost("bottom", TEST_URI);
const container = doc.querySelector("#container");

View File

@ -7,7 +7,6 @@
const TEST_URI = "chrome://devtools/content/shared/widgets/filter-frame.xhtml";
const { Cu } = require("chrome");
const {CSSFilterEditorWidget} = require("devtools/client/shared/widgets/FilterWidget");
const { ViewHelpers } = Cu.import("resource://devtools/client/shared/widgets/ViewHelpers.jsm", {});
@ -15,7 +14,7 @@ const STRINGS_URI = "chrome://devtools/locale/filterwidget.properties";
const L10N = new ViewHelpers.L10N(STRINGS_URI);
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
let [host, win, doc] = yield createHost("bottom", TEST_URI);
const container = doc.querySelector("#container");

View File

@ -7,7 +7,6 @@
const TEST_URI = "chrome://devtools/content/shared/widgets/filter-frame.xhtml";
const { Cu } = require("chrome");
const {CSSFilterEditorWidget} = require("devtools/client/shared/widgets/FilterWidget");
const { ViewHelpers } = Cu.import("resource://devtools/client/shared/widgets/ViewHelpers.jsm", {});
@ -15,7 +14,7 @@ const STRINGS_URI = "chrome://devtools/locale/filterwidget.properties";
const L10N = new ViewHelpers.L10N(STRINGS_URI);
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
let [host, win, doc] = yield createHost("bottom", TEST_URI);
const container = doc.querySelector("#container");

View File

@ -14,7 +14,7 @@ const SLOW_VALUE_MULTIPLIER = 0.1;
const DEFAULT_VALUE_MULTIPLIER = 1;
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
let [host, win, doc] = yield createHost("bottom", TEST_URI);
const container = doc.querySelector("#container");

View File

@ -14,7 +14,7 @@ const SLOW_VALUE_MULTIPLIER = 0.1;
const DEFAULT_VALUE_MULTIPLIER = 1;
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
let [host, win, doc] = yield createHost("bottom", TEST_URI);
const container = doc.querySelector("#container");

View File

@ -14,7 +14,7 @@ const SLOW_VALUE_MULTIPLIER = 0.1;
const DEFAULT_VALUE_MULTIPLIER = 1;
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
let [host, win, doc] = yield createHost("bottom", TEST_URI);
const container = doc.querySelector("#container");

View File

@ -9,7 +9,7 @@ const TEST_URI = "chrome://devtools/content/shared/widgets/filter-frame.xhtml";
const {CSSFilterEditorWidget} = require("devtools/client/shared/widgets/FilterWidget");
add_task(function* () {
yield promiseTab("about:blank");
yield addTab("about:blank");
let [host, win, doc] = yield createHost("bottom", TEST_URI);

View File

@ -9,7 +9,7 @@ const TEST_URI = "chrome://devtools/content/shared/widgets/filter-frame.xhtml";
const {CSSFilterEditorWidget} = require("devtools/client/shared/widgets/FilterWidget");
add_task(function* () {
yield promiseTab("about:blank");
yield addTab("about:blank");
let [host, win, doc] = yield createHost("bottom", TEST_URI);

View File

@ -9,7 +9,7 @@ const TEST_URI = "chrome://devtools/content/shared/widgets/filter-frame.xhtml";
const {CSSFilterEditorWidget} = require("devtools/client/shared/widgets/FilterWidget");
add_task(function* () {
yield promiseTab("about:blank");
yield addTab("about:blank");
let [host, win, doc] = yield createHost("bottom", TEST_URI);

View File

@ -6,7 +6,7 @@
var {FlameGraph} = require("devtools/client/shared/widgets/FlameGraph");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -6,7 +6,7 @@
var {FlameGraph} = require("devtools/client/shared/widgets/FlameGraph");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -11,7 +11,7 @@ var TEST_HEIGHT = 100;
var {FlameGraph} = require("devtools/client/shared/widgets/FlameGraph");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -12,7 +12,7 @@ var TEST_DPI_DENSITIY = 2;
var {FlameGraph} = require("devtools/client/shared/widgets/FlameGraph");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -12,7 +12,7 @@ var TEST_DPI_DENSITIY = 2;
var {FlameGraph} = require("devtools/client/shared/widgets/FlameGraph");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -12,7 +12,7 @@ var {FLAME_GRAPH_BLOCK_TEXT_FONT_FAMILY} = require("devtools/client/shared/widge
var L10N = new ViewHelpers.L10N();
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -8,7 +8,7 @@ var {FlameGraphUtils} = require("devtools/client/shared/widgets/FlameGraph");
var {PALLETTE_SIZE} = require("devtools/client/shared/widgets/FlameGraph");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -7,7 +7,7 @@ var {FlameGraphUtils} = require("devtools/client/shared/widgets/FlameGraph");
var {PALLETTE_SIZE} = require("devtools/client/shared/widgets/FlameGraph");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -8,7 +8,7 @@ var {PALLETTE_SIZE} = require("devtools/client/shared/widgets/FlameGraph");
var {FrameNode} = require("devtools/client/performance/modules/logic/tree-model");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -8,7 +8,7 @@ var {PALLETTE_SIZE} = require("devtools/client/shared/widgets/FlameGraph");
var {FrameNode} = require("devtools/client/performance/modules/logic/tree-model");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -6,7 +6,7 @@
var {FlameGraphUtils} = require("devtools/client/shared/widgets/FlameGraph");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -8,7 +8,7 @@ var {FlameGraphUtils} = require("devtools/client/shared/widgets/FlameGraph");
var {PALLETTE_SIZE} = require("devtools/client/shared/widgets/FlameGraph");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -6,7 +6,7 @@
var LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
finish();

View File

@ -8,7 +8,7 @@ const TEST_REGIONS = [{ start: 320, end: 460 }, { start: 780, end: 860 }];
var LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -7,7 +7,7 @@
var LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -6,7 +6,7 @@
var LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -8,7 +8,7 @@ const TEST_REGIONS = [{ start: 320, end: 460 }, { start: 780, end: 860 }];
var LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -8,7 +8,7 @@ const TEST_REGIONS = [{ start: 320, end: 460 }, { start: 780, end: 860 }];
var LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -7,7 +7,7 @@ const TEST_DATA = [{ delta: 112, value: 48 }, { delta: 213, value: 59 }, { delta
var LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -7,7 +7,7 @@ const TEST_DATA = [{ delta: 112, value: 48 }, { delta: 213, value: 59 }, { delta
var LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -9,7 +9,7 @@ const TEST_DATA = [{ delta: 112, value: 48 }, { delta: 213, value: 59 }, { delta
var LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -8,7 +8,7 @@ const TEST_REGIONS = [{ start: 320, end: 460 }, { start: 780, end: 860 }];
var LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -8,7 +8,7 @@ var LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget");
var CURRENT_ZOOM = 1;
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -7,7 +7,7 @@ const TEST_DATA = [{ delta: 112, value: 48 }, { delta: 213, value: 59 }, { delta
var LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -7,7 +7,7 @@ const TEST_DATA = [{ delta: 112, value: 48 }, { delta: 213, value: 59 }, { delta
var LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -7,7 +7,7 @@ const TEST_DATA = [{ delta: 112, value: 48 }, { delta: 213, value: 59 }, { delta
var LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -7,7 +7,7 @@ const TEST_DATA = [];
var LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -8,7 +8,7 @@ const TEST_DATA = [{ delta: 100, value: 60 }, { delta: 200, value: 59.9 }];
var LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -10,7 +10,7 @@ const TEST_DATA = [{ delta: 112, value: 48 }, { delta: 213, value: 59 }, { delta
var LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -8,7 +8,7 @@ const TEST_DATA = [{ delta: 100, value: 60 }, { delta: 200, value: 1 }];
var LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -7,7 +7,7 @@ const TEST_DATA = [{ delta: 112, value: 48 }, { delta: 213, value: 59 }, { delta
var LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -8,7 +8,7 @@ const TEST_DATA = [{ delta: 112, value: 48 }, { delta: 213, value: 59 }, { delta
var LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -5,7 +5,7 @@ const TEST_DATA = [{ delta: 112, value: 48 }, { delta: 213, value: 59 }, { delta
var LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -12,7 +12,7 @@ const CATEGORIES = [
];
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -12,7 +12,7 @@ const CATEGORIES = [
];
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -8,7 +8,7 @@ var BarGraphWidget = require("devtools/client/shared/widgets/BarGraphWidget");
var {CanvasGraphUtils} = require("devtools/client/shared/widgets/Graphs");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -6,7 +6,7 @@
var LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -7,7 +7,7 @@ const TEST_DATA = [{ delta: 112, value: 48 }, { delta: 213, value: 59 }, { delta
var LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -23,7 +23,7 @@ for (let frameRate of FRAMES) {
var LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -20,7 +20,7 @@ const SECTIONS = [
];
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -4,13 +4,12 @@
"use strict";
var promise = require("promise");
var {editableField, getInplaceEditorForSpan: inplaceEditor} = require("devtools/client/shared/inplace-editor");
// Test the inplace-editor behavior.
add_task(function*() {
yield promiseTab("data:text/html;charset=utf-8,inline editor tests");
yield addTab("data:text/html;charset=utf-8,inline editor tests");
let [host, win, doc] = yield createHost();
yield testMultipleInitialization(doc);

View File

@ -5,12 +5,11 @@
"use strict";
var {editableField, getInplaceEditorForSpan: inplaceEditor} = require("devtools/client/shared/inplace-editor");
var promise = require("promise");
// Test that the trimOutput option for the inplace editor works correctly.
add_task(function*() {
yield promiseTab("data:text/html;charset=utf-8,inline editor tests");
yield addTab("data:text/html;charset=utf-8,inline editor tests");
let [host, win, doc] = yield createHost();
yield testNonTrimmed(doc);

View File

@ -9,28 +9,27 @@ var {getAdjustedQuads} = require("devtools/shared/layout/utils");
const TEST_URI = TEST_URI_ROOT + "browser_layoutHelpers-getBoxQuads.html";
function test() {
addTab(TEST_URI, function(browser, tab) {
let doc = browser.contentDocument;
add_task(function* () {
ok(typeof getAdjustedQuads === "function", "getAdjustedQuads is defined");
let tab = yield addTab(TEST_URI);
let doc = tab.linkedBrowser.contentDocument;
info("Running tests");
ok(typeof getAdjustedQuads === "function", "getAdjustedQuads is defined");
returnsTheRightDataStructure(doc);
isEmptyForMissingNode(doc);
isEmptyForHiddenNodes(doc);
defaultsToBorderBoxIfNoneProvided(doc);
returnsLikeGetBoxQuadsInSimpleCase(doc);
takesIframesOffsetsIntoAccount(doc);
takesScrollingIntoAccount(doc);
takesZoomIntoAccount(doc);
returnsMultipleItemsForWrappingInlineElements(doc);
info("Running tests");
gBrowser.removeCurrentTab();
finish();
});
}
returnsTheRightDataStructure(doc);
isEmptyForMissingNode(doc);
isEmptyForHiddenNodes(doc);
defaultsToBorderBoxIfNoneProvided(doc);
returnsLikeGetBoxQuadsInSimpleCase(doc);
takesIframesOffsetsIntoAccount(doc);
takesScrollingIntoAccount(doc);
takesZoomIntoAccount(doc);
returnsMultipleItemsForWrappingInlineElements(doc);
gBrowser.removeCurrentTab();
});
function returnsTheRightDataStructure(doc) {
info("Checks that the returned data contains bounds and 4 points");

View File

@ -22,7 +22,6 @@
const {CssDocsTooltip} = require("devtools/client/shared/widgets/Tooltip");
const {setBaseCssDocsUrl, MdnDocsWidget} = require("devtools/client/shared/widgets/MdnDocsWidget");
const promise = require("promise");
// frame to load the tooltip into
const MDN_DOCS_TOOLTIP_FRAME = "chrome://devtools/content/shared/widgets/mdn-docs-frame.xhtml";
@ -51,7 +50,7 @@ const URI_PARAMS = "?utm_source=mozilla&utm_medium=firefox-inspector&utm_campaig
add_task(function*() {
setBaseCssDocsUrl(TEST_URI_ROOT);
yield promiseTab("about:blank");
yield addTab("about:blank");
let [host, win, doc] = yield createHost("bottom", MDN_DOCS_TOOLTIP_FRAME);
let widget = new MdnDocsWidget(win.document);

View File

@ -99,7 +99,7 @@ const TEST_DATA = [{
add_task(function*() {
setBaseCssDocsUrl(TEST_URI_ROOT);
yield promiseTab("about:blank");
yield addTab("about:blank");
let [host, win, doc] = yield createHost("bottom", MDN_DOCS_TOOLTIP_FRAME);
let widget = new MdnDocsWidget(win.document);

View File

@ -4,7 +4,6 @@
// Tests that options-view OptionsView responds to events correctly.
const {OptionsView} = require("devtools/client/shared/options-view");
const {Services} = require("resource://gre/modules/Services.jsm");
const BRANCH = "devtools.debugger.";
const BLACK_BOX_PREF = "auto-black-box";
@ -19,7 +18,7 @@ add_task(function*() {
Services.prefs.setBoolPref(BRANCH + PRETTY_PRINT_PREF, true);
info("Opening a test tab and a toolbox host to create the options view in");
yield promiseTab("about:blank");
yield addTab("about:blank");
let [host, win, doc] = yield createHost("bottom", OPTIONS_VIEW_URL);
yield testOptionsView(win);

View File

@ -3,13 +3,12 @@
"use strict";
var {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
var {Loader} = Cu.import("resource://gre/modules/commonjs/toolkit/loader.js",
{});
var {OutputParser} = require("devtools/shared/output-parser");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -8,7 +8,7 @@ const TEST_URI = "chrome://devtools/content/shared/widgets/spectrum-frame.xhtml"
const {Spectrum} = require("devtools/client/shared/widgets/Spectrum");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
yield performTest();
gBrowser.removeCurrentTab();
});

View File

@ -7,7 +7,7 @@ const TEST_URI = "data:text/html;charset=utf-8," +
var {EyedropperManager} = require("devtools/client/eyedropper/eyedropper");
add_task(function*() {
yield promiseTab(TEST_URI);
yield addTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
let target = TargetFactory.forTab(gBrowser.selectedTab);

View File

@ -11,7 +11,7 @@ const TEST_URI = "data:text/html;charset=utf-8," +
const TOOL_DELAY = 200;
add_task(function*() {
yield promiseTab(TEST_URI);
yield addTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
let target = TargetFactory.forTab(gBrowser.selectedTab);

View File

@ -9,7 +9,7 @@ const TEST_URI = "data:text/html;charset=utf-8," +
const TOOL_DELAY = 200;
add_task(function*() {
yield promiseTab(TEST_URI);
yield addTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
let target = TargetFactory.forTab(gBrowser.selectedTab);

View File

@ -9,7 +9,7 @@ const TEST_URI = "data:text/html;charset=utf-8," +
const TOOL_DELAY = 200;
add_task(function*() {
yield promiseTab(TEST_URI);
yield addTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
let target = TargetFactory.forTab(gBrowser.selectedTab);

View File

@ -9,7 +9,7 @@ const TEST_URI = "data:text/html;charset=utf-8," +
const TOOL_DELAY = 200;
add_task(function*() {
yield promiseTab(TEST_URI);
yield addTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
let target = TargetFactory.forTab(gBrowser.selectedTab);

View File

@ -8,7 +8,7 @@ const TEST_URI = "data:text/html;charset=utf-8,<p>browser_telemetry_sidebar.js</
const TOOL_DELAY = 200;
add_task(function*() {
yield promiseTab(TEST_URI);
yield addTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
let target = TargetFactory.forTab(gBrowser.selectedTab);

View File

@ -9,7 +9,7 @@ const TEST_URI = "data:text/html;charset=utf-8," +
const TOOL_DELAY = 200;
add_task(function*() {
yield promiseTab(TEST_URI);
yield addTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
yield openAndCloseToolbox(3, TOOL_DELAY, "inspector");

View File

@ -13,7 +13,7 @@ add_task(function*() {
let originalPref = Services.prefs.getBoolPref("devtools.canvasdebugger.enabled");
Services.prefs.setBoolPref("devtools.canvasdebugger.enabled", true);
yield promiseTab(TEST_URI);
yield addTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
yield openAndCloseToolbox(2, TOOL_DELAY, "canvasdebugger");

View File

@ -9,7 +9,7 @@ const TEST_URI = "data:text/html;charset=utf-8," +
const TOOL_DELAY = 200;
add_task(function*() {
yield promiseTab(TEST_URI);
yield addTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
yield openAndCloseToolbox(2, TOOL_DELAY, "inspector");

View File

@ -9,7 +9,7 @@ const TEST_URI = "data:text/html;charset=utf-8," +
const TOOL_DELAY = 200;
add_task(function*() {
yield promiseTab(TEST_URI);
yield addTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
yield openAndCloseToolbox(2, TOOL_DELAY, "jsdebugger");

View File

@ -8,7 +8,7 @@ const TEST_URI = "data:text/html;charset=utf-8,<p>browser_telemetry_toolboxtabs_
const TOOL_DELAY = 200;
add_task(function*() {
yield promiseTab(TEST_URI);
yield addTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
yield openAndCloseToolbox(2, TOOL_DELAY, "performance");

View File

@ -8,7 +8,7 @@ const TEST_URI = "data:text/html;charset=utf-8,<p>browser_telemetry_toolboxtabs_
const TOOL_DELAY = 200;
add_task(function*() {
yield promiseTab(TEST_URI);
yield addTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
yield openAndCloseToolbox(2, TOOL_DELAY, "netmonitor");

View File

@ -8,7 +8,7 @@ const TEST_URI = "data:text/html;charset=utf-8,<p>browser_telemetry_toolboxtabs_
const TOOL_DELAY = 200;
add_task(function*() {
yield promiseTab(TEST_URI);
yield addTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
yield openAndCloseToolbox(2, TOOL_DELAY, "options");

View File

@ -19,7 +19,7 @@ add_task(function*() {
let originalPref = Services.prefs.getBoolPref("devtools.shadereditor.enabled");
Services.prefs.setBoolPref("devtools.shadereditor.enabled", true);
yield promiseTab(TEST_URI);
yield addTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
yield openAndCloseToolbox(2, TOOL_DELAY, "shadereditor");

View File

@ -11,7 +11,7 @@ add_task(function*() {
info("Activating the storage inspector");
Services.prefs.setBoolPref("devtools.storage.enabled", true);
yield promiseTab(TEST_URI);
yield addTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
yield openAndCloseToolbox(2, TOOL_DELAY, "storage");

View File

@ -8,7 +8,7 @@ const TEST_URI = "data:text/html;charset=utf-8,<p>browser_telemetry_toolboxtabs_
const TOOL_DELAY = 200;
add_task(function*() {
yield promiseTab(TEST_URI);
yield addTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
yield openAndCloseToolbox(2, TOOL_DELAY, "styleeditor");

View File

@ -12,7 +12,7 @@ add_task(function*() {
let originalPref = Services.prefs.getBoolPref("devtools.webaudioeditor.enabled");
Services.prefs.setBoolPref("devtools.webaudioeditor.enabled", true);
yield promiseTab(TEST_URI);
yield addTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
yield openAndCloseToolbox(2, TOOL_DELAY, "webaudioeditor");

View File

@ -8,7 +8,7 @@ const TEST_URI = "data:text/html;charset=utf-8,<p>browser_telemetry_toolboxtabs_
const TOOL_DELAY = 200;
add_task(function*() {
yield promiseTab(TEST_URI);
yield addTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
yield openAndCloseToolbox(2, TOOL_DELAY, "webconsole");

View File

@ -14,7 +14,7 @@ const template = Cu.import("resource://devtools/shared/gcli/Templater.jsm", {}).
const TEST_URI = TEST_URI_ROOT + "browser_templater_basic.html";
var test = Task.async(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
let [host, win, doc] = yield createHost("bottom", TEST_URI);
info("Starting DOM Templater Tests");

View File

@ -6,12 +6,12 @@
var {getColor, getTheme, setTheme} = require("devtools/client/shared/theme");
function test() {
add_task(function* () {
testGetTheme();
testSetTheme();
testGetColor();
testColorExistence();
}
});
function testGetTheme () {
let originalTheme = getTheme();

View File

@ -5,26 +5,17 @@
const TEST_URI = TEST_URI_ROOT + "browser_toolbar_basic.html";
function test() {
addTab(TEST_URI, function(browser, tab) {
info("Starting browser_toolbar_basic.js");
runTest();
});
}
add_task(function*() {
info("Starting browser_toolbar_basic.js");
yield addTab(TEST_URI);
function runTest() {
ok(!DeveloperToolbar.visible, "DeveloperToolbar is not visible in runTest");
ok(!DeveloperToolbar.visible, "DeveloperToolbar is not visible in to start");
oneTimeObserve(DeveloperToolbar.NOTIFICATIONS.SHOW, catchFail(checkOpen));
let shown = oneTimeObserve(DeveloperToolbar.NOTIFICATIONS.SHOW);
document.getElementById("Tools:DevToolbar").doCommand();
}
function isChecked(b) {
return b.getAttribute("checked") == "true";
}
function checkOpen() {
yield shown;
ok(DeveloperToolbar.visible, "DeveloperToolbar is visible in checkOpen");
let close = document.getElementById("developer-toolbar-closebutton");
ok(close, "Close button exists");
@ -33,42 +24,35 @@ function checkOpen() {
ok(!isChecked(toggleToolbox), "toggle toolbox button is not checked");
let target = TargetFactory.forTab(gBrowser.selectedTab);
gDevTools.showToolbox(target, "inspector").then(function(toolbox) {
ok(isChecked(toggleToolbox), "toggle toolbox button is checked");
addTab("about:blank", function(browser, tab) {
info("Opened a new tab");
ok(!isChecked(toggleToolbox), "toggle toolbox button is not checked");
gBrowser.removeCurrentTab();
oneTimeObserve(DeveloperToolbar.NOTIFICATIONS.HIDE, catchFail(checkClosed));
document.getElementById("Tools:DevToolbar").doCommand();
});
});
}
function checkClosed() {
ok(!DeveloperToolbar.visible, "DeveloperToolbar is not visible in checkClosed");
oneTimeObserve(DeveloperToolbar.NOTIFICATIONS.SHOW, catchFail(checkReOpen));
document.getElementById("Tools:DevToolbar").doCommand();
}
function checkReOpen() {
ok(DeveloperToolbar.visible, "DeveloperToolbar is visible in checkReOpen");
let toggleToolbox =
document.getElementById("devtoolsMenuBroadcaster_DevToolbox");
let toolbox = yield gDevTools.showToolbox(target, "inspector");
ok(isChecked(toggleToolbox), "toggle toolbox button is checked");
oneTimeObserve(DeveloperToolbar.NOTIFICATIONS.HIDE, catchFail(checkReClosed));
yield addTab("about:blank");
info("Opened a new tab");
ok(!isChecked(toggleToolbox), "toggle toolbox button is not checked");
gBrowser.removeCurrentTab();
let hidden = oneTimeObserve(DeveloperToolbar.NOTIFICATIONS.HIDE);
document.getElementById("Tools:DevToolbar").doCommand();
yield hidden;
ok(!DeveloperToolbar.visible, "DeveloperToolbar is not visible in hidden");
shown = oneTimeObserve(DeveloperToolbar.NOTIFICATIONS.SHOW);
document.getElementById("Tools:DevToolbar").doCommand();
yield shown;
ok(DeveloperToolbar.visible, "DeveloperToolbar is visible in after open");
ok(isChecked(toggleToolbox), "toggle toolbox button is checked");
hidden = oneTimeObserve(DeveloperToolbar.NOTIFICATIONS.HIDE);
document.getElementById("developer-toolbar-closebutton").doCommand();
}
yield hidden;
function checkReClosed() {
ok(!DeveloperToolbar.visible, "DeveloperToolbar is not visible in checkReClosed");
ok(!DeveloperToolbar.visible, "DeveloperToolbar is not visible after re-close");
});
finish();
function isChecked(b) {
return b.getAttribute("checked") == "true";
}

View File

@ -19,7 +19,7 @@ registerCleanupFunction(() => {
});
add_task(function* showToolbar() {
yield promiseTab(TEST_URI);
yield addTab(TEST_URI);
info("Starting browser_toolbar_tooltip.js");

View File

@ -19,9 +19,9 @@ function test() {
});
ignoreAllUncaughtExceptions();
addTab(TEST_URI, openToolbar);
addTab(TEST_URI).then(openToolbar);
function openToolbar(browser, tab) {
function openToolbar(tab) {
tab1 = tab;
ignoreAllUncaughtExceptions(false);
@ -62,12 +62,12 @@ function test() {
warnings: 1,
callback: () => {
ignoreAllUncaughtExceptions();
addTab(TEST_URI, onOpenSecondTab);
addTab(TEST_URI).then(onOpenSecondTab);
},
});
}
function onOpenSecondTab(browser, tab) {
function onOpenSecondTab(tab) {
tab2 = tab;
ignoreAllUncaughtExceptions(false);

View File

@ -11,7 +11,7 @@ const TEST_URI = "data:text/html;charset=utf-8,<head><link rel='stylesheet' " +
const {TreeWidget} = require("devtools/client/shared/widgets/TreeWidget");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
let [host, win, doc] = yield createHost("bottom", TEST_URI);
let tree = new TreeWidget(doc.querySelector("div"), {

View File

@ -12,7 +12,7 @@ const {TreeWidget} = require("devtools/client/shared/widgets/TreeWidget");
const Promise = require("promise");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
let [host, win, doc] = yield createHost("bottom", TEST_URI);
let tree = new TreeWidget(doc.querySelector("div"), {

View File

@ -12,7 +12,7 @@ const {TreeWidget} = require("devtools/client/shared/widgets/TreeWidget");
const Promise = require("promise");
add_task(function*() {
yield promiseTab("about:blank");
yield addTab("about:blank");
let [host, win, doc] = yield createHost("bottom", TEST_URI);
let tree = new TreeWidget(doc.querySelector("div"), {

View File

@ -2,59 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
var {TargetFactory} = require("devtools/client/framework/target");
var {console} = Cu.import("resource://gre/modules/Console.jsm", {});
var {gDevTools} = Cu.import("resource://devtools/client/framework/gDevTools.jsm", {});
// shared-head.js handles imports, constants, and utility functions
Services.scriptloader.loadSubScript("chrome://mochitests/content/browser/devtools/client/framework/test/shared-head.js", this);
const {DOMHelpers} = Cu.import("resource://devtools/client/shared/DOMHelpers.jsm", {});
const {Hosts} = require("devtools/client/framework/toolbox-hosts");
const {defer} = require("promise");
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
DevToolsUtils.testing = true;
SimpleTest.registerCleanupFunction(() => {
DevToolsUtils.testing = false;
});
const TEST_URI_ROOT = "http://example.com/browser/devtools/client/shared/test/";
const OPTIONS_VIEW_URL = TEST_URI_ROOT + "doc_options-view.xul";
/**
* Open a new tab at a URL and call a callback on load
*/
function addTab(aURL, aCallback)
{
waitForExplicitFinish();
gBrowser.selectedTab = gBrowser.addTab();
let tab = gBrowser.selectedTab;
let browser = gBrowser.getBrowserForTab(tab);
let url = encodeURI(aURL);
BrowserTestUtils.browserLoaded(browser, false, url).then(() => {
aCallback(browser, tab, browser.contentDocument);
});
browser.loadURI(url);
}
function promiseTab(aURL) {
return new Promise(resolve =>
addTab(aURL, resolve));
}
registerCleanupFunction(function* tearDown() {
let target = TargetFactory.forTab(gBrowser.selectedTab);
yield gDevTools.closeToolbox(target);
while (gBrowser.tabs.length > 1) {
gBrowser.removeCurrentTab();
}
console = undefined;
});
function catchFail(func) {
return function() {
try {
@ -136,11 +93,17 @@ function waitForValue(aOptions)
}
function oneTimeObserve(name, callback) {
var func = function() {
Services.obs.removeObserver(func, name);
callback();
};
Services.obs.addObserver(func, name, false);
return new Promise((resolve) => {
var func = function() {
Services.obs.removeObserver(func, name);
if (callback) {
callback();
}
resolve();
};
Services.obs.addObserver(func, name, false);
});
}
var createHost = Task.async(function*(type = "bottom", src = "data:text/html;charset=utf-8,") {