Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / tracing / category-filter.html
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/timeline-test.js"></script>
5 <script>
6
7 function initialize_CategoryFilterTest()
8 {
9     InspectorTest.dumpVisibleRecords = function()
10     {
11         var presentationModel = InspectorTest.timelinePresentationModel();
12         var records = presentationModel.filteredRecords();
13         for (var i = 0; i < records.length; ++i)
14             InspectorTest.addResult(records[i].record().type());
15     }
16 }
17
18 function test()
19 {
20     var sessionId = "4.20";
21     var mainThread = 1;
22     var pid = 100;
23
24     var testData = [
25         {
26             "args": { "sessionId": sessionId },
27             "cat": "disabled-by-default-devtools.timeline",
28             "name": "TracingStartedInPage",
29             "ph": "I",
30             "pid": pid,
31             "tid": mainThread,
32             "ts": 100,
33         },
34         {"name": "Program", "ts": 1000000, "ph": "B", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}},
35         {"name": "FunctionCall", "ts": 1000001, "ph": "B", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"data":{"frame":"0x2","scriptId":"3","scriptLine":5,"scriptName":"http://example.com"}}},
36
37         {"name":"ResourceSendRequest","ts":1000002,"tid":mainThread,"pid":pid,"cat":"disabled-by-default-devtools.timeline","ph":"I","s":"g","args":{"data":{"frame":"0x2","requestId":"44.1","requestMethod":"GET","url":"http://example.com/foo.js"}}},
38
39         {"name": "RecalculateStyles", "ts": 1000003, "ph": "B", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"frame":"0x2"} },
40         {"name": "RecalculateStyles", "ts": 1009999, "ph": "E", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"elementCount":3}},
41
42         {"name": "Layout", "ts": 1010000, "ph": "B", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"beginData":{"dirtyObjects":1,"frame":"0x2","partialLayout":false,"totalObjects":1}} },
43         {"name": "Layout", "ts": 1020999, "ph": "E", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"endData":{"root":[0,0,1570,0,1570,243,0,243],"rootNode":1}}},
44
45         {"name": "FunctionCall", "ts": 1099999, "ph": "E", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}},
46         {"name": "Program", "ts": 1099999, "ph": "E", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}
47     ];
48
49     InspectorTest.timelineModel().setEventsForTest(testData);
50
51     var rootRecord = InspectorTest.timelinePresentationModel().rootRecord();
52     for (var i = 0; i < rootRecord.presentationChildren().length; ++i)
53         rootRecord.presentationChildren()[i].setCollapsed(false);
54
55     InspectorTest.addResult("Original records");
56     WebInspector.panels.timeline._categoryFilter.notifyFilterChanged();
57     InspectorTest.dumpVisibleRecords();
58
59     InspectorTest.addResult("Visible records when 'loading' is disabled");
60     WebInspector.TimelineUIUtils.categories().loading.hidden = true;
61     WebInspector.panels.timeline._categoryFilter.notifyFilterChanged();
62     InspectorTest.dumpVisibleRecords();
63
64     InspectorTest.addResult("Visible records when 'scripting' is disabled");
65     WebInspector.TimelineUIUtils.categories().scripting.hidden = true;
66     WebInspector.panels.timeline._categoryFilter.notifyFilterChanged();
67     InspectorTest.dumpVisibleRecords();
68
69     InspectorTest.completeTest();
70 }
71
72 </script>
73 </head>
74
75 <body onload="runTest()">
76 <p>
77 Test the set of visible records is correctly update when category filter changes</a>
78 </p>
79
80 </body>
81 </html>