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

Unified Diff: LayoutTests/http/tests/inspector-protocol/tracing-test.js

Issue 1307863003: Add support for returning traces as streams in DevTools protocol (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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/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..afe431621c4b1accc37aefc6b13d482d038106e0 100644
--- a/LayoutTests/http/tests/inspector-protocol/tracing-test.js
+++ b/LayoutTests/http/tests/inspector-protocol/tracing-test.js
@@ -43,6 +43,57 @@ InspectorTest.stopTracing = function(callback)
}
}
+InspectorTest.stopTracingAndSaveAsStream = function(callback)
+{
+ InspectorTest.eventHandler["Tracing.tracingComplete"] = tracingComplete;
+ InspectorTest.eventHandler["Tracing.dataCollected"] = dataCollected;
+ InspectorTest.sendCommand("Tracing.end", { returnAsStream: true });
+
+ 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.streamId);
+ }
+}
+
+InspectorTest.retrieveStream = function(streamId, offset, chunkSize, callback)
+{
+ var result = "";
+ var had_eof = false;
+
+ var readArguments = { id: streamId };
+ 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 +150,3 @@ InspectorTest.didInvokePageFunctionAsync = function(callId, value)
}
}
-
« no previous file with comments | « no previous file | LayoutTests/inspector-protocol/timeline/fetch-as-stream.html » ('j') | Source/devtools/protocol.json » ('J')

Powered by Google App Engine
This is Rietveld 408576698