Index: third_party/WebKit/LayoutTests/http/tests/inspector/devtools-js/console-clear.js |
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/devtools-js/console-clear.js b/third_party/WebKit/LayoutTests/http/tests/inspector/devtools-js/console-clear.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..77255f7ddafb35cdf639ee8096369d9cb7cf5438 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/devtools-js/console-clear.js |
@@ -0,0 +1,29 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+TestRunner.addResult("Tests that console is cleared upon requestClearMessages call.\n"); |
dgozman
2017/04/25 21:08:28
nit: let's have an empty line after copyright.
chenwilliam
2017/06/15 01:01:05
Done.
|
+ |
+TestRunner.loadPanels(["console"]) |
chenwilliam
2017/04/25 01:09:07
We can make this even fancier and wrap each test s
dgozman
2017/04/25 21:08:28
I'm all for it. It would make reusing frontend for
chenwilliam
2017/06/15 01:01:05
Done.
|
+ .then(() => TestRunner.loadLazyModules(["source_frame"])) |
dgozman
2017/04/25 21:08:28
Why do we do this? I'd prefer this to be handled b
chenwilliam
2017/06/15 01:01:05
This was to reduce flakiness: https://codereview.c
|
+ .then(test); |
+ |
+function log() { |
+ // Fill console. |
+ console.log("one"); |
+ console.log("two"); |
+ console.log("three"); |
+} |
+ |
+async function test() { |
+ await TestRunner.evaluateInPagePromise(`(${log.toString()})()`); |
+ TestRunner.addResult("=== Before clear ==="); |
+ TestRunner.dumpConsoleMessages(); |
+ |
+ Console.ConsoleView.clearConsole(); |
+ TestRunner.deprecatedRunAfterPendingDispatches(callback); |
+ function callback() { |
+ TestRunner.addResult("=== After clear ==="); |
+ TestRunner.dumpConsoleMessages(); |
+ TestRunner.completeTest(); |
+ } |
+} |