Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Side by Side Diff: third_party/WebKit/LayoutTests/inspector/console/console-clear-function.html

Issue 2970313002: DevTools: do not clear console when preserving log (Closed)
Patch Set: Move conditions into one place Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
20 function loadIframeWithClear() {
21 var iframe = document.createElement("iframe");
22 iframe.src = "./resources/clear-function-iframe.html";
23 document.body.appendChild(iframe);
24 }
25
22 async function test() 26 async function test()
23 { 27 {
24 InspectorTest.addResult("=== Before clear ==="); 28 // InspectorTest.completeTest();
25 InspectorTest.dumpConsoleMessages(); 29 InspectorTest.runTestSuite([
30 async function clearFromConsoleAPI(next) {
31 await InspectorTest.RuntimeAgent.evaluate("log();");
32 InspectorTest.addResult("=== Before clear ===");
33 InspectorTest.dumpConsoleMessages();
26 34
27 await InspectorTest.RuntimeAgent.evaluate("foo();"); 35 await InspectorTest.RuntimeAgent.evaluate("clearConsoleFromPage();") ;
28 36
29 InspectorTest.addResult("=== After clear ==="); 37 InspectorTest.addResult("=== After clear ===");
30 InspectorTest.dumpConsoleMessages(); 38 InspectorTest.dumpConsoleMessages();
31 InspectorTest.completeTest(); 39 next();
40 },
41
42 async function shouldNotClearWithPreserveLog(next) {
43 await InspectorTest.RuntimeAgent.evaluate("log();");
44 InspectorTest.addResult("=== Before clear ===");
45 InspectorTest.dumpConsoleMessages();
46 Common.moduleSetting("preserveConsoleLog").set(true);
47
48 await InspectorTest.RuntimeAgent.evaluate("clearConsoleFromPage();") ;
49
50 InspectorTest.addResult("=== After clear ===");
51 InspectorTest.dumpConsoleMessages();
52 Common.moduleSetting("preserveConsoleLog").set(false);
53 next();
54 },
55
56 async function shouldNotClearFromIFrame(next) {
57 await InspectorTest.RuntimeAgent.evaluate("log();");
58 InspectorTest.addResult("=== Before clear ===");
59 InspectorTest.dumpConsoleMessages();
60
61 await InspectorTest.RuntimeAgent.evaluate("loadIframeWithClear();");
62 await InspectorTest.waitUntilMessageReceivedPromise();
63
64 InspectorTest.addResult("=== After iframe loaded ===");
65 InspectorTest.dumpConsoleMessages();
66 next();
67 }
68 ]);
32 } 69 }
33 70
34 </script> 71 </script>
35 </head> 72 </head>
36 73
37 <body onload="runTest()"> 74 <body onload="runTest()">
38 <p> 75 <p>
39 Tests that console is cleared via console.clear() method 76 Tests that console is cleared via console.clear() method
40 </p> 77 </p>
41 <a href="https://bugs.webkit.org/show_bug.cgi?id=101021">Bug 101021 </a> 78 <a href="https://bugs.webkit.org/show_bug.cgi?id=101021">Bug 101021</a>
42 79
43 </body> 80 </body>
44 </html> 81 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698