Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / sources / debugger / breakpoint-manager-listeners-count.html
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="resources/script1.js"></script>
6 <script src="resources/script2.js"></script>
7 <script>
8 function test()
9 {
10     InspectorTest.runDebuggerTestSuite([
11         function testSourceFramesCount(next)
12         {
13             var panel = WebInspector.panels.sources;
14             var sourceFrameCount = 0;
15
16             InspectorTest.showScriptSource("script1.js", didShowScriptSources);
17
18             function didShowScriptSources()
19             {
20                 InspectorTest.reloadPage(didReload);
21             }
22
23             function didReload()
24             {
25                 InspectorTest.showScriptSource("script2.js", didShowScriptSourceAgain);
26             }
27
28             function didShowScriptSourceAgain()
29             {
30                 var listeners = WebInspector.breakpointManager._listeners.get("breakpoint-added");
31                 // There should be 3 breakpoint-added event listeners:
32                 //  - BreakpointsSidebarPane
33                 //  - 2 shown tabs
34                 InspectorTest.addResult("Number of breakpoint-added event listeners is " + listeners.length);
35
36                 function dumpListener(listener)
37                 {
38                     if (!(listener.thisObject instanceof WebInspector.SourceFrame))
39                         return;
40                     var sourceFrame = listener.thisObject;
41                     InspectorTest.addResult("    " + sourceFrame._uiSourceCode.name());
42                 }
43
44                 InspectorTest.addResult("Dumping SourceFrames listening for breakpoint-added event:");
45                 listeners.map(dumpListener);
46
47                 next();
48             }
49         }
50     ]);
51 };
52 </script>
53 </head>
54 <body onload="runTest()">
55 <p>Tests that scripts panel does not create too many source frames.</p>
56 </body>
57 </html>