blob: e58289c4f94a9167dfa065ee97525c5c229ead26 [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();
Runtime.experiments.enableForTest("persistence2");
var sourcesNavigator = new Sources.SourcesNavigatorView();
sourcesNavigator.show(UI.inspectorView.element);
var fs = new InspectorTest.TestFileSystem("file:///var/www");
var fsEntry = InspectorTest.addFooJSFile(fs);
InspectorTest.runTestSuite([
function addFileSystem(next)
{
fs.reportCreated(next);
},
function waitForUISourceCodes(next)
{
var promises = [
InspectorTest.waitForUISourceCode("foo.js", Workspace.projectTypes.Network),
InspectorTest.waitForUISourceCode("foo.js", Workspace.projectTypes.FileSystem)
];
Promise.all(promises).then(onUISourceCodesAdded);
function onUISourceCodesAdded()
{
InspectorTest.dumpNavigatorView(sourcesNavigator, true);
next();
}
},
function addFileMapping(next)
{
testMapping.addBinding("foo.js");
InspectorTest.waitForBinding("foo.js").then(onBindingCreated);
function onBindingCreated(binding)
{
InspectorTest.dumpNavigatorView(sourcesNavigator, true);
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.dumpNavigatorView(sourcesNavigator, true);
next();
}
},
]);
};
</script>
</head>
<body onload="runTest()">
<p>Verify that navigator view removes mapped UISourceCodes.</p>
</body>
</html>