6 background-color: blue;
11 <script src=
"../http/tests/inspector/inspector-test.js"></script>
12 <script src=
"../http/tests/inspector/timeline-test.js"></script>
13 <script src=
"tracing-test.js"></script>
15 function initialize_TracingManagerClient()
18 InspectorTest
.TracingManagerClient = function(tracingManager
, callback
)
20 this._tracingManager
= tracingManager
;
21 this._completionCallback
= callback
;
22 this._tracingModel
= InspectorTest
.createTracingModel();
25 InspectorTest
.TracingManagerClient
.prototype = {
26 tracingStarted: function()
28 this._tracingModel
.reset();
29 InspectorTest
.evaluateInPage("doWork()", this._tracingManager
.stop
.bind(this._tracingManager
));
32 traceEventsCollected: function(events
)
34 this._tracingModel
.addEvents(events
);
37 tracingComplete: function()
39 InspectorTest
.addResult("Tracing complete");
40 this._completionCallback(this._tracingModel
);
43 tracingBufferUsage: function(usage
) { },
44 eventsRetrievalProgress: function(progress
) { }
50 var element
= document
.getElementById("test");
51 element
.style
.display
= "block";
52 var unused
= element
.clientWidth
;
57 var tracingClient
= new InspectorTest
.TracingManagerClient(InspectorTest
.tracingManager
, runEventsSanityCheck
);
58 InspectorTest
.tracingManager
.start(tracingClient
, "", "", onTracingStarted
);
60 function onTracingStarted(error
)
62 InspectorTest
.addResult("Tracing started (error: " + JSON
.stringify(error
) + ")");
65 function runEventsSanityCheck(tracingModel
)
68 var phaseComplete
= 0;
73 tracingModel
.sortedProcesses().forEach(function(process
) {
75 process
.sortedThreads().forEach(function(thread
) {
77 events
= events
.concat(thread
.events());
81 knownEvents
["MessageLoop::PostTask"] = 0;
82 knownEvents
["v8.callFunction"] = 0;
83 knownEvents
["UpdateLayoutTree"] = 0;
84 knownEvents
["FrameView::layout"] = 0;
86 for (var i
= 0; i
< events
.length
; ++i
) {
87 var event
= events
[i
];
88 if (event
.phase
=== WebInspector
.TracingModel
.Phase
.Complete
)
90 if (event
.name
in knownEvents
)
91 ++knownEvents
[event
.name
];
93 InspectorTest
.assertGreaterOrEqual(events
.length
, 100, "Too few trace events recorded");
94 InspectorTest
.assertGreaterOrEqual(knownEvents
["v8.callFunction"], 1, "Too few v8.callFunction");
95 InspectorTest
.assertGreaterOrEqual(knownEvents
["UpdateLayoutTree"], 1, "Too few UpdateLayoutTree");
96 InspectorTest
.assertGreaterOrEqual(knownEvents
["FrameView::layout"], 1, "Too few FrameView::layout");
97 InspectorTest
.assertGreaterOrEqual(phaseComplete
, 50, "Too few begin events");
98 InspectorTest
.assertGreaterOrEqual(processes
, 2, "Too few processes");
99 InspectorTest
.assertGreaterOrEqual(threads
, 4, "Too few threads");
100 InspectorTest
.addResult("Event sanity test done");
101 InspectorTest
.completeTest();
107 <body onload=
"runTest()">