blob: ed5d1f56c8f4f8be176b9c15573048dc53427667 [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 src="./resources/foo.js"></script>
<script>
function test()
{
var testMapping = InspectorTest.initializeTestMapping();
var fs = new InspectorTest.TestFileSystem("file:///var/www");
var fsEntry = InspectorTest.addFooJSFile(fs);
InspectorTest.runTestSuite([
function addFileSystem(next)
{
fs.reportCreated(next);
},
function setBreakpointInFileSystemUISourceCode(next)
{
InspectorTest.waitForUISourceCode("foo.js", Workspace.projectTypes.FileSystem)
.then(code => InspectorTest.showUISourceCodePromise(code))
.then(onSourceFrame);
function onSourceFrame(sourceFrame)
{
InspectorTest.setBreakpoint(sourceFrame, 0, "", true);
InspectorTest.waitBreakpointSidebarPane().then(InspectorTest.dumpBreakpointSidebarPane).then(next);
}
},
function addFileMapping(next)
{
testMapping.addBinding('foo.js');
InspectorTest.waitForBinding("foo.js").then(onBindingCreated);
function onBindingCreated(binding)
{
InspectorTest.waitBreakpointSidebarPane().then(InspectorTest.dumpBreakpointSidebarPane).then(next);
}
},
function removeFileMapping(next)
{
Persistence.persistence.addEventListener(Persistence.Persistence.Events.BindingRemoved, onBindingRemoved);
testMapping.removeBinding('foo.js');
function onBindingRemoved(event)
{
var binding = event.data;
if (binding.network.name() !== "foo.js")
return
Persistence.persistence.removeEventListener(Persistence.Persistence.Events.BindingRemoved, onBindingRemoved);
InspectorTest.waitBreakpointSidebarPane().then(dumpBreakpointSidebarPane).then(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</p>
</body>
</html>