Upstream version 11.40.271.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / inspector / console / console-links-on-messages-before-inspection.html
1 <html>
2 <head>
3 <script src="../inspector-test.js"></script>
4 <script src="../console-test.js"></script>
5 <script>
6
7 function loadScript()
8 {
9     var script = document.createElement('script');
10     script.type = "text/javascript";
11     script.src = "../resources/source2.js";
12     document.body.appendChild(script);
13 }
14
15 function test()
16 {
17     var mainTarget = WebInspector.targetManager.mainTarget();
18     var message = new WebInspector.ConsoleMessage(mainTarget, WebInspector.ConsoleMessage.MessageSource.JS, WebInspector.ConsoleMessage.MessageLevel.Log, "hello?", null, " http://127.0.0.1:8000/inspector/resources/source2.js");
19     mainTarget.consoleModel.addMessage(message);
20     mainTarget.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ParsedScriptSource, onScriptAdded);
21
22     InspectorTest.dumpConsoleMessages();
23     InspectorTest.evaluateInPage("loadScript()");
24
25     function onScriptAdded(event)
26     {
27         if (!event.data.contentURL().endsWith("source2.js"))
28             return;
29
30         InspectorTest.addResult("script was added");
31         var message = WebInspector.ConsolePanel._view()._visibleViewMessages[0];
32         message._anchorElement.click();
33     }
34
35     InspectorFrontendHost.openInNewTab = function()
36     {
37         InspectorTest.addResult("Failure: Open link in new tab!!");
38         InspectorTest.completeTest();
39     };
40
41     WebInspector.inspectorView._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabSelected, panelChanged);
42
43     function panelChanged()
44     {
45         InspectorTest.addResult("Panel " + WebInspector.inspectorView.currentPanel().name + " was opened");
46         InspectorTest.completeTest();
47     }
48
49
50 }
51
52 </script>
53 </head>
54
55 <body onload="runTest()">
56 <p>
57 Tests a handling of a click on the link in a message, which had been shown before its originating script was added.
58 </p>
59 </body>
60 </html>