| Index: LayoutTests/http/tests/inspector-protocol/tracing-test.js
|
| diff --git a/LayoutTests/http/tests/inspector-protocol/tracing-test.js b/LayoutTests/http/tests/inspector-protocol/tracing-test.js
|
| index c814263d5aecc227a3f1a0c76fd0e5daa5803ae3..230a0128be2e65d525be84614b04a88c0e671465 100644
|
| --- a/LayoutTests/http/tests/inspector-protocol/tracing-test.js
|
| +++ b/LayoutTests/http/tests/inspector-protocol/tracing-test.js
|
| @@ -9,7 +9,23 @@ initialize_tracingHarness = function()
|
|
|
| InspectorTest.startTracing = function(callback)
|
| {
|
| - InspectorTest.sendCommand("Tracing.start", { "categories": "-*,disabled-by-default-devtools.timeline,devtools.timeline", "type": "", "options": "" }, onStart);
|
| + InspectorTest.startTracingWithArguments({ "categories": "-*,disabled-by-default-devtools.timeline,devtools.timeline", "type": "", "options": "" }, callback);
|
| +}
|
| +
|
| +InspectorTest.startTracingAndSaveAsStream = function(callback)
|
| +{
|
| + var args = {
|
| + "categories": "-*,disabled-by-default-devtools.timeline,devtools.timeline",
|
| + "type": "",
|
| + "options": "",
|
| + "transferMode": "ReturnAsStream"
|
| + };
|
| + InspectorTest.startTracingWithArguments(args, callback);
|
| +}
|
| +
|
| +InspectorTest.startTracingWithArguments = function(args, callback)
|
| +{
|
| + InspectorTest.sendCommand("Tracing.start", args, onStart);
|
|
|
| function onStart(response)
|
| {
|
| @@ -43,6 +59,57 @@ InspectorTest.stopTracing = function(callback)
|
| }
|
| }
|
|
|
| +InspectorTest.stopTracingAndReturnStream = function(callback)
|
| +{
|
| + InspectorTest.eventHandler["Tracing.tracingComplete"] = tracingComplete;
|
| + InspectorTest.eventHandler["Tracing.dataCollected"] = dataCollected;
|
| + InspectorTest.sendCommand("Tracing.end");
|
| +
|
| + function dataCollected(reply)
|
| + {
|
| + InspectorTest.log("FAIL: dataCollected event should not be fired when returning trace as stream.");
|
| +
|
| + }
|
| +
|
| + function tracingComplete(event)
|
| + {
|
| + InspectorTest.log("Tracing complete");
|
| + InspectorTest.eventHandler["Tracing.tracingComplete"] = null;
|
| + InspectorTest.eventHandler["Tracing.dataCollected"] = null;
|
| + callback(event.params.stream);
|
| + }
|
| +}
|
| +
|
| +InspectorTest.retrieveStream = function(streamHandle, offset, chunkSize, callback)
|
| +{
|
| + var result = "";
|
| + var had_eof = false;
|
| +
|
| + var readArguments = { handle: streamHandle };
|
| + if (typeof chunkSize === "number")
|
| + readArguments.size = chunkSize;
|
| + var firstReadArguments = JSON.parse(JSON.stringify(readArguments));
|
| + if (typeof offset === "number")
|
| + firstReadArguments.offset = 0;
|
| + InspectorTest.sendCommandOrDie("IO.read", firstReadArguments, onChunkRead);
|
| + // Assure multiple in-lfight reads are fine (also, save on latencies).
|
| + InspectorTest.sendCommandOrDie("IO.read", readArguments, onChunkRead);
|
| +
|
| + function onChunkRead(response)
|
| + {
|
| + if (had_eof)
|
| + return;
|
| + result += response.data;
|
| + if (response.eof) {
|
| + // Ignore stray callbacks from proactive read requests.
|
| + had_eof = true;
|
| + callback(result);
|
| + return;
|
| + }
|
| + InspectorTest.sendCommandOrDie("IO.read", readArguments, onChunkRead);
|
| + }
|
| +}
|
| +
|
| InspectorTest.findEvent = function(name, ph, condition)
|
| {
|
| for (var i = 0; i < InspectorTest.devtoolsEvents.length; i++) {
|
| @@ -99,4 +166,3 @@ InspectorTest.didInvokePageFunctionAsync = function(callId, value)
|
| }
|
|
|
| }
|
| -
|
|
|