Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / console / console-filter-level-test.html
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/console-test.js"></script>
5 <script src="resources/log-source.js"></script>
6 <script>
7 // Create a mix of log messages from different source files
8 function onload()
9 {
10    console.info("sample info");
11    console.log("sample log");
12    console.warn("sample warning");
13    console.debug("sample debug");
14    console.error("sample error");
15    
16    console.info("abc info");
17    console.info("def info");
18    
19    console.warn("abc warn");
20    console.warn("def warn");
21    
22    runTest();
23 }
24
25 function test()
26 {
27     function dumpVisibleMessages()
28     {
29         var children = WebInspector.ConsolePanel._view()._messagesContainer.childNodes;
30
31         for (var i = 0; i < children.length; i++)
32             InspectorTest.addResult(">" + children[i].textContent);
33     }
34
35     var testSuite = [
36         function beforeFilter(next)
37         {
38             InspectorTest.addResult(arguments.callee.name);
39             dumpVisibleMessages();
40             next();
41         },
42         
43         function onlyWarning(next)
44         {
45             WebInspector.ConsolePanel._view()._filter._levelFilterUI._toggleTypeFilter("warning");
46             dumpVisibleMessages();
47             next();
48         },
49         
50         function onlyLog(next)
51         {
52             WebInspector.ConsolePanel._view()._filter._levelFilterUI._toggleTypeFilter("log");
53             dumpVisibleMessages();
54             next();
55         },
56         
57         function onlyErrorDebug(next)
58         {
59             WebInspector.ConsolePanel._view()._filter._levelFilterUI._toggleTypeFilter("error");
60             WebInspector.ConsolePanel._view()._filter._levelFilterUI._toggleTypeFilter("debug", true);
61             dumpVisibleMessages();
62             next();
63         },
64         
65         function onlyAbcMessagePlain(next)
66         {
67             WebInspector.ConsolePanel._view()._filter._levelFilterUI._toggleTypeFilter(WebInspector.NamedBitSetFilterUI.ALL_TYPES);
68             WebInspector.ConsolePanel._view()._filter._textFilterUI.setValue("abc");
69             dumpVisibleMessages();
70             next();
71         },
72         
73         function onlyAbcMessageRegex(next)
74         {
75             WebInspector.ConsolePanel._view()._filter._textFilterUI._regexCheckBox.checked = "checked";
76             WebInspector.ConsolePanel._view()._filter._textFilterUI.setValue("ab[a-z]");
77             dumpVisibleMessages();
78             next();
79         },
80         
81         function onlyAbcMessageRegexWarning(next)
82         {
83             WebInspector.ConsolePanel._view()._filter._levelFilterUI._toggleTypeFilter("warning", false);
84             dumpVisibleMessages();
85             next();
86         }
87     ]
88
89     InspectorTest.evaluateInConsole("'Should be always visible'", InspectorTest.runTestSuite.bind(InspectorTest, testSuite));
90 }
91
92 </script>
93 </head>
94
95 <body onload="onload()">
96 <p>
97     Tests that console can filter messages by source.
98 </p>
99
100 </body>
101 </html>