2016-02-17 00:14:53 +00:00
|
|
|
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
|
|
|
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
2015-06-09 21:59:27 +00:00
|
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
|
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
// Test that the toolbox 'switch to previous host' feature works.
|
|
|
|
// Pressing ctrl/cmd+shift+d should switch to the last used host.
|
|
|
|
|
|
|
|
const URL = "data:text/html;charset=utf8,test page for toolbox switching";
|
|
|
|
|
2015-09-21 17:04:18 +00:00
|
|
|
var {Toolbox} = require("devtools/client/framework/toolbox");
|
2015-08-06 12:38:10 +00:00
|
|
|
|
2015-06-09 21:59:27 +00:00
|
|
|
add_task(function*() {
|
|
|
|
info("Create a test tab and open the toolbox");
|
|
|
|
let tab = yield addTab(URL);
|
|
|
|
let target = TargetFactory.forTab(tab);
|
|
|
|
let toolbox = yield gDevTools.showToolbox(target, "webconsole");
|
|
|
|
|
|
|
|
let keyElement = toolbox.doc.getElementById("toolbox-toggle-host-key");
|
|
|
|
|
2015-08-06 12:38:10 +00:00
|
|
|
let {SIDE, BOTTOM, WINDOW} = Toolbox.HostType;
|
2015-06-09 21:59:27 +00:00
|
|
|
checkHostType(toolbox, BOTTOM, SIDE);
|
|
|
|
|
|
|
|
info ("Switching from bottom to side");
|
|
|
|
synthesizeKeyElement(keyElement);
|
|
|
|
yield toolbox.once("host-changed");
|
|
|
|
checkHostType(toolbox, SIDE, BOTTOM);
|
|
|
|
|
|
|
|
info ("Switching from side to bottom");
|
|
|
|
synthesizeKeyElement(keyElement);
|
|
|
|
yield toolbox.once("host-changed");
|
|
|
|
checkHostType(toolbox, BOTTOM, SIDE);
|
|
|
|
|
|
|
|
info ("Switching to window");
|
|
|
|
yield toolbox.switchHost(WINDOW);
|
|
|
|
checkHostType(toolbox, WINDOW, BOTTOM);
|
|
|
|
|
|
|
|
info ("Switching from window to bottom");
|
|
|
|
synthesizeKeyElement(keyElement);
|
|
|
|
yield toolbox.once("host-changed");
|
|
|
|
checkHostType(toolbox, BOTTOM, WINDOW);
|
|
|
|
|
|
|
|
yield toolbox.destroy();
|
|
|
|
gBrowser.removeCurrentTab();
|
|
|
|
});
|