Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / tracing.html
blobc7ee50d6014326057bcae580cce6b9f5fa36ec22
1 <html>
2 <head>
3 <style>
4 div#test {
5 display: none;
6 background-color: blue;
7 width: 100px;
8 height: 100px;
10 </style>
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>
14 <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) { }
48 function doWork()
50 var element = document.getElementById("test");
51 element.style.display = "block";
52 var unused = element.clientWidth;
55 function test()
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)
67 var events = [];
68 var phaseComplete = 0;
69 var knownEvents = {};
70 var processes = 0;
71 var threads = 0;
73 tracingModel.sortedProcesses().forEach(function(process) {
74 processes++;
75 process.sortedThreads().forEach(function(thread) {
76 threads++;
77 events = events.concat(thread.events());
78 });
79 });
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)
89 ++phaseComplete;
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();
105 </script>
106 </head>
107 <body onload="runTest()">
108 <div id="test">
109 </div>
110 </body>
111 </html>