browser/devtools/debugger/test/browser_dbg_variables-view-popup-06.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 /**
michael@0 5 * Tests opening the variable inspection popup on a variable which has a
michael@0 6 * complext object as the value.
michael@0 7 */
michael@0 8
michael@0 9 const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html";
michael@0 10
michael@0 11 function test() {
michael@0 12 requestLongerTimeout(2);
michael@0 13 Task.spawn(function() {
michael@0 14 let [tab, debuggee, panel] = yield initDebugger(TAB_URL);
michael@0 15 let win = panel.panelWin;
michael@0 16 let bubble = win.DebuggerView.VariableBubble;
michael@0 17 let tooltip = bubble._tooltip.panel;
michael@0 18
michael@0 19 function verifyContents() {
michael@0 20 is(tooltip.querySelectorAll(".variables-view-container").length, 1,
michael@0 21 "There should be one variables view container added to the tooltip.");
michael@0 22
michael@0 23 is(tooltip.querySelectorAll(".variables-view-scope[untitled]").length, 1,
michael@0 24 "There should be one scope with no header displayed.");
michael@0 25 is(tooltip.querySelectorAll(".variables-view-variable[untitled]").length, 1,
michael@0 26 "There should be one variable with no header displayed.");
michael@0 27
michael@0 28 is(tooltip.querySelectorAll(".variables-view-property").length, 7,
michael@0 29 "There should be 7 properties displayed.");
michael@0 30
michael@0 31 is(tooltip.querySelectorAll(".variables-view-property .name")[0].getAttribute("value"), "a",
michael@0 32 "The first property's name is correct.");
michael@0 33 is(tooltip.querySelectorAll(".variables-view-property .value")[0].getAttribute("value"), "1",
michael@0 34 "The first property's value is correct.");
michael@0 35
michael@0 36 is(tooltip.querySelectorAll(".variables-view-property .name")[1].getAttribute("value"), "b",
michael@0 37 "The second property's name is correct.");
michael@0 38 is(tooltip.querySelectorAll(".variables-view-property .value")[1].getAttribute("value"), "\"beta\"",
michael@0 39 "The second property's value is correct.");
michael@0 40
michael@0 41 is(tooltip.querySelectorAll(".variables-view-property .name")[2].getAttribute("value"), "c",
michael@0 42 "The third property's name is correct.");
michael@0 43 is(tooltip.querySelectorAll(".variables-view-property .value")[2].getAttribute("value"), "3",
michael@0 44 "The third property's value is correct.");
michael@0 45
michael@0 46 is(tooltip.querySelectorAll(".variables-view-property .name")[3].getAttribute("value"), "d",
michael@0 47 "The fourth property's name is correct.");
michael@0 48 is(tooltip.querySelectorAll(".variables-view-property .value")[3].getAttribute("value"), "false",
michael@0 49 "The fourth property's value is correct.");
michael@0 50
michael@0 51 is(tooltip.querySelectorAll(".variables-view-property .name")[4].getAttribute("value"), "e",
michael@0 52 "The fifth property's name is correct.");
michael@0 53 is(tooltip.querySelectorAll(".variables-view-property .value")[4].getAttribute("value"), "null",
michael@0 54 "The fifth property's value is correct.");
michael@0 55
michael@0 56 is(tooltip.querySelectorAll(".variables-view-property .name")[5].getAttribute("value"), "f",
michael@0 57 "The sixth property's name is correct.");
michael@0 58 is(tooltip.querySelectorAll(".variables-view-property .value")[5].getAttribute("value"), "undefined",
michael@0 59 "The sixth property's value is correct.");
michael@0 60
michael@0 61 is(tooltip.querySelectorAll(".variables-view-property .name")[6].getAttribute("value"), "__proto__",
michael@0 62 "The seventh property's name is correct.");
michael@0 63 is(tooltip.querySelectorAll(".variables-view-property .value")[6].getAttribute("value"), "Object",
michael@0 64 "The seventh property's value is correct.");
michael@0 65 }
michael@0 66
michael@0 67 // Allow this generator function to yield first.
michael@0 68 executeSoon(() => debuggee.start());
michael@0 69 yield waitForSourceAndCaretAndScopes(panel, ".html", 24);
michael@0 70
michael@0 71 // Inspect variable.
michael@0 72 yield openVarPopup(panel, { line: 17, ch: 12 }, true);
michael@0 73 verifyContents();
michael@0 74
michael@0 75 yield resumeDebuggerThenCloseAndFinish(panel);
michael@0 76 });
michael@0 77 }

mercurial