Index: LayoutTests/inspector/tracing/timeline-filtering.html |
diff --git a/LayoutTests/inspector/tracing/timeline-filtering.html b/LayoutTests/inspector/tracing/timeline-filtering.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1d1a79424bc8f90ce6965864caa32afd413a846f |
--- /dev/null |
+++ b/LayoutTests/inspector/tracing/timeline-filtering.html |
@@ -0,0 +1,113 @@ |
+<html> |
+<head> |
+<script src="../../http/tests/inspector/inspector-test.js"></script> |
+<script src="../../http/tests/inspector/timeline-test.js"></script> |
+<script> |
+ |
+function test() |
+{ |
+ var sessionId = "4.20"; |
+ var mainThread = 1; |
+ var pid = 100; |
+ |
+ var testData = [ |
+ { |
+ "args": { "sessionId": sessionId }, |
+ "cat": "disabled-by-default-devtools.timeline", |
+ "name": "TracingStartedInPage", |
+ "ph": "I", |
+ "pid": pid, |
+ "tid": mainThread, |
+ "ts": 100, |
+ }, |
+ {"name": "Program", "ts": 1000000, "ph": "B", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
+ {"name": "TimeStamp", "ts": 1010000, "ph": "B", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"message":"bar01"}}}, |
+ {"name": "TimeStamp", "ts": 1020000, "ph": "I", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"message":"bar02"}}}, |
+ {"name": "TimeStamp", "ts": 1120000, "ph": "I", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"message":"bar03"}}}, |
+ {"name": "TimeStamp", "ts": 1180000, "ph": "E", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
+ {"name": "TimeStamp", "ts": 1210000, "ph": "B", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"message":"bar04"}}}, |
+ {"name": "TimeStamp", "ts": 1220000, "ph": "I", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"message":"foo05"}}}, |
+ {"name": "TimeStamp", "ts": 1320000, "ph": "I", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"message":"bar06"}}}, |
+ {"name": "TimeStamp", "ts": 1380000, "ph": "E", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
+ {"name": "TimeStamp", "ts": 1410000, "ph": "B", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"message":"bar07"}}}, |
+ {"name": "TimeStamp", "ts": 1420000, "ph": "I", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"message":"foo08"}}}, |
+ {"name": "TimeStamp", "ts": 1520000, "ph": "I", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"message":"foo09"}}}, |
+ {"name": "TimeStamp", "ts": 1580000, "ph": "E", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
+ {"name": "Program", "ts": 1990000, "ph": "E", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
+ {"name": "Program", "ts": 2000000, "ph": "B", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
+ {"name": "TimeStamp", "ts": 2010000, "ph": "B", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"message":"foo10"}}}, |
+ {"name": "TimeStamp", "ts": 2020000, "ph": "I", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"message":"bar11"}}}, |
+ {"name": "TimeStamp", "ts": 2120000, "ph": "I", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"message":"bar12"}}}, |
+ {"name": "TimeStamp", "ts": 2180000, "ph": "E", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
+ {"name": "TimeStamp", "ts": 2210000, "ph": "B", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"message":"foo13"}}}, |
+ {"name": "TimeStamp", "ts": 2220000, "ph": "I", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"message":"foo14"}}}, |
+ {"name": "TimeStamp", "ts": 2320000, "ph": "I", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"message":"bar15"}}}, |
+ {"name": "TimeStamp", "ts": 2380000, "ph": "E", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
+ {"name": "TimeStamp", "ts": 2410000, "ph": "B", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"message":"foo16"}}}, |
+ {"name": "TimeStamp", "ts": 2420000, "ph": "I", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"message":"foo17"}}}, |
+ {"name": "TimeStamp", "ts": 2520000, "ph": "I", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"message":"foo18"}}}, |
+ {"name": "TimeStamp", "ts": 2580000, "ph": "E", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
+ {"name": "Program", "ts": 2590000, "ph": "E", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}} |
+ ]; |
+ |
+ var panel = WebInspector.inspectorView.showPanel("timeline"); |
+ var view = panel._currentViews[0]; |
+ var model = view._presentationModel; |
+ |
+ InspectorTest.timelineModel().setEventsForTest(sessionId, testData); |
+ |
+ function printRecord(record) |
+ { |
+ var prefix = []; |
+ var current = record.presentationParent(); |
+ while (current) { |
+ current = current.presentationParent(); |
+ prefix.push(" "); |
+ } |
+ var mark = record.expandable() ? (record.collapsed() ? "+" : "-") : " "; |
+ InspectorTest.addResult(prefix.join("") + mark + record.record().data().message); |
+ } |
+ |
+ function dumpRecords() |
+ { |
+ var records = model.filteredRecords(); |
+ for (var i = 0; i < records.length; ++i) |
+ printRecord(records[i]); |
+ InspectorTest.addResult(""); |
+ } |
+ |
+ InspectorTest.addResult("Initial:"); |
+ dumpRecords(); |
+ |
+ InspectorTest.addResult("Filtered by 'bar':"); |
+ panel._filters._textFilterUI.setValue("bar"); |
+ dumpRecords(); |
+ |
+ InspectorTest.addResult("Collapsed 'bar04' and 'foo13':"); |
+ var records = model.filteredRecords(); |
+ var collapseList = {"bar04":true, "foo13": true}; |
+ for (var i = 0; i < records.length; ++i) { |
+ var record = records[i]; |
+ if (collapseList[record.record().data().message]) |
+ record.setCollapsed(true); |
+ } |
+ model.invalidateFilteredRecords(); |
+ dumpRecords(); |
+ |
+ InspectorTest.addResult("Filtered by 'foo':"); |
+ panel._filters._textFilterUI.setValue("foo"); |
+ dumpRecords(); |
+ |
+ InspectorTest.completeTest(); |
+} |
+ |
+</script> |
+</head> |
+ |
+<body onload="runTest()"> |
+<p> |
+Test filtering on timeline panel.</a> |
+</p> |
+ |
+</body> |
+</html> |