| 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 function test() | 7 function test() |
| 8 { | 8 { |
| 9 InspectorTest.addConsoleViewSniffer(addMessageSniffer, true); | 9 InspectorTest.addSniffer(WebInspector.ConsoleViewMessage.prototype, "_format
tedParameterAsNodeForTest", formattedParameter); |
| 10 InspectorTest.addConsoleViewSniffer(messageSniffer, true); |
| 10 | 11 |
| 11 InspectorTest.evaluateInConsole("$x('42')"); // number | 12 InspectorTest.evaluateInConsole("$x('42')"); // number |
| 12 InspectorTest.evaluateInConsole("$x('name(/html)')"); // string | 13 InspectorTest.evaluateInConsole("$x('name(/html)')"); // string |
| 13 InspectorTest.evaluateInConsole("$x('not(42)')"); // boolean | 14 InspectorTest.evaluateInConsole("$x('not(42)')"); // boolean |
| 14 InspectorTest.evaluateInConsole("$x('/html/body/p').length"); // node iterat
or | 15 InspectorTest.evaluateInConsole("$x('/html/body/p').length"); // node iterat
or |
| 15 InspectorTest.evaluateInConsole("$x('//a/@href')[0]"); // href, should not t
hrow | 16 InspectorTest.evaluateInConsole("$x('//a/@href')[0]"); // href, should not t
hrow |
| 16 InspectorTest.evaluateInPage("console.log('complete')"); // node iterator | 17 InspectorTest.evaluateInPage("console.log('complete')"); // node iterator |
| 17 | 18 |
| 18 function addMessageSniffer(uiMessage) | 19 var completeMessageReceived = false; |
| 20 function messageSniffer(uiMessage) |
| 19 { | 21 { |
| 20 if (uiMessage.toString().indexOf("complete") !== -1) { | 22 if (uiMessage.toString().indexOf("complete") !== -1) { |
| 21 InspectorTest.expandConsoleMessages(waitForObjects); | 23 completeMessageReceived = true; |
| 24 maybeCompleteTest(); |
| 22 } | 25 } |
| 23 } | 26 } |
| 24 | 27 |
| 25 function waitForObjects() | 28 var parameterFormatted = false; |
| 29 function formattedParameter() |
| 26 { | 30 { |
| 27 InspectorTest.waitForRemoteObjectsConsoleMessages(dumpConsoleMessages); | 31 parameterFormatted = true; |
| 32 maybeCompleteTest(); |
| 28 } | 33 } |
| 29 | 34 |
| 30 function dumpConsoleMessages() | 35 function maybeCompleteTest() |
| 31 { | 36 { |
| 32 InspectorTest.dumpConsoleMessages(); | 37 if (parameterFormatted && completeMessageReceived) { |
| 33 InspectorTest.completeTest(); | 38 InspectorTest.dumpConsoleMessages(); |
| 39 InspectorTest.completeTest(); |
| 40 } |
| 34 } | 41 } |
| 35 } | 42 } |
| 36 | 43 |
| 37 </script> | 44 </script> |
| 38 </head> | 45 </head> |
| 39 <a href="http://chromium.org"></a> | 46 <a href="http://chromium.org"></a> |
| 40 <body onload="runTest()"> | 47 <body onload="runTest()"> |
| 41 <p> | 48 <p> |
| 42 Tests $x for iterator and non-iterator types. | 49 Tests $x for iterator and non-iterator types. |
| 43 </p> | 50 </p> |
| 44 | 51 |
| 45 </body> | 52 </body> |
| 46 </html> | 53 </html> |
| OLD | NEW |