// Copyright 2017 The Chromium Authors
// 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 {ConsoleTestRunner} from 'console_test_runner';
import {SourcesTestRunner} from 'sources_test_runner';
(async function() {
TestRunner.addResult(
`Test that evaluation in the context of top frame will not be blocked by Content-Security-Policy. Bug 77203.\n`);
await TestRunner.showPanel('sources');
await TestRunner.evaluateInPagePromise(`
function testFunction()
{
var foo = 2012;
debugger;
}
`);
SourcesTestRunner.startDebuggerTest(step1);
function step1() {
SourcesTestRunner.runTestFunctionAndWaitUntilPaused(step2);
}
function step2() {
ConsoleTestRunner.evaluateInConsole('foo', step3);
}
function step3(result) {
TestRunner.addResult(
'Evaluated in console in the top frame context: foo = ' + result);
SourcesTestRunner.completeDebuggerTest();
}
})();