Skip to content

Commit

Permalink
[devtools] Import test runners in http/tests/devtools/sources/debugger
Browse files Browse the repository at this point in the history
This CL replaces 'TestRunner.loadTestModule' calls with import
statements.

The CL was fully auto-generated by a small regex search&replace script.

R=jarin@chromium.org

Bug: 1442410
Change-Id: Iad08a1d11499557fc7ee134d636f96c3e808adc9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4561387
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1150384}
  • Loading branch information
szuend authored and Chromium LUCI CQ committed May 30, 2023
1 parent fb0023f commit 74dacd1
Show file tree
Hide file tree
Showing 50 changed files with 277 additions and 140 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {TestRunner} from 'test_runner';
import {SourcesTestRunner} from 'sources_test_runner';

(async function() {
TestRunner.addResult(
`Tests breakpoint in anonymous script with source map on reload.`);
await TestRunner.loadLegacyModule('sources'); await TestRunner.loadTestModule('sources_test_runner');
await TestRunner.loadLegacyModule('sources');
await TestRunner.showPanel('sources');
await SourcesTestRunner.startDebuggerTestPromise();
TestRunner.navigatePromise(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ Tests asynchronous call stacks for fetch.
Set timer for test function.
Captured call stacks in no particular order:
Call stack:
0) chained1 (async-callstack-fetch.js:18)
0) chained1 (async-callstack-fetch.js:21)
[Promise.then]
0) doFetch (async-callstack-fetch.js:17)
0) doFetch (async-callstack-fetch.js:20)
[setTimeout]
0) testFunction (async-callstack-fetch.js:12)
0) testFunction (async-callstack-fetch.js:15)
[setTimeout]
0) scheduleTestFunction <omitted>
<... skipped remaining frames ...>

Call stack:
0) chained4 (async-callstack-fetch.js:22)
0) chained4 (async-callstack-fetch.js:25)
[Promise.then]
0) doFetch (async-callstack-fetch.js:21)
0) doFetch (async-callstack-fetch.js:24)
[setTimeout]
0) testFunction (async-callstack-fetch.js:12)
0) testFunction (async-callstack-fetch.js:15)
[setTimeout]
0) scheduleTestFunction <omitted>
<... skipped remaining frames ...>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {TestRunner} from 'test_runner';
import {SourcesTestRunner} from 'sources_test_runner';

(async function() {
TestRunner.addResult(`Tests asynchronous call stacks for fetch.\n`);
await TestRunner.loadLegacyModule('sources'); await TestRunner.loadTestModule('sources_test_runner');
await TestRunner.loadLegacyModule('sources');
await TestRunner.showPanel('sources');
await TestRunner.evaluateInPagePromise(`
function testFunction()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
Tests asynchronous call stacks printed in console for a Network.Initiator.

Set timer for test function.
async-callstack-network-initiator.js:14 Console was cleared
async-callstack-network-initiator.js:32 POST http://127.0.0.1:8000/failure/foo 404 (Not Found)
async-callstack-network-initiator.js:18 Console was cleared
async-callstack-network-initiator.js:36 POST http://127.0.0.1:8000/failure/foo 404 (Not Found)

sendXHR @ async-callstack-network-initiator.js:32
sendXHR @ async-callstack-network-initiator.js:36

timeout2 @ async-callstack-network-initiator.js:25
timeout2 @ async-callstack-network-initiator.js:29

setTimeout (async)

timeout1 @ async-callstack-network-initiator.js:20
timeout1 @ async-callstack-network-initiator.js:24

setTimeout (async)

testFunction @ async-callstack-network-initiator.js:15
testFunction @ async-callstack-network-initiator.js:19

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Tests asynchronous network initiator for image loaded from JS.

async-callstack-network-initiator-image.js:18
async-callstack-network-initiator-image.js:20

Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {TestRunner} from 'test_runner';
import {SourcesTestRunner} from 'sources_test_runner';
import {ConsoleTestRunner} from 'console_test_runner';
import {NetworkTestRunner} from 'network_test_runner';

(async function() {
TestRunner.addResult(`Tests asynchronous network initiator for image loaded from JS.\n`);
await TestRunner.loadLegacyModule('sources');
await TestRunner.loadTestModule('sources_test_runner');
await TestRunner.loadLegacyModule('console');
await TestRunner.loadTestModule('console_test_runner');
await TestRunner.loadTestModule('network_test_runner');
await TestRunner.loadLegacyModule('components');
await TestRunner.showPanel('sources');
await TestRunner.evaluateInPagePromise(`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {TestRunner} from 'test_runner';
import {SourcesTestRunner} from 'sources_test_runner';
import {ConsoleTestRunner} from 'console_test_runner';

(async function() {
TestRunner.addResult(`Tests asynchronous call stacks printed in console for a Network.Initiator.\n`);
await TestRunner.loadLegacyModule('sources'); await TestRunner.loadTestModule('sources_test_runner');
await TestRunner.loadLegacyModule('console'); await TestRunner.loadTestModule('console_test_runner');
await TestRunner.loadLegacyModule('sources');
await TestRunner.loadLegacyModule('console');
await TestRunner.showPanel('sources');
await TestRunner.evaluateInPagePromise(`
function testFunction()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {TestRunner} from 'test_runner';
import {SourcesTestRunner} from 'sources_test_runner';

(async function() {
TestRunner.addResult(
`Tests that all inlined modules from the same document are shown in the same source frame with html script tags. Bug 1338257.\n`);
await TestRunner.loadLegacyModule('sources');
await TestRunner.loadTestModule('sources_test_runner');
await TestRunner.showPanel('sources');

await TestRunner.navigatePromise('resources/inline-modules.html');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {TestRunner} from 'test_runner';
import {SourcesTestRunner} from 'sources_test_runner';

(async function() {
TestRunner.addResult(
`Tests that all inlined scripts from the same document are shown in the same source frame with html script tags. Bug 54544.\n`);
await TestRunner.loadLegacyModule('sources'); await TestRunner.loadTestModule('sources_test_runner');
await TestRunner.loadLegacyModule('sources');
await TestRunner.showPanel('sources');

await TestRunner.navigatePromise('resources/inline-scripts.html');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {TestRunner} from 'test_runner';
import {SourcesTestRunner} from 'sources_test_runner';

(async function() {
TestRunner.addResult(
`Tests that all inlined scripts from the same document are shown in the same source frame with html script tags.`);
await TestRunner.loadLegacyModule('sources'); await TestRunner.loadTestModule('sources_test_runner');
await TestRunner.loadLegacyModule('sources');
await TestRunner.showPanel('sources');
await TestRunner.navigatePromise('resources/debug-inline-scripts.html');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {TestRunner} from 'test_runner';
import {SourcesTestRunner} from 'sources_test_runner';
import {ConsoleTestRunner} from 'console_test_runner';

(async function() {
TestRunner.addResult(
`Tests that debugger won't stop on syntax errors even if "pause on uncaught exceptions" is on.\n`);
await TestRunner.loadLegacyModule('sources'); await TestRunner.loadTestModule('sources_test_runner');
await TestRunner.loadLegacyModule('console'); await TestRunner.loadTestModule('console_test_runner');
await TestRunner.loadLegacyModule('sources');
await TestRunner.loadLegacyModule('console');
await TestRunner.showPanel('sources');

SourcesTestRunner.startDebuggerTest(step1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {TestRunner} from 'test_runner';
import {SourcesTestRunner} from 'sources_test_runner';

(async function() {
TestRunner.addResult(`Tests separate compilation and run.\n`);
await TestRunner.loadLegacyModule('sources'); await TestRunner.loadTestModule('sources_test_runner');
await TestRunner.loadLegacyModule('sources');
await TestRunner.showPanel('sources');

function printExceptionDetails(exceptionDetails) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {TestRunner} from 'test_runner';
import {SourcesTestRunner} from 'sources_test_runner';

(async function() {
TestRunner.addResult(
`Tests that debugging a page where Object prototype has a cyclic reference won't crash the browser.Bug 43558\n`);
await TestRunner.loadLegacyModule('sources'); await TestRunner.loadTestModule('sources_test_runner');
await TestRunner.loadLegacyModule('sources');
await TestRunner.showPanel('sources');
await TestRunner.evaluateInPagePromise(`
Object.prototype.cyclicRef = Object.prototype;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {TestRunner} from 'test_runner';
import {SourcesTestRunner} from 'sources_test_runner';

(async function() {
TestRunner.addResult(`Tests that breakpoints are successfully restored after debugger disabling.\n`);
await TestRunner.loadLegacyModule('sources'); await TestRunner.loadTestModule('sources_test_runner');
await TestRunner.loadLegacyModule('sources');
await TestRunner.showPanel('sources');
await TestRunner.evaluateInPagePromise(`
function testFunction()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {TestRunner} from 'test_runner';
import {SourcesTestRunner} from 'sources_test_runner';

(async function() {
TestRunner.addResult(`Tests ES6 harmony scope sections.\n`);
await TestRunner.loadLegacyModule('sources'); await TestRunner.loadTestModule('sources_test_runner');
await TestRunner.loadLegacyModule('sources');
await TestRunner.showPanel('sources');
await TestRunner.loadHTML(`
<input type="button" onclick="testFunction()" value="Test">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {TestRunner} from 'test_runner';
import {SourcesTestRunner} from 'sources_test_runner';

(async function() {
TestRunner.addResult(`Tests evaluation in minified scripts.\n`);
await TestRunner.loadLegacyModule('sources'); await TestRunner.loadTestModule('sources_test_runner');
await TestRunner.loadLegacyModule('sources');
await TestRunner.showPanel('sources');
await TestRunner.addScriptTag('resources/resolve-expressions-compressed.js');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {TestRunner} from 'test_runner';
import {SourcesTestRunner} from 'sources_test_runner';

(async function() {
TestRunner.addResult(
`Tests that object's [[Prototype]] property is present in object properties section when script is paused on a breakpoint.Bug 41214\n`);
await TestRunner.loadLegacyModule('sources'); await TestRunner.loadTestModule('sources_test_runner');
await TestRunner.loadLegacyModule('sources');
await TestRunner.showPanel('sources');
await TestRunner.evaluateInPagePromise(`
function C()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {TestRunner} from 'test_runner';
import {SourcesTestRunner} from 'sources_test_runner';

(async function() {
TestRunner.addResult(`Tests "reload" from within inspector window while on pause.\n`);
await TestRunner.loadLegacyModule('sources'); await TestRunner.loadTestModule('sources_test_runner');
await TestRunner.loadLegacyModule('sources');
await TestRunner.showPanel('sources');
await TestRunner.evaluateInPagePromise(`
function testFunction()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {TestRunner} from 'test_runner';
import {SourcesTestRunner} from 'sources_test_runner';

(async function() {
TestRunner.addResult(`Tests evaluation in webpack bundled scripts with 'line-by'line' source maps.\n`);
await TestRunner.loadLegacyModule('sources'); await TestRunner.loadTestModule('sources_test_runner');
await TestRunner.loadLegacyModule('sources');
await TestRunner.showPanel('sources');

// Bundle created using `npx webpack` with 'cheap-module-source-map'.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ Tests function's return value reported from backend.

Set timer for test function.
Call stack:
0) testFunction (debugger-return-value.js:19)
0) testFunction (debugger-return-value.js:22)
<return>: 10

Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {TestRunner} from 'test_runner';
import {SourcesTestRunner} from 'sources_test_runner';

(async function() {
TestRunner.addResult(`Tests function's return value reported from backend.\n`);
await TestRunner.loadLegacyModule('sources'); await TestRunner.loadTestModule('sources_test_runner');
await TestRunner.loadLegacyModule('sources');
await TestRunner.showPanel('sources');
await TestRunner.evaluateInPagePromise(`
function d()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {TestRunner} from 'test_runner';
import {SourcesTestRunner} from 'sources_test_runner';

(async function() {
TestRunner.addResult(`Tests resolving variable names via source maps.\n`);
await TestRunner.loadLegacyModule('sources'); await TestRunner.loadTestModule('sources_test_runner');
await TestRunner.loadLegacyModule('sources');
await TestRunner.showPanel('sources');
await TestRunner.addScriptTag('resources/resolve-variable-names-compressed.js');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {TestRunner} from 'test_runner';
import {SourcesTestRunner} from 'sources_test_runner';

(async function() {
TestRunner.addResult(`Tests resolving variable names via source maps.\n`);
await TestRunner.loadLegacyModule('sources'); await TestRunner.loadTestModule('sources_test_runner');
await TestRunner.loadLegacyModule('sources');
await TestRunner.showPanel('sources');
await TestRunner.addScriptTag('resources/resolve-identifiers.js');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {TestRunner} from 'test_runner';
import {SourcesTestRunner} from 'sources_test_runner';

(async function() {
TestRunner.addResult(`Tests resolving this object name via source maps.\n`);
await TestRunner.loadLegacyModule('sources'); await TestRunner.loadTestModule('sources_test_runner');
await TestRunner.loadLegacyModule('sources');
await TestRunner.showPanel('sources');
await TestRunner.addScriptTag('resources/resolve-this.js');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {TestRunner} from 'test_runner';
import {SourcesTestRunner} from 'sources_test_runner';

(async function() {
TestRunner.addResult(`Tests that scripts list is cleared upon page reload.\n`);
await TestRunner.loadLegacyModule('sources'); await TestRunner.loadTestModule('sources_test_runner');
await TestRunner.loadLegacyModule('sources');
await TestRunner.showPanel('sources');

TestRunner.evaluateInPage('function foo() {} //# sourceURL=dummyScript.js', step1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {TestRunner} from 'test_runner';
import {SourcesTestRunner} from 'sources_test_runner';

(async function() {
TestRunner.addResult(
`Tests that valid parsed script notifications are received by front-end.`);
await TestRunner.loadLegacyModule('sources'); await TestRunner.loadTestModule('sources_test_runner');
await TestRunner.loadLegacyModule('sources');
await TestRunner.showPanel('sources');
await TestRunner.navigatePromise('resources/debugger-scripts.html');

Expand Down

0 comments on commit 74dacd1

Please sign in to comment.