Tests that all inlined scripts from the same document are shown in the same source frame with html script tags. Bug 54544.

Script source was shown.
Script execution paused.
Call stack:
    0) f1 (debug-inlined-scripts.html:3)
    1)  (debug-inlined-scripts.html:3)
Call stack status: Paused on breakpoint
==Source frame contents start==
<html>
<head>
  <script>  function f1() { return 0; }; f1();  </script>     <script>function f2() { return 0; }</script><script>
function f3() { return 0; }
</script>

<script>
function f4()
{
    return 0;
}
f4();
</script>

<script src="../../../http/tests/inspector/inspector-test.js"></script>
<script src="../../../http/tests/inspector/debugger-test.js"></script>

<script>

var test = function()
{
    var panel = UI.panels.sources;
    InspectorTest.startDebuggerTest(step1, true);

    function callstackStatus()
    {
        var statusElement = panel.element.querySelector(".paused-message");
        return statusElement ? statusElement.deepTextContent() : "not found";
    }

    function step1()
    {
        InspectorTest.showScriptSource("debug-inlined-scripts.html", step2);
    }

    function step2(sourceFrame)
    {
        InspectorTest.addResult("Script source was shown.");
        InspectorTest.prepareSourceFrameForBreakpointTest(sourceFrame);

        InspectorTest.setBreakpoint(sourceFrame, 2, "", true);
        InspectorTest.setBreakpoint(sourceFrame, 9, "", true);

        InspectorTest.waitJavaScriptSourceFrameBreakpoints(sourceFrame)
            .then(() => {
                InspectorTest.reloadPage(() => InspectorTest.completeDebuggerTest());
            });

        InspectorTest.waitUntilPaused(step3);
    }

    function step3(callFrames)
    {
        InspectorTest.addResult("Script execution paused.");
        InspectorTest.captureStackTrace(callFrames);
        InspectorTest.addResult("Call stack status: " + callstackStatus());
        InspectorTest.showScriptSource("debug-inlined-scripts.html", step4);
    }

    function step4(sourceFrame)
    {
        InspectorTest.dumpSourceFrameContents(sourceFrame);
        InspectorTest.resumeExecution(InspectorTest.waitUntilPaused.bind(null, step5));
    }

    function step5(callFrames)
    {
        if (callFrames[0].location().lineNumber !== 9) {
            InspectorTest.resumeExecution(InspectorTest.waitUntilPaused.bind(null, step5));
            return;
        }

        InspectorTest.addResult("Script execution paused.");
        InspectorTest.captureStackTrace(callFrames);
        InspectorTest.showScriptSource("debug-inlined-scripts.html", step6);
    }

    function step6(sourceFrame)
    {
        InspectorTest.dumpSourceFrameContents(sourceFrame);
        InspectorTest.resumeExecution(InspectorTest.waitUntilPaused.bind(null, step7));
    }

    function step7()
    {
        InspectorTest.resumeExecution(InspectorTest.waitUntilPaused.bind(null, step5));
    }
}

</script>

</head>

<body onload="runTest()">
<p>
Tests that all inlined scripts from the same document are shown in the same source frame with html script tags.
<a href="https://bugs.webkit.org/show_bug.cgi?id=54544">Bug 54544.</a>
</p>

</body>
</html>

==Source frame contents end==
Script execution paused.
Call stack:
    0) f4 (debug-inlined-scripts.html:10)
    1)  (debug-inlined-scripts.html:12)
==Source frame contents start==
<html>
<head>
  <script>  function f1() { return 0; }; f1();  </script>     <script>function f2() { return 0; }</script><script>
function f3() { return 0; }
</script>

<script>
function f4()
{
    return 0;
}
f4();
</script>

<script src="../../../http/tests/inspector/inspector-test.js"></script>
<script src="../../../http/tests/inspector/debugger-test.js"></script>

<script>

var test = function()
{
    var panel = UI.panels.sources;
    InspectorTest.startDebuggerTest(step1, true);

    function callstackStatus()
    {
        var statusElement = panel.element.querySelector(".paused-message");
        return statusElement ? statusElement.deepTextContent() : "not found";
    }

    function step1()
    {
        InspectorTest.showScriptSource("debug-inlined-scripts.html", step2);
    }

    function step2(sourceFrame)
    {
        InspectorTest.addResult("Script source was shown.");
        InspectorTest.prepareSourceFrameForBreakpointTest(sourceFrame);

        InspectorTest.setBreakpoint(sourceFrame, 2, "", true);
        InspectorTest.setBreakpoint(sourceFrame, 9, "", true);

        InspectorTest.waitJavaScriptSourceFrameBreakpoints(sourceFrame)
            .then(() => {
                InspectorTest.reloadPage(() => InspectorTest.completeDebuggerTest());
            });

        InspectorTest.waitUntilPaused(step3);
    }

    function step3(callFrames)
    {
        InspectorTest.addResult("Script execution paused.");
        InspectorTest.captureStackTrace(callFrames);
        InspectorTest.addResult("Call stack status: " + callstackStatus());
        InspectorTest.showScriptSource("debug-inlined-scripts.html", step4);
    }

    function step4(sourceFrame)
    {
        InspectorTest.dumpSourceFrameContents(sourceFrame);
        InspectorTest.resumeExecution(InspectorTest.waitUntilPaused.bind(null, step5));
    }

    function step5(callFrames)
    {
        if (callFrames[0].location().lineNumber !== 9) {
            InspectorTest.resumeExecution(InspectorTest.waitUntilPaused.bind(null, step5));
            return;
        }

        InspectorTest.addResult("Script execution paused.");
        InspectorTest.captureStackTrace(callFrames);
        InspectorTest.showScriptSource("debug-inlined-scripts.html", step6);
    }

    function step6(sourceFrame)
    {
        InspectorTest.dumpSourceFrameContents(sourceFrame);
        InspectorTest.resumeExecution(InspectorTest.waitUntilPaused.bind(null, step7));
    }

    function step7()
    {
        InspectorTest.resumeExecution(InspectorTest.waitUntilPaused.bind(null, step5));
    }
}

</script>

</head>

<body onload="runTest()">
<p>
Tests that all inlined scripts from the same document are shown in the same source frame with html script tags.
<a href="https://bugs.webkit.org/show_bug.cgi?id=54544">Bug 54544.</a>
</p>

</body>
</html>

==Source frame contents end==
Page reloaded.

