blob: 9518e730981151668ae2523d876332edae939683 [file] [log] [blame]
// Copyright 2020 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.
(async function() {
TestRunner.addResult(`Tests setting breakpoint when main thread blocks.\n`);
await TestRunner.loadModule('sources_test_runner');
await TestRunner.showPanel('sources');
await TestRunner.navigatePromise('resources/blocking-main-thread.html');
SourcesTestRunner.runDebuggerTestSuite([
async function testSetBreakpoint(next) {
// The debugger plugin needs to be retrieved before pausing, otherwise we
// cannot set a breakpoint on the main thread during pause.
var mainThreadSource = await SourcesTestRunner.showScriptSourcePromise(
'blocking-main-thread.html');
const plugin = SourcesTestRunner.debuggerPlugin(mainThreadSource);
SourcesTestRunner.showScriptSource(
'blocking-main-thread.js', didShowWorkerSource);
async function didShowWorkerSource(sourceFrame) {
await SourcesTestRunner.createNewBreakpoint(sourceFrame, 12, '', true);
await SourcesTestRunner.waitBreakpointSidebarPane();
SourcesTestRunner.dumpBreakpointSidebarPane();
SourcesTestRunner.waitUntilPaused(paused);
TestRunner.addResult('Reloading page.');
TestRunner.reloadPage();
}
async function paused() {
plugin._createNewBreakpoint(10, '', true);
await SourcesTestRunner.waitBreakpointSidebarPane();
SourcesTestRunner.dumpBreakpointSidebarPane();
next();
}
}
]);
})();