gecko/browser/devtools/debugger/test/browser_dbg_variables-view-edit-getset-02.js

104 lines
3.0 KiB
JavaScript
Raw Normal View History

Bug 876277 - Cleanup debugger variables view tests, r=past --HG-- rename : browser/devtools/debugger/test/browser_dbg_propertyview-02.js => browser/devtools/debugger/test/browser_dbg_variables-view-01.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-03.js => browser/devtools/debugger/test/browser_dbg_variables-view-02.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-04.js => browser/devtools/debugger/test/browser_dbg_variables-view-03.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-05.js => browser/devtools/debugger/test/browser_dbg_variables-view-04.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-06.js => browser/devtools/debugger/test/browser_dbg_variables-view-05.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-data.js => browser/devtools/debugger/test/browser_dbg_variables-view-data.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-data-getset-01.js => browser/devtools/debugger/test/browser_dbg_variables-view-edit-getset-01.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-data-getset-02.js => browser/devtools/debugger/test/browser_dbg_variables-view-edit-getset-02.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-edit-value.js => browser/devtools/debugger/test/browser_dbg_variables-view-edit-value.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-edit-watch.js => browser/devtools/debugger/test/browser_dbg_variables-view-edit-watch.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-filter-01.js => browser/devtools/debugger/test/browser_dbg_variables-view-filter-01.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-filter-02.js => browser/devtools/debugger/test/browser_dbg_variables-view-filter-02.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-filter-05.js => browser/devtools/debugger/test/browser_dbg_variables-view-filter-03.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-filter-06.js => browser/devtools/debugger/test/browser_dbg_variables-view-filter-04.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-filter-08.js => browser/devtools/debugger/test/browser_dbg_variables-view-filter-05.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-filter-03.js => browser/devtools/debugger/test/browser_dbg_variables-view-filter-pref.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-08.js => browser/devtools/debugger/test/browser_dbg_variables-view-frame-parameters-01.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-07.js => browser/devtools/debugger/test/browser_dbg_variables-view-frame-parameters-02.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-09.js => browser/devtools/debugger/test/browser_dbg_variables-view-frame-parameters-03.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-10.js => browser/devtools/debugger/test/browser_dbg_variables-view-frame-with.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-12.js => browser/devtools/debugger/test/browser_dbg_variables-view-frozen-sealed-nonext.js rename : browser/devtools/debugger/test/browser_dbg_bug786070_hide_nonenums.js => browser/devtools/debugger/test/browser_dbg_variables-view-hide-non-enums.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-data-big.js => browser/devtools/debugger/test/browser_dbg_variables-view-large-array-buffer.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-reexpand.js => browser/devtools/debugger/test/browser_dbg_variables-view-reexpand-01.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-11.js => browser/devtools/debugger/test/browser_dbg_variables-view-webidl.js
2013-09-13 06:23:18 -07:00
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Make sure that the variables view is able to override getter properties
* to plain value properties.
*/
const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html";
let gTab, gDebuggee, gPanel, gDebugger;
let gL10N, gEditor, gVars, gWatch;
function test() {
// Debug test slaves are a bit slow at this test.
requestLongerTimeout(2);
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gL10N = gDebugger.L10N;
gEditor = gDebugger.DebuggerView.editor;
gVars = gDebugger.DebuggerView.Variables;
gWatch = gDebugger.DebuggerView.WatchExpressions;
gVars.switch = function() {};
gVars.delete = function() {};
waitForSourceAndCaretAndScopes(gPanel, ".html", 24)
.then(() => addWatchExpression())
.then(() => testEdit("\"xlerb\"", "xlerb"))
.then(() => resumeDebuggerThenCloseAndFinish(gPanel))
.then(null, aError => {
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
});
EventUtils.sendMouseEvent({ type: "click" },
gDebuggee.document.querySelector("button"),
gDebuggee);
});
}
function addWatchExpression() {
let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_WATCH_EXPRESSIONS);
gWatch.addExpression("myVar.prop");
gEditor.focus();
return finished;
}
function testEdit(aString, aExpected) {
let localScope = gVars.getScopeAtIndex(1);
let myVar = localScope.get("myVar");
let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_PROPERTIES).then(() => {
let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_WATCH_EXPRESSIONS).then(() => {
let exprScope = gVars.getScopeAtIndex(0);
ok(exprScope,
"There should be a wach expressions scope in the variables view.");
is(exprScope.name, gL10N.getStr("watchExpressionsScopeLabel"),
"The scope's name should be marked as 'Watch Expressions'.");
is(exprScope._store.size, 1,
"There should be one evaluation available.");
is(exprScope.get("myVar.prop").value, aExpected,
"The expression value is correct after the edit.");
});
let editTarget = myVar.get("prop").target;
// Allow the target variable to get painted, so that clicking on
// its value would scroll the new textbox node into view.
executeSoon(() => {
let varEdit = editTarget.querySelector(".title > .variables-view-edit");
EventUtils.sendMouseEvent({ type: "mousedown" }, varEdit, gDebugger);
let varInput = editTarget.querySelector(".title > .element-value-input");
setText(varInput, aString);
EventUtils.sendKey("RETURN", gDebugger);
});
return finished;
});
myVar.expand();
gVars.clearHierarchy();
return finished;
}
registerCleanupFunction(function() {
gTab = null;
gDebuggee = null;
gPanel = null;
gDebugger = null;
gVars = null;
gWatch = null;
});