blob: e59868b455dbccd3132e9ae5f2dfcb043cae0033 [file] [log] [blame]
<html>
<head>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script>
function test()
{
function createMockScript(id, source, range)
{
range = range || [0, 0, 100, 0];
return {
requestContent: function(callback)
{
callback(source, false, "text/javascript");
},
get lineOffset() { return range[0]; },
get columnOffset() { return range[1]; },
get endLine() { return range[2]; },
get endColumn() { return range[3]; }
};
}
InspectorTest.runTestSuite([
function testConcatenatedScriptsContentProvider(next)
{
var scripts = [];
scripts.push(createMockScript("1", "\nfunction baz()\n{\n return 0;\n}\n", [3, 20, 7, 0]));
scripts.push(createMockScript("2", "function foo() { return 0; }", [0, 10, 0, 38]));
scripts.push(createMockScript("3", "function bar() { return 0; }", [1, 70, 1, 98]));
scripts.push(createMockScript("4", "this should not appear in displayed content", [0, 20, 0, 63]));
var contentProvider = new WebInspector.ConcatenatedScriptsContentProvider(scripts);
function didRequestContent(content, contentEncoded, mimeType)
{
InspectorTest.assertEquals("text/html", mimeType);
InspectorTest.addResult(content);
next();
}
contentProvider.requestContent(didRequestContent);
}
]);
};
</script>
</head>
<body onload="runTest()">
<p>Tests ContentProvider implementations.</p>
</body>
</html>