3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/debugger-test.js"></script>
5 <script src="resources/script1.js"></script>
6 <script src="resources/script2.js"></script>
7 <script src="resources/script3.js"></script>
13 InspectorTest.runDebuggerTestSuite([
14 function testSourceFramesCount(next)
16 var panel = WebInspector.panels.sources;
17 var select = panel._navigator._filesSelectElement;
18 var sourceFrameCount = 0;
20 InspectorTest.showScriptSource("source-frame-count.html", step2);
24 InspectorTest.showScriptSource("script1.js", step3);
29 InspectorTest.showScriptSource("script2.js", didShowScriptSources);
32 function didShowScriptSources()
34 var alreadyShownURLs = {};
35 function didCreateSourceFrame()
37 if (!alreadyShownURLs[this._uiSourceCode.originURL()])
38 sourceFrameCount += 1;
39 alreadyShownURLs[this._uiSourceCode.originURL()] = true;
41 InspectorTest.addSniffer(WebInspector.SourceFrame.prototype, "wasShown", didCreateSourceFrame, true);
42 InspectorTest.reloadPage(didReload);
47 InspectorTest.showScriptSource("script3.js", didShowScriptSourceAgain);
50 function didShowScriptSourceAgain()
52 InspectorTest.assertTrue(panel._editorContainer.visibleView._uiSourceCode.originURL().indexOf("script3.js") !== -1);
53 // There should be maximum 3 source frames shown:
54 // - first one is the first shown (first tab added)
55 // - second one is the last viewed ("script2.js")
56 // - third one is explicitly selected script3.js.
57 InspectorTest.assertEquals(true, sourceFrameCount <= 3, "too many source frames created after page reload");
67 function secondInlinedScriptInPage()
74 function thirdInlinedScriptInPage()
81 function fourthInlinedScriptInPage()
89 <body onload="runTest()">
90 <p>Tests that scripts panel does not create too many source frames.</p>