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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/inspector/devtools-js/console-clear.js

Issue 2837083003: DevTools: create test infrastructure so devtools drives the test (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
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();
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698