Bug 1238133 - Part 7: Update test methods for opening the inspector sidebar panels r=bgrins

This commit is contained in:
Gabriel Luong 2016-01-26 11:17:48 -05:00
parent 9b96d312be
commit 2e8a757385
5 changed files with 18 additions and 31 deletions

View File

@ -19,11 +19,11 @@ registerCleanupFunction(() => {
* view is visible and ready
*/
function openComputedView() {
return openInspectorSidebarTab("computedview").then(objects => {
return openInspectorSidebarTab("computedview").then(({toolbox, inspector}) => {
return {
toolbox: objects.toolbox,
inspector: objects.inspector,
view: objects.view.view
toolbox,
inspector,
view: inspector.computedview.view
};
});
}

View File

@ -36,7 +36,7 @@ var openFontInspectorForURL = Task.async(function*(url) {
return {
toolbox,
inspector,
view: inspector.sidebar.getWindowForTab("fontinspector").fontInspector
view: inspector.fontInspector
};
});

View File

@ -52,7 +52,7 @@ function selectAndHighlightNode(nodeOrSelector, inspector) {
* view is visible and ready
*/
function openLayoutView() {
return openInspectorSidebarTab("layoutview").then(objects => {
return openInspectorSidebarTab("layoutview").then(({toolbox, inspector}) => {
// The actual highligher show/hide methods are mocked in layoutview tests.
// The highlighter is tested in devtools/inspector/test.
function mockHighlighter({highlighter}) {
@ -63,9 +63,13 @@ function openLayoutView() {
return promise.resolve();
};
}
mockHighlighter(objects.toolbox);
mockHighlighter(toolbox);
return objects;
return {
toolbox,
inspector,
view: inspector.layoutview
};
});
}

View File

@ -48,11 +48,11 @@ addTab = function(url) {
* view is visible and ready
*/
function openRuleView() {
return openInspectorSidebarTab("ruleview").then(objects => {
return openInspectorSidebarTab("ruleview").then(({toolbox, inspector}) => {
return {
toolbox: objects.toolbox,
inspector: objects.inspector,
view: objects.view.view
toolbox,
inspector,
view: inspector.ruleview.view
};
});
}

View File

@ -170,32 +170,15 @@ function getActiveInspector() {
var openInspectorSidebarTab = Task.async(function*(id, hostType) {
let {toolbox, inspector} = yield openInspector();
if (!hasSideBarTab(inspector, id)) {
info("Waiting for the " + id + " sidebar to be ready");
yield inspector.sidebar.once(id + "-ready");
}
info("Selecting the " + id + " sidebar");
inspector.sidebar.select(id);
return {
toolbox: toolbox,
inspector: inspector,
view: inspector.sidebar.getWindowForTab(id)[id]
toolbox,
inspector
};
});
/**
* Checks whether the inspector's sidebar corresponding to the given id already
* exists
* @param {InspectorPanel}
* @param {String}
* @return {Boolean}
*/
function hasSideBarTab(inspector, id) {
return !!inspector.sidebar.getWindowForTab(id);
}
/**
* Get the NodeFront for a node that matches a given css selector, via the
* protocol.