2012-02-07 09:22:30 -08:00
|
|
|
/* vim:set ts=2 sw=2 sts=2 et: */
|
|
|
|
/*
|
|
|
|
* Any copyright is dedicated to the Public Domain.
|
|
|
|
* http://creativecommons.org/publicdomain/zero/1.0/
|
|
|
|
*/
|
|
|
|
var gPane = null;
|
|
|
|
var gTab = null;
|
|
|
|
var gDebuggee = null;
|
|
|
|
var gDebugger = null;
|
|
|
|
|
|
|
|
function test() {
|
|
|
|
debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
|
|
|
|
gTab = aTab;
|
|
|
|
gDebuggee = aDebuggee;
|
|
|
|
gPane = aPane;
|
2012-05-03 10:36:40 -07:00
|
|
|
gDebugger = gPane.contentWindow;
|
2012-02-07 09:22:30 -08:00
|
|
|
|
|
|
|
testSimpleCall();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function testSimpleCall() {
|
2012-04-08 22:15:47 -07:00
|
|
|
gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
|
2012-02-07 09:22:30 -08:00
|
|
|
Services.tm.currentThread.dispatch({ run: function() {
|
|
|
|
|
2012-10-26 10:10:17 -07:00
|
|
|
let testScope = gDebugger.DebuggerView.Variables.addScope("test");
|
2012-02-07 09:22:30 -08:00
|
|
|
|
|
|
|
ok(testScope,
|
|
|
|
"Should have created a scope.");
|
|
|
|
|
2012-05-29 02:08:20 -07:00
|
|
|
is(testScope.id.substring(0, 4), "test",
|
2012-02-07 09:22:30 -08:00
|
|
|
"The newly created scope should have the default id set.");
|
|
|
|
|
2012-10-26 10:10:17 -07:00
|
|
|
is(testScope.target.querySelector(".name").getAttribute("value"), "test",
|
2012-02-07 09:22:30 -08:00
|
|
|
"Any new scope should have the designated title.");
|
|
|
|
|
2012-10-26 10:10:17 -07:00
|
|
|
is(testScope.target.querySelector(".details").childNodes.length, 0,
|
2012-02-07 09:22:30 -08:00
|
|
|
"Any new scope should have a container with no child nodes.");
|
|
|
|
|
2012-10-26 10:10:17 -07:00
|
|
|
is(gDebugger.DebuggerView.Variables._list.childNodes.length, 3,
|
2012-05-29 02:08:20 -07:00
|
|
|
"Should have 3 scopes created.");
|
2012-02-07 09:22:30 -08:00
|
|
|
|
|
|
|
|
|
|
|
ok(!testScope.expanded,
|
|
|
|
"Any new created scope should be initially collapsed.");
|
|
|
|
|
|
|
|
ok(testScope.visible,
|
|
|
|
"Any new created scope should be initially visible.");
|
|
|
|
|
|
|
|
let expandCallbackSender = null;
|
|
|
|
let collapseCallbackSender = null;
|
|
|
|
let toggleCallbackSender = null;
|
|
|
|
let hideCallbackSender = null;
|
|
|
|
let showCallbackSender = null;
|
|
|
|
|
|
|
|
testScope.onexpand = function(sender) { expandCallbackSender = sender; };
|
|
|
|
testScope.oncollapse = function(sender) { collapseCallbackSender = sender; };
|
|
|
|
testScope.ontoggle = function(sender) { toggleCallbackSender = sender; };
|
|
|
|
testScope.onhide = function(sender) { hideCallbackSender = sender; };
|
|
|
|
testScope.onshow = function(sender) { showCallbackSender = sender; };
|
|
|
|
|
|
|
|
testScope.expand();
|
|
|
|
ok(testScope.expanded,
|
|
|
|
"The testScope shouldn't be collapsed anymore.");
|
|
|
|
is(expandCallbackSender, testScope,
|
|
|
|
"The expandCallback wasn't called as it should.");
|
|
|
|
|
|
|
|
testScope.collapse();
|
|
|
|
ok(!testScope.expanded,
|
|
|
|
"The testScope should be collapsed again.");
|
|
|
|
is(collapseCallbackSender, testScope,
|
|
|
|
"The collapseCallback wasn't called as it should.");
|
|
|
|
|
|
|
|
testScope.expanded = true;
|
|
|
|
ok(testScope.expanded,
|
|
|
|
"The testScope shouldn't be collapsed anymore.");
|
|
|
|
|
|
|
|
testScope.toggle();
|
|
|
|
ok(!testScope.expanded,
|
|
|
|
"The testScope should be collapsed again.");
|
|
|
|
is(toggleCallbackSender, testScope,
|
|
|
|
"The toggleCallback wasn't called as it should.");
|
|
|
|
|
|
|
|
|
|
|
|
testScope.hide();
|
|
|
|
ok(!testScope.visible,
|
|
|
|
"The testScope should be invisible after hiding.");
|
|
|
|
is(hideCallbackSender, testScope,
|
|
|
|
"The hideCallback wasn't called as it should.");
|
|
|
|
|
|
|
|
testScope.show();
|
|
|
|
ok(testScope.visible,
|
|
|
|
"The testScope should be visible again.");
|
|
|
|
is(showCallbackSender, testScope,
|
|
|
|
"The showCallback wasn't called as it should.");
|
|
|
|
|
|
|
|
testScope.visible = false;
|
|
|
|
ok(!testScope.visible,
|
|
|
|
"The testScope should be invisible after hiding.");
|
|
|
|
|
|
|
|
|
|
|
|
ok(!testScope.expanded,
|
|
|
|
"The testScope should remember it is collapsed even if it is hidden.");
|
|
|
|
|
2012-10-26 10:10:17 -07:00
|
|
|
EventUtils.sendMouseEvent({ type: "mousedown" },
|
|
|
|
testScope.target.querySelector(".title"),
|
2012-02-07 09:22:30 -08:00
|
|
|
gDebugger);
|
|
|
|
|
|
|
|
ok(testScope.expanded,
|
|
|
|
"Clicking the testScope tilte should expand it.");
|
|
|
|
|
2012-10-26 10:10:17 -07:00
|
|
|
EventUtils.sendMouseEvent({ type: "mousedown" },
|
|
|
|
testScope.target.querySelector(".title"),
|
2012-02-07 09:22:30 -08:00
|
|
|
gDebugger);
|
|
|
|
|
|
|
|
ok(!testScope.expanded,
|
|
|
|
"Clicking again the testScope tilte should collapse it.");
|
|
|
|
|
2012-04-08 22:15:47 -07:00
|
|
|
gDebugger.DebuggerController.activeThread.resume(function() {
|
2012-05-31 03:01:13 -07:00
|
|
|
closeDebuggerAndFinish();
|
2012-03-06 00:22:17 -08:00
|
|
|
});
|
2012-02-07 09:22:30 -08:00
|
|
|
}}, 0);
|
|
|
|
});
|
|
|
|
|
|
|
|
gDebuggee.simpleCall();
|
|
|
|
}
|
|
|
|
|
2012-03-06 00:22:17 -08:00
|
|
|
registerCleanupFunction(function() {
|
|
|
|
removeTab(gTab);
|
|
|
|
gPane = null;
|
|
|
|
gTab = null;
|
|
|
|
gDebuggee = null;
|
|
|
|
gDebugger = null;
|
|
|
|
});
|