1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/debugger/test/browser_dbg_variables-view-override-02.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,68 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +/** 1.8 + * Tests that overridden variables in the VariablesView are styled properly. 1.9 + */ 1.10 + 1.11 +const TAB_URL = EXAMPLE_URL + "doc_scope-variable-2.html"; 1.12 + 1.13 +function test() { 1.14 + Task.spawn(function() { 1.15 + let [tab, debuggee, panel] = yield initDebugger(TAB_URL); 1.16 + let win = panel.panelWin; 1.17 + let events = win.EVENTS; 1.18 + let variables = win.DebuggerView.Variables; 1.19 + 1.20 + // Wait for the hierarchy to be committed by the VariablesViewController. 1.21 + let committedLocalScopeHierarchy = promise.defer(); 1.22 + variables.oncommit = committedLocalScopeHierarchy.resolve; 1.23 + 1.24 + // Allow this generator function to yield first. 1.25 + executeSoon(() => debuggee.test()); 1.26 + yield waitForSourceAndCaretAndScopes(panel, ".html", 23); 1.27 + yield committedLocalScopeHierarchy.promise; 1.28 + 1.29 + let firstScope = variables.getScopeAtIndex(0); 1.30 + let secondScope = variables.getScopeAtIndex(1); 1.31 + let thirdScope = variables.getScopeAtIndex(2); 1.32 + 1.33 + let someVar1 = firstScope.get("a"); 1.34 + let argsVar1 = firstScope.get("arguments"); 1.35 + 1.36 + is(someVar1.target.hasAttribute("overridden"), false, 1.37 + "The first 'a' variable should not be marked as being overridden."); 1.38 + is(argsVar1.target.hasAttribute("overridden"), false, 1.39 + "The first 'arguments' variable should not be marked as being overridden."); 1.40 + 1.41 + // Wait for the hierarchy to be committed by the VariablesViewController. 1.42 + let committedSecondScopeHierarchy = promise.defer(); 1.43 + variables.oncommit = committedSecondScopeHierarchy.resolve; 1.44 + secondScope.expand(); 1.45 + yield committedSecondScopeHierarchy.promise; 1.46 + 1.47 + let someVar2 = secondScope.get("a"); 1.48 + let argsVar2 = secondScope.get("arguments"); 1.49 + 1.50 + is(someVar2.target.hasAttribute("overridden"), true, 1.51 + "The second 'a' variable should be marked as being overridden."); 1.52 + is(argsVar2.target.hasAttribute("overridden"), true, 1.53 + "The second 'arguments' variable should be marked as being overridden."); 1.54 + 1.55 + // Wait for the hierarchy to be committed by the VariablesViewController. 1.56 + let committedThirdScopeHierarchy = promise.defer(); 1.57 + variables.oncommit = committedThirdScopeHierarchy.resolve; 1.58 + thirdScope.expand(); 1.59 + yield committedThirdScopeHierarchy.promise; 1.60 + 1.61 + let someVar3 = thirdScope.get("a"); 1.62 + let argsVar3 = thirdScope.get("arguments"); 1.63 + 1.64 + is(someVar3.target.hasAttribute("overridden"), true, 1.65 + "The third 'a' variable should be marked as being overridden."); 1.66 + is(argsVar3.target.hasAttribute("overridden"), true, 1.67 + "The third 'arguments' variable should be marked as being overridden."); 1.68 + 1.69 + yield resumeDebuggerThenCloseAndFinish(panel); 1.70 + }); 1.71 +}