Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Unified Diff: LayoutTests/inspector/tracing/timeline-filtering.html

Issue 477153005: DevTools: adopt existing Timeline tests for tracing based Timeline (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698