| 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 function test() | 6 function test() |
| 7 { | 7 { |
| 8 var prompt = WebInspector.ConsoleView.instance()._prompt; | 8 var prompt = WebInspector.ConsoleView.instance()._prompt; |
| 9 InspectorTest.waitUntilConsoleEditorLoaded().then(step1); | 9 InspectorTest.waitUntilConsoleEditorLoaded().then(step1); |
| 10 | 10 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 { | 50 { |
| 51 var promise = Promise.resolve(); | 51 var promise = Promise.resolve(); |
| 52 for (var i = 0; i < tests.length; i++) | 52 for (var i = 0; i < tests.length; i++) |
| 53 promise = promise.then(tests[i]); | 53 promise = promise.then(tests[i]); |
| 54 return promise; | 54 return promise; |
| 55 } | 55 } |
| 56 | 56 |
| 57 function pressEnterAfter(text) | 57 function pressEnterAfter(text) |
| 58 { | 58 { |
| 59 var fulfill; | 59 var fulfill; |
| 60 var ended = false; | |
| 61 var promise = new Promise(x => fulfill = x); | 60 var promise = new Promise(x => fulfill = x); |
| 62 InspectorTest.addConsoleViewSniffer(enterProcessed); | 61 InspectorTest.addSniffer(WebInspector.ConsolePrompt.prototype, "_enterPr
ocessedForTest", enterProcessed); |
| 63 InspectorTest.addSniffer(WebInspector.ConsolePrompt.prototype, "newlineA
ndIndent", enterProcessed); | |
| 64 | 62 |
| 65 prompt.setText(text); | 63 prompt.setText(text); |
| 66 prompt.moveCaretToEndOfPrompt(); | 64 prompt.moveCaretToEndOfPrompt(); |
| 67 prompt.element.dispatchEvent(InspectorTest.createKeyEvent("Enter")); | 65 prompt._enterKeyPressed(InspectorTest.createKeyEvent("Enter")); |
| 68 | |
| 69 return promise; | 66 return promise; |
| 70 | 67 |
| 71 function enterProcessed() | 68 function enterProcessed() |
| 72 { | 69 { |
| 73 if (ended) | |
| 74 return; | |
| 75 ended = true; | |
| 76 InspectorTest.addResult("Text Before Enter:"); | 70 InspectorTest.addResult("Text Before Enter:"); |
| 77 InspectorTest.addResult(text.replace(/ /g, ".")); | 71 InspectorTest.addResult(text.replace(/ /g, ".")); |
| 78 InspectorTest.addResult("Text After Enter:"); | 72 InspectorTest.addResult("Text After Enter:"); |
| 79 InspectorTest.addResult(prompt.text().replace(/ /g, ".") || "<empty>
"); | 73 InspectorTest.addResult(prompt.text().replace(/ /g, ".") || "<empty>
"); |
| 80 InspectorTest.addResult(""); | 74 InspectorTest.addResult(""); |
| 81 fulfill(); | 75 fulfill(); |
| 82 } | 76 } |
| 83 } | 77 } |
| 84 } | 78 } |
| 85 </script> | 79 </script> |
| 86 </head> | 80 </head> |
| 87 <body onload="runTest()"> | 81 <body onload="runTest()"> |
| 88 <p>Tests that the console enters a newline instead of running a command if the c
ommand is incomplete.</p> | 82 <p>Tests that the console enters a newline instead of running a command if the c
ommand is incomplete.</p> |
| 89 </body> | 83 </body> |
| 90 </html> | 84 </html> |
| OLD | NEW |