blob: b6bf85d3f45bc032ccfddbccf593b4e55ab5e945 [file] [log] [blame]
<html>
<head>
<script src='../inspector-test.js'></script>
<script src='../debugger-test.js'></script>
<script src='../isolated-filesystem-test.js'></script>
<script src='./persistence-test.js'></script>
<script>
function addFooJS() {
var script = document.createElement('script');
script.src = './resources/foo.js';
document.body.appendChild(script);
}
function test()
{
var testMapping = InspectorTest.initializeTestMapping();
var fs = new InspectorTest.TestFileSystem('file:///var/www');
InspectorTest.addFooJSFile(fs);
InspectorTest.runTestSuite([
function addFileSystem(next)
{
fs.reportCreated(next);
},
function addNetworkFooJS(next)
{
InspectorTest.evaluateInPage('addFooJS()');
testMapping.addBinding('foo.js');
InspectorTest.waitForBinding('foo.js').then(next);
},
function setBreakpointInFileSystemUISourceCode(next)
{
InspectorTest.waitForUISourceCode('foo.js', Workspace.projectTypes.FileSystem)
.then(sourceCode => InspectorTest.showUISourceCodePromise(sourceCode))
.then(onSourceFrame);
function onSourceFrame(sourceFrame)
{
InspectorTest.setBreakpoint(sourceFrame, 0, '', true);
InspectorTest.waitBreakpointSidebarPane(true).then(dumpBreakpointSidebarPane).then(next);
}
},
async function reloadPageAndDumpBreakpoints(next)
{
testMapping.removeBinding('foo.js');
await Promise.all([
InspectorTest.waitBreakpointSidebarPane(),
InspectorTest.reloadPagePromise()
]);
testMapping.addBinding('foo.js');
dumpBreakpointSidebarPane();
next();
},
]);
function dumpBreakpointSidebarPane()
{
var paneElement = self.runtime.sharedInstance(Sources.JavaScriptBreakpointsSidebarPane).contentElement;
var empty = paneElement.querySelector('.gray-info-message');
if (empty)
return InspectorTest.textContentWithLineBreaks(empty);
var entries = Array.from(paneElement.querySelectorAll('.breakpoint-entry'));
for (var entry of entries) {
var uiLocation = entry[Sources.JavaScriptBreakpointsSidebarPane._locationSymbol];
InspectorTest.addResult(" " + uiLocation.uiSourceCode.url() +":" + uiLocation.lineNumber);
}
}
};
</script>
</head>
<body onload='runTest()'>
<p>Verify that breakpoints are moved appropriately in case of page reload.</p>
</body>
</html>