OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
4 <script src="../../http/tests/inspector/console-test.js"></script> | 4 <script src="../../http/tests/inspector/console-test.js"></script> |
5 <script> | 5 <script> |
6 | 6 |
7 // Global Values | 7 // Global Values |
8 var globals = []; | 8 var globals = []; |
9 | 9 |
10 function log(current) | 10 function log(current) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 var valuedAttribute = document.createAttribute("attr"); | 45 var valuedAttribute = document.createAttribute("attr"); |
46 valuedAttribute.value = "value"; | 46 valuedAttribute.value = "value"; |
47 var existingAttribute = document.getElementById("x").attributes[0]; | 47 var existingAttribute = document.getElementById("x").attributes[0]; |
48 var throwingLengthGetter = {get length() { throw "Length called"; }}; | 48 var throwingLengthGetter = {get length() { throw "Length called"; }}; |
49 var objectWithNonEnumerables = Object.create({ foo: 1 }, { | 49 var objectWithNonEnumerables = Object.create({ foo: 1 }, { |
50 getFoo: { value: function() { return this.foo; } }, | 50 getFoo: { value: function() { return this.foo; } }, |
51 bar: { get: function() { return this.bar; }, set: function(x) { this.bar
= x; } } | 51 bar: { get: function() { return this.bar; }, set: function(x) { this.bar
= x; } } |
52 }); | 52 }); |
53 var negZero = 1 / Number.NEGATIVE_INFINITY; | 53 var negZero = 1 / Number.NEGATIVE_INFINITY; |
54 | 54 |
55 var arrayWithNonIndexOverflow = [1,2,3,4]; | |
56 for (var i = 0; i < 6; ++i) | |
57 arrayWithNonIndexOverflow["index" + i] = i; | |
58 | |
59 globals = [ | 55 globals = [ |
60 regex1, regex2, str, str2, error, errorWithMessage, node, func, multilin
efunc, num, linkify, | 56 regex1, regex2, str, str2, error, errorWithMessage, node, func, multilin
efunc, num, linkify, |
61 null, undefined, valuelessAttribute, valuedAttribute, existingAttribute,
throwingLengthGetter, | 57 null, undefined, valuelessAttribute, valuedAttribute, existingAttribute,
throwingLengthGetter, |
62 NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, array, arrayWit
hNonIndexOverflow, {}, | 58 NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, array, {}, [fun
ction() {}], bar, svg, |
63 [function() {}], bar, svg, objectWithNonEnumerables, negZero, Object.cre
ate(null), Object, Object.prototype | 59 objectWithNonEnumerables, negZero, Object.create(null), Object, Object.p
rototype |
64 ]; | 60 ]; |
65 | 61 |
66 runTest(); | 62 runTest(); |
67 } | 63 } |
68 | 64 |
69 function test() | 65 function test() |
70 { | 66 { |
71 InspectorTest.evaluateInPage("globals.length", loopOverGlobals.bind(this, 0)
); | 67 InspectorTest.evaluateInPage("globals.length", loopOverGlobals.bind(this, 0)
); |
72 | 68 |
73 function loopOverGlobals(current, total) | 69 function loopOverGlobals(current, total) |
74 { | 70 { |
75 function advance() | 71 function advance() |
76 { | 72 { |
77 var next = current + 1; | 73 var next = current + 1; |
78 if (next == total.description) { | 74 if (next == total.description) { |
79 InspectorTest.expandConsoleMessages(); | 75 InspectorTest.expandConsoleMessages(); |
80 InspectorTest.runAfterPendingDispatches(finish); | 76 InspectorTest.runAfterPendingDispatches(finish); |
81 } else { | 77 } else { |
82 loopOverGlobals(next, total); | 78 loopOverGlobals(next, total); |
83 } | 79 } |
84 } | 80 } |
85 | 81 |
86 function finish() | 82 function finish() |
87 { | 83 { |
88 var text = InspectorTest.textContentWithLineBreaks(WebInspector.cons
oleView.topGroup.element); | 84 InspectorTest.dumpConsoleMessages(); |
89 text = text.replace(/\bVM\d+/g, "VM"); | |
90 InspectorTest.addResult(text); | |
91 InspectorTest.completeTest(); | 85 InspectorTest.completeTest(); |
92 } | 86 } |
93 | 87 |
94 InspectorTest.evaluateInPage("log(" + current + ")"); | 88 InspectorTest.evaluateInPage("log(" + current + ")"); |
95 InspectorTest.runAfterPendingDispatches(evalInConsole); | 89 InspectorTest.runAfterPendingDispatches(evalInConsole); |
96 function evalInConsole() | 90 function evalInConsole() |
97 { | 91 { |
98 InspectorTest.evaluateInConsole("globals[" + current + "]"); | 92 InspectorTest.evaluateInConsole("globals[" + current + "]"); |
99 InspectorTest.runAfterPendingDispatches(advance); | 93 InspectorTest.runAfterPendingDispatches(advance); |
100 } | 94 } |
101 } | 95 } |
102 } | 96 } |
103 </script> | 97 </script> |
104 </head> | 98 </head> |
105 | 99 |
106 <body onload="onload()"> | 100 <body onload="onload()"> |
107 <div id="x"></div> | 101 <div id="x"></div> |
108 <p id="p">Tests that console logging dumps proper messages.</p> | 102 <p id="p">Tests that console logging dumps proper messages.</p> |
109 </body> | 103 </body> |
110 <svg id="svg-node"></svg> | 104 <svg id="svg-node"></svg> |
111 </html> | 105 </html> |
OLD | NEW |