Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / sources / debugger-ui / source-frame-count.html
blobc0b8986888f93268e1e4b43028c94026172f93e7
1 <html>
2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/debugger-test.js"></script>
5 <script src="../debugger/resources/script1.js"></script>
6 <script src="../debugger/resources/script2.js"></script>
7 <script src="../debugger/resources/script3.js"></script>
9 <script>
11 function test()
13 InspectorTest.runDebuggerTestSuite([
14 function testSourceFramesCount(next)
16 var panel = WebInspector.panels.sources;
17 var sourceFrameCount = 0;
19 InspectorTest.showScriptSource("source-frame-count.html", step2);
21 function step2()
23 InspectorTest.showScriptSource("script1.js", step3);
26 function step3()
28 InspectorTest.showScriptSource("script2.js", didShowScriptSources);
31 function didShowScriptSources()
33 var alreadyShownURLs = {};
34 function didCreateSourceFrame()
36 if (!alreadyShownURLs[this._uiSourceCode.originURL()])
37 sourceFrameCount += 1;
38 alreadyShownURLs[this._uiSourceCode.originURL()] = true;
40 InspectorTest.addSniffer(WebInspector.SourceFrame.prototype, "wasShown", didCreateSourceFrame, true);
41 InspectorTest.reloadPage(didReload);
44 function didReload()
46 InspectorTest.showScriptSource("script3.js", didShowScriptSourceAgain);
49 function didShowScriptSourceAgain()
51 InspectorTest.assertTrue(panel.visibleView._uiSourceCode.originURL().indexOf("script3.js") !== -1);
52 // There should be maximum 3 source frames shown:
53 // - first one is the first shown (first tab added)
54 // - second one is the last viewed ("script2.js")
55 // - third one is explicitly selected script3.js.
56 InspectorTest.assertEquals(true, sourceFrameCount <= 3, "too many source frames created after page reload");
57 next();
60 ]);
63 </script>
65 <script>
66 function secondInlinedScriptInPage()
68 return 0;
70 </script>
72 <script>
73 function thirdInlinedScriptInPage()
75 return 0;
77 </script>
79 <script>
80 function fourthInlinedScriptInPage()
82 return 0;
84 </script>
86 </head>
88 <body onload="runTest()">
89 <p>Tests that scripts panel does not create too many source frames.</p>
91 </body>
92 </html>