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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/inspector/devtools-js/console/command-line-api.js

Issue 2975523002: DevTools: add console test helpers to new test runner & migrate a console test (Closed)
Patch Set: fix 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 (async function() {
6 TestRunner.addResult('Tests that command line api works.\n');
7
8 await TestRunner.loadModule("console_test_runner");
9 await TestRunner.loadModule("elements_test_runner");
10 await TestRunner.loadPanel("console");
caseq 2017/07/12 01:04:33 I wonder whether these need to be sequential. Woul
chenwilliam 2017/07/12 22:02:57 I a/b tested it (ran this test 100 times) and the
11
12 var expressions = [
13 "String($0)",
14 "$3",
15 "String(keys([3,4]))",
16 "String(values([3,4]))",
17 "String($('#foo'))",
18 "String($('#foo', document.body))",
19 "String($('#foo', 'non-node'))",
20 "String($('#foo', $('#bar')))",
21 "String($$('p'))",
22 "String($$('p', document.body))",
23 "String($('foo'))",
24 "console.assert(keys(window).indexOf('__commandLineAPI') === -1)"
25 ];
26
27 await TestRunner.loadHTML(`
28 <p id="foo">
29 Tests that command line api works.
30 </p><p id="bar"></p>
31 `);
32
33 ElementsTestRunner.selectNodeWithId("foo", step1);
34
35 function step1(node) {
36 var expression = expressions.shift();
37 if (!expression) {
38 step2();
39 return;
40 }
41 Common.console.log("");
42 ConsoleTestRunner.evaluateInConsole(expression, step1);
caseq 2017/07/12 01:04:33 Can we make it return a promise straight away? Als
chenwilliam 2017/07/12 22:02:58 Adding to @dgozman's comment, the plan is to keep
43 }
44
45 function step2() {
46 function assertNoBoundCommandLineAPI() {
47 ["__commandLineAPI", "__scopeChainForEval"].forEach(function(name) {
48 console.assert(!(name in window), "FAIL: Should be no " + name);
49 });
50 }
51 TestRunner.evaluateInPage(assertNoBoundCommandLineAPI, step3);
52 }
53
54 function step3() {
55 ConsoleTestRunner.dumpConsoleMessages();
56 TestRunner.completeTest();
57 }
58 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698