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 src="resources/timeline-data.js"></script> | |
6 <script> | |
7 | |
8 function test() | |
9 { | |
10 var timelineData = InspectorTest.timelineData(); | |
11 | |
12 var timeline = WebInspector.panels.timeline; | |
13 var overviewPane = timeline._overviewPane; | |
14 var model = timeline._model; | |
15 | |
16 function createFileReader(file, delegate) | |
17 { | |
18 return new InspectorTest.FakeFileReader(timelineData, delegate, model.sa
veToFile.bind(model)); | |
19 } | |
20 | |
21 InspectorTest.override(model, "_createFileReader", createFileReader); | |
22 | |
23 model.loadFromFile({}, new WebInspector.Progress()); | |
24 timeline._currentViews[0]._refresh(); | |
25 | |
26 overviewPane.update(); | |
27 InspectorTest.addResult("OverviewPane:"); | |
28 overviewPane._overviewCalculator._setDisplayWindow(0, 450); | |
29 dumpDividers(overviewPane._overviewCalculator); | |
30 InspectorTest.addResult(""); | |
31 | |
32 function dumpRecordsCountForRange(windowLeft, windowRight) | |
33 { | |
34 var view = timeline._currentViews[0]; | |
35 overviewPane._overviewGrid.setWindow(windowLeft, windowRight); | |
36 view._refresh(); | |
37 InspectorTest.addResult("mode = " + timeline._overviewModeSetting.get())
; | |
38 InspectorTest.addResult("range = " + windowLeft + " - " + windowRight); | |
39 InspectorTest.addResult("time range = " + view._windowStartTime + " - "
+ view._windowEndTime); | |
40 InspectorTest.addResult("records count: " + view._presentationModel.filt
eredRecords().length); | |
41 view._calculator.setDisplayWindow(5, 455 + WebInspector.TimelineCalculat
or._minWidth); | |
42 dumpDividers(view._calculator); | |
43 InspectorTest.addResult(""); | |
44 } | |
45 | |
46 function dumpFlameChartRecordsCountForRange(windowLeft, windowRight) | |
47 { | |
48 var mainView = timeline._currentViews[0]._mainView; | |
49 overviewPane._overviewGrid.setWindow(windowLeft, windowRight); | |
50 mainView.update(); | |
51 InspectorTest.addResult("mode = " + timeline._overviewModeSetting.get())
; | |
52 InspectorTest.addResult("range = " + windowLeft + " - " + windowRight); | |
53 InspectorTest.addResult("time range = " + mainView._timeWindowLeft + " -
" + mainView._timeWindowRight); | |
54 mainView._calculator.setDisplayWindow(5, 455 + WebInspector.TimelineCalc
ulator._minWidth); | |
55 dumpDividers(mainView._calculator); | |
56 InspectorTest.addResult(""); | |
57 } | |
58 | |
59 function dumpDividers(calculator) | |
60 { | |
61 var dividers = WebInspector.TimelineGrid.calculateDividerOffsets(calcula
tor).offsets; | |
62 for (var i = 0; i < dividers.length; ++i) | |
63 dividers[i] -= calculator.zeroTime(); | |
64 InspectorTest.addResult("divider offsets: [" + dividers.join(", ") + "].
We are expecting round numbers."); | |
65 } | |
66 | |
67 timeline._overviewModeSetting.set(WebInspector.TimelinePanel.OverviewMode.Ev
ents); | |
68 timeline._onModeChanged(); | |
69 dumpRecordsCountForRange(0, 1); | |
70 dumpRecordsCountForRange(0.25, 0.75); | |
71 dumpRecordsCountForRange(0.33, 0.66); | |
72 | |
73 timeline._overviewModeSetting.set(WebInspector.TimelinePanel.OverviewMode.Fr
ames); | |
74 timeline._onModeChanged(); | |
75 dumpRecordsCountForRange(0, 1); | |
76 dumpRecordsCountForRange(0.25, 0.75); | |
77 dumpRecordsCountForRange(0.33, 0.66); | |
78 | |
79 timeline._overviewModeSetting.set(WebInspector.TimelinePanel.OverviewMode.Fr
ames); | |
80 timeline._flameChartEnabledSetting.set(true); | |
81 timeline._onModeChanged(); | |
82 // FIXME(394762): uncomment once we support loading tracing events. | |
83 // dumpFlameChartRecordsCountForRange(0, 1); | |
84 // dumpFlameChartRecordsCountForRange(0.25, 0.5); | |
85 // dumpFlameChartRecordsCountForRange(0.33, 0.4); | |
86 | |
87 overviewPane._overviewGrid.setWindow(0.1, 0.9); | |
88 | |
89 InspectorTest.addResult("---------------------------------------------------
-----"); | |
90 InspectorTest.addResult("mode = " + timeline._overviewModeSetting.get()); | |
91 InspectorTest.addResult("time range = " + timeline._windowStartTime + " - "
+ timeline._windowEndTime); | |
92 | |
93 timeline._overviewModeSetting.set(WebInspector.TimelinePanel.OverviewMode.Ev
ents); | |
94 timeline._flameChartEnabledSetting.set(false); | |
95 timeline._onModeChanged(); | |
96 InspectorTest.addResult(""); | |
97 | |
98 InspectorTest.addResult("mode = " + timeline._overviewModeSetting.get()); | |
99 InspectorTest.addResult("time range = " + timeline._windowStartTime + " - "
+ timeline._windowEndTime); | |
100 timeline._overviewModeSetting.set(WebInspector.TimelinePanel.OverviewMode.Fr
ames); | |
101 timeline._onModeChanged(); | |
102 InspectorTest.addResult(""); | |
103 | |
104 InspectorTest.addResult("mode = " + timeline._overviewModeSetting.get()); | |
105 InspectorTest.addResult("time range = " + timeline._windowStartTime + " - "
+ timeline._windowEndTime); | |
106 timeline._overviewModeSetting.set(WebInspector.TimelinePanel.OverviewMode.Fr
ames); | |
107 timeline._flameChartEnabledSetting.set(true); | |
108 timeline._onModeChanged(); | |
109 | |
110 InspectorTest.completeTest(); | |
111 } | |
112 | |
113 </script> | |
114 </head> | |
115 | |
116 <body onload="runTest()"> | |
117 <p> | |
118 Tests the Timeline window filter. | |
119 </p> | |
120 | |
121 <p> | |
122 It applies different ranges to the OverviewGrid and expects that current view re
flects the change. | |
123 </p> | |
124 <p> | |
125 Also it detects that after switching to another view it gets the proper time ran
ge. | |
126 </p> | |
127 | |
128 </body> | |
129 </html> | |
OLD | NEW |