| 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 log() | 7 function log() |
| 8 { | 8 { |
| 9 // Fill console. | 9 // Fill console. |
| 10 console.log("one"); | 10 console.log("one"); |
| 11 console.log("two"); | 11 console.log("two"); |
| 12 console.log("three"); | 12 console.log("three"); |
| 13 } | 13 } |
| 14 | 14 |
| 15 log(); | 15 function clearConsoleFromPage() |
| 16 | |
| 17 function foo() | |
| 18 { | 16 { |
| 19 console.clear(); | 17 console.clear(); |
| 20 } | 18 } |
| 21 | 19 |
| 22 async function test() | 20 async function test() |
| 23 { | 21 { |
| 24 InspectorTest.addResult("=== Before clear ==="); | 22 InspectorTest.runTestSuite([ |
| 25 InspectorTest.dumpConsoleMessages(); | 23 async function clearFromConsoleAPI(next) { |
| 24 await InspectorTest.RuntimeAgent.evaluate("log();"); |
| 25 InspectorTest.addResult("=== Before clear ==="); |
| 26 InspectorTest.dumpConsoleMessages(); |
| 26 | 27 |
| 27 await InspectorTest.RuntimeAgent.evaluate("foo();"); | 28 await InspectorTest.RuntimeAgent.evaluate("clearConsoleFromPage();")
; |
| 28 | 29 |
| 29 InspectorTest.addResult("=== After clear ==="); | 30 InspectorTest.addResult("=== After clear ==="); |
| 30 InspectorTest.dumpConsoleMessages(); | 31 InspectorTest.dumpConsoleMessages(); |
| 31 InspectorTest.completeTest(); | 32 next(); |
| 33 }, |
| 34 |
| 35 async function shouldNotClearWithPreserveLog(next) { |
| 36 await InspectorTest.RuntimeAgent.evaluate("log();"); |
| 37 InspectorTest.addResult("=== Before clear ==="); |
| 38 InspectorTest.dumpConsoleMessages(); |
| 39 Common.moduleSetting("preserveConsoleLog").set(true); |
| 40 |
| 41 await InspectorTest.RuntimeAgent.evaluate("clearConsoleFromPage();")
; |
| 42 |
| 43 InspectorTest.addResult("=== After clear ==="); |
| 44 InspectorTest.dumpConsoleMessages(); |
| 45 Common.moduleSetting("preserveConsoleLog").set(false); |
| 46 next(); |
| 47 } |
| 48 ]); |
| 32 } | 49 } |
| 33 | 50 |
| 34 </script> | 51 </script> |
| 35 </head> | 52 </head> |
| 36 | 53 |
| 37 <body onload="runTest()"> | 54 <body onload="runTest()"> |
| 38 <p> | 55 <p> |
| 39 Tests that console is cleared via console.clear() method | 56 Tests that console is cleared via console.clear() method |
| 40 </p> | 57 </p> |
| 41 <a href="https://bugs.webkit.org/show_bug.cgi?id=101021">Bug 101021 </a> | 58 <a href="https://bugs.webkit.org/show_bug.cgi?id=101021">Bug 101021</a> |
| 42 | 59 |
| 43 </body> | 60 </body> |
| 44 </html> | 61 </html> |
| OLD | NEW |