| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="inspector-test.js"></script> | 3 <script src="inspector-test.js"></script> |
| 4 <script src="console-test.js"></script> | 4 <script src="console-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 | 6 |
| 7 function onload() | 7 function onload() |
| 8 { | 8 { |
| 9 runTest(); | 9 runTest(); |
| 10 } | 10 } |
| 11 | 11 |
| 12 function test() | 12 function test() |
| 13 { | 13 { |
| 14 InspectorTest.addSniffer(WebInspector.RuntimeModel.prototype, "_inspectReque
sted", sniffInspect, true); | 14 InspectorTest.addSniffer(SDK.RuntimeModel.prototype, "_inspectRequested", sn
iffInspect, true); |
| 15 | 15 |
| 16 function sniffInspect(objectId, hints) | 16 function sniffInspect(objectId, hints) |
| 17 { | 17 { |
| 18 InspectorTest.addResult("WebInspector.inspect called with: " + objectId.
description); | 18 InspectorTest.addResult("WebInspector.inspect called with: " + objectId.
description); |
| 19 InspectorTest.addResult("WebInspector.inspect's hints are: " + JSON.stri
ngify(Object.keys(hints))); | 19 InspectorTest.addResult("WebInspector.inspect's hints are: " + JSON.stri
ngify(Object.keys(hints))); |
| 20 } | 20 } |
| 21 | 21 |
| 22 function evalAndDump(expression, next) | 22 function evalAndDump(expression, next) |
| 23 { | 23 { |
| 24 InspectorTest.addResult("\n"); | 24 InspectorTest.addResult("\n"); |
| 25 InspectorTest.evaluateInConsole(expression, dumpCallback); | 25 InspectorTest.evaluateInConsole(expression, dumpCallback); |
| 26 function dumpCallback(text) | 26 function dumpCallback(text) |
| 27 { | 27 { |
| 28 InspectorTest.addResult(expression + " = " + text); | 28 InspectorTest.addResult(expression + " = " + text); |
| 29 if (next) | 29 if (next) |
| 30 next(); | 30 next(); |
| 31 } | 31 } |
| 32 } | 32 } |
| 33 | 33 |
| 34 InspectorTest.runTestSuite([ | 34 InspectorTest.runTestSuite([ |
| 35 function testRevealElement(next) | 35 function testRevealElement(next) |
| 36 { | 36 { |
| 37 InspectorTest.addSniffer(WebInspector.Revealer, "revealPromise", ste
p2, true); | 37 InspectorTest.addSniffer(Common.Revealer, "revealPromise", step2, tr
ue); |
| 38 evalAndDump("inspect($('#p1'))"); | 38 evalAndDump("inspect($('#p1'))"); |
| 39 | 39 |
| 40 function step2(node, revealPromise) | 40 function step2(node, revealPromise) |
| 41 { | 41 { |
| 42 if (!(node instanceof WebInspector.RemoteObject)) | 42 if (!(node instanceof SDK.RemoteObject)) |
| 43 return; | 43 return; |
| 44 revealPromise.then(step3); | 44 revealPromise.then(step3); |
| 45 } | 45 } |
| 46 | 46 |
| 47 function step3() | 47 function step3() |
| 48 { | 48 { |
| 49 InspectorTest.addResult("Selected node id: '" + WebInspector.pan
els.elements.selectedDOMNode().getAttribute("id") + "'."); | 49 InspectorTest.addResult("Selected node id: '" + UI.panels.elemen
ts.selectedDOMNode().getAttribute("id") + "'."); |
| 50 next(); | 50 next(); |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 ]); | 53 ]); |
| 54 } | 54 } |
| 55 | 55 |
| 56 </script> | 56 </script> |
| 57 </head> | 57 </head> |
| 58 | 58 |
| 59 <body onload="onload()"> | 59 <body onload="onload()"> |
| 60 <p id="p1"> | 60 <p id="p1"> |
| 61 Tests that inspect() command line api works. | 61 Tests that inspect() command line api works. |
| 62 </p> | 62 </p> |
| 63 | 63 |
| 64 </body> | 64 </body> |
| 65 </html> | 65 </html> |
| OLD | NEW |