OLD | NEW |
(Empty) | |
| 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 test() |
| 8 { |
| 9 var sessionId = "4.20"; |
| 10 var mainThread = 1; |
| 11 var pid = 100; |
| 12 |
| 13 var testData = [ |
| 14 { |
| 15 "args": { "sessionId": sessionId }, |
| 16 "cat": "disabled-by-default-devtools.timeline", |
| 17 "name": "TracingStartedInPage", |
| 18 "ph": "I", |
| 19 "pid": pid, |
| 20 "tid": mainThread, |
| 21 "ts": 100, |
| 22 }, |
| 23 {"name": "Program", "ts": 1000000, "ph": "B", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 24 {"name": "TimeStamp", "ts": 1010000, "ph": "B", "tid": mainThread, "
pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"mess
age":"bar01"}}}, |
| 25 {"name": "TimeStamp", "ts": 1020000, "ph": "I", "tid": mainThrea
d, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"
message":"bar02"}}}, |
| 26 {"name": "TimeStamp", "ts": 1120000, "ph": "I", "tid": mainThrea
d, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"
message":"bar03"}}}, |
| 27 {"name": "TimeStamp", "ts": 1180000, "ph": "E", "tid": mainThread, "
pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 28 {"name": "TimeStamp", "ts": 1210000, "ph": "B", "tid": mainThread, "
pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"mess
age":"bar04"}}}, |
| 29 {"name": "TimeStamp", "ts": 1220000, "ph": "I", "tid": mainThrea
d, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"
message":"foo05"}}}, |
| 30 {"name": "TimeStamp", "ts": 1320000, "ph": "I", "tid": mainThrea
d, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"
message":"bar06"}}}, |
| 31 {"name": "TimeStamp", "ts": 1380000, "ph": "E", "tid": mainThread, "
pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 32 {"name": "TimeStamp", "ts": 1410000, "ph": "B", "tid": mainThread, "
pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"mess
age":"bar07"}}}, |
| 33 {"name": "TimeStamp", "ts": 1420000, "ph": "I", "tid": mainThrea
d, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"
message":"foo08"}}}, |
| 34 {"name": "TimeStamp", "ts": 1520000, "ph": "I", "tid": mainThrea
d, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"
message":"foo09"}}}, |
| 35 {"name": "TimeStamp", "ts": 1580000, "ph": "E", "tid": mainThread, "
pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 36 {"name": "Program", "ts": 1990000, "ph": "E", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 37 {"name": "Program", "ts": 2000000, "ph": "B", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 38 {"name": "TimeStamp", "ts": 2010000, "ph": "B", "tid": mainThread, "
pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"mess
age":"foo10"}}}, |
| 39 {"name": "TimeStamp", "ts": 2020000, "ph": "I", "tid": mainThrea
d, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"
message":"bar11"}}}, |
| 40 {"name": "TimeStamp", "ts": 2120000, "ph": "I", "tid": mainThrea
d, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"
message":"bar12"}}}, |
| 41 {"name": "TimeStamp", "ts": 2180000, "ph": "E", "tid": mainThread, "
pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 42 {"name": "TimeStamp", "ts": 2210000, "ph": "B", "tid": mainThread, "
pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"mess
age":"foo13"}}}, |
| 43 {"name": "TimeStamp", "ts": 2220000, "ph": "I", "tid": mainThrea
d, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"
message":"foo14"}}}, |
| 44 {"name": "TimeStamp", "ts": 2320000, "ph": "I", "tid": mainThrea
d, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"
message":"bar15"}}}, |
| 45 {"name": "TimeStamp", "ts": 2380000, "ph": "E", "tid": mainThread, "
pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 46 {"name": "TimeStamp", "ts": 2410000, "ph": "B", "tid": mainThread, "
pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"mess
age":"foo16"}}}, |
| 47 {"name": "TimeStamp", "ts": 2420000, "ph": "I", "tid": mainThrea
d, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"
message":"foo17"}}}, |
| 48 {"name": "TimeStamp", "ts": 2520000, "ph": "I", "tid": mainThrea
d, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {"data":{"
message":"foo18"}}}, |
| 49 {"name": "TimeStamp", "ts": 2580000, "ph": "E", "tid": mainThread, "
pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 50 {"name": "Program", "ts": 2590000, "ph": "E", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}} |
| 51 ]; |
| 52 |
| 53 var panel = WebInspector.inspectorView.showPanel("timeline"); |
| 54 var view = panel._currentViews[0]; |
| 55 var model = view._presentationModel; |
| 56 |
| 57 InspectorTest.timelineModel().setEventsForTest(sessionId, testData); |
| 58 |
| 59 function printRecord(record) |
| 60 { |
| 61 var prefix = []; |
| 62 var current = record.presentationParent(); |
| 63 while (current) { |
| 64 current = current.presentationParent(); |
| 65 prefix.push(" "); |
| 66 } |
| 67 var mark = record.expandable() ? (record.collapsed() ? "+" : "-") : " "; |
| 68 InspectorTest.addResult(prefix.join("") + mark + record.record().data().
message); |
| 69 } |
| 70 |
| 71 function dumpRecords() |
| 72 { |
| 73 var records = model.filteredRecords(); |
| 74 for (var i = 0; i < records.length; ++i) |
| 75 printRecord(records[i]); |
| 76 InspectorTest.addResult(""); |
| 77 } |
| 78 |
| 79 InspectorTest.addResult("Initial:"); |
| 80 dumpRecords(); |
| 81 |
| 82 InspectorTest.addResult("Filtered by 'bar':"); |
| 83 panel._filters._textFilterUI.setValue("bar"); |
| 84 dumpRecords(); |
| 85 |
| 86 InspectorTest.addResult("Collapsed 'bar04' and 'foo13':"); |
| 87 var records = model.filteredRecords(); |
| 88 var collapseList = {"bar04":true, "foo13": true}; |
| 89 for (var i = 0; i < records.length; ++i) { |
| 90 var record = records[i]; |
| 91 if (collapseList[record.record().data().message]) |
| 92 record.setCollapsed(true); |
| 93 } |
| 94 model.invalidateFilteredRecords(); |
| 95 dumpRecords(); |
| 96 |
| 97 InspectorTest.addResult("Filtered by 'foo':"); |
| 98 panel._filters._textFilterUI.setValue("foo"); |
| 99 dumpRecords(); |
| 100 |
| 101 InspectorTest.completeTest(); |
| 102 } |
| 103 |
| 104 </script> |
| 105 </head> |
| 106 |
| 107 <body onload="runTest()"> |
| 108 <p> |
| 109 Test filtering on timeline panel.</a> |
| 110 </p> |
| 111 |
| 112 </body> |
| 113 </html> |
OLD | NEW |