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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/inspector/network-test.js

Issue 2838673003: [Devtools][Regression] Fixed websocket frame selection loss on frame received (Closed)
Patch Set: changes Created 3 years, 8 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector/websocket/network-preserve-selection-on-frame-receive.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/inspector/network-test.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/network-test.js b/third_party/WebKit/LayoutTests/http/tests/inspector/network-test.js
index dc9bf760c1d2583e9bd52ef4a97af93ff0d1c944..f0286963c7b760025297fb93e0fa56e4c5faa5ca 100644
--- a/third_party/WebKit/LayoutTests/http/tests/inspector/network-test.js
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/network-test.js
@@ -56,6 +56,84 @@ var initialize_NetworkTest = function() {
InspectorTest.preloadPanel("network");
+/**
+ * @param {!SDK.NetworkRequest} request
+ * @return {!Promise<!SDK.NetworkRequest>}
+ */
+InspectorTest.waitForRequestResponse = function(request)
+{
+ return new Promise(resolve => {
+ if (request.responseReceivedTime !== -1) {
+ resolve(request);
+ return;
+ }
+ InspectorTest.networkManager.addEventListener(SDK.NetworkManager.Events.RequestUpdated, checkRequestUpdated);
+
+ function checkRequestUpdated(data)
+ {
+ if (data.data !== request || request.responseReceivedTime === -1)
+ return;
+ InspectorTest.networkManager.removeEventListener(SDK.NetworkManager.Events.RequestUpdated, checkRequestUpdated);
+ resolve(request);
+ }
+ });
+}
+
+/**
+ * @param {!SDK.NetworkRequest} request
+ * @return {!Promise<!Network.NetworkRequestNode>}
+ */
+InspectorTest.waitForNetworkLogViewNodeForRequest = function(request)
+{
+ var networkLogView = UI.panels.network._networkLogView;
+ var node = networkLogView._nodesByRequestId.get(request.requestId());
+ if (node)
+ return Promise.resolve(node);
+ return new Promise(resolve => {
+ networkLogView.addEventToListeners(Network.NetworkLogView.Events.UpdateRequest, requestUpdated);
+ networkLogView._appendRequest;
+
+ function requestUpdated(data) {
+ if (data.data !== request)
+ return;
+ networkLogView.removeEventToListeners(Network.NetworkLogView.Events.UpdateRequest, requestUpdated);
+ var node = networkLogView._nodesByRequestId.get(request.requestId());
+ console.assert(node);
+ resolve(node);
+ }
+ });
+}
+
+/**
+ * @param {!SDK.NetworkRequest} wsRequest
+ * @param {string} message
+ * @return {!Promise<!SDK.NetworkRequest.WebSocketFrame>}
+ */
+InspectorTest.waitForWebsocketFrameReceived = function(wsRequest, message)
+{
+ return new Promise(resolve => {
+ for (var frame of wsRequest.frames()) {
+ if (resolveIfNeeded(frame))
+ return;
+ }
+ wsRequest.addEventListener(SDK.NetworkRequest.Events.WebsocketFrameAdded, handleFrameReceived);
+
+ function handleFrameReceived(data)
+ {
+ if (resolveIfNeeded(/** @type {!SDK.NetworkRequest.WebSocketFrame} */ (data.data)))
+ wsRequest.removeEventListener(SDK.NetworkRequest.Events.WebsocketFrameAdded, handleFrameReceived);
+ }
+
+ function resolveIfNeeded(frame)
+ {
+ if (frame.type !== SDK.NetworkRequest.WebSocketFrameType.Receive || frame.text !== message)
+ return false;
+ resolve(frame);
+ return true;
+ }
+ });
+}
+
InspectorTest.recordNetwork = function()
{
UI.panels.network._networkLogView.setRecording(true);
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector/websocket/network-preserve-selection-on-frame-receive.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698