| Index: third_party/WebKit/LayoutTests/inspector-protocol/network/websocket-initiator.html
|
| diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/network/websocket-initiator.html b/third_party/WebKit/LayoutTests/inspector-protocol/network/websocket-initiator.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..9bfaa640548fb37e10d49ce413aa99499c44b992
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/inspector-protocol/network/websocket-initiator.html
|
| @@ -0,0 +1,68 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<head>
|
| +<script src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
|
| +<script>
|
| +testRunner.setDumpConsoleMessages(false);
|
| +var ws;
|
| +function createSocket()
|
| +{
|
| + ws = new WebSocket("ws://localhost:0000/WillFailToConnect");
|
| +}
|
| +
|
| +function test()
|
| +{
|
| + InspectorTest.eventHandler["Network.webSocketCreated"] = onWebSocketCreated;
|
| +
|
| + function enableNetwork()
|
| + {
|
| + InspectorTest.log("Test started");
|
| + InspectorTest.sendCommand("Network.enable", {}, didEnableNetwork);
|
| + }
|
| +
|
| + function didEnableNetwork(messageObject)
|
| + {
|
| + if (messageObject.error) {
|
| + InspectorTest.log("FAIL: Couldn't enable network agent" + messageObject.error.message);
|
| + InspectorTest.completeTest();
|
| + return;
|
| + }
|
| + InspectorTest.log("Network agent enabled");
|
| + InspectorTest.sendCommand("Runtime.evaluate", { "expression": "createSocket()"});
|
| + }
|
| +
|
| + function onWebSocketCreated(event)
|
| + {
|
| + var initiator = event.params.initiator;
|
| + InspectorTest.log("");
|
| + InspectorTest.log("Initiator Type: " + initiator.type);
|
| + var stackTrace = initiator.stack;
|
| + for (var i = 0; i < stackTrace.callFrames.length; ++i) {
|
| + var frame = stackTrace.callFrames[i];
|
| + InspectorTest.log("Stack #" + i);
|
| + if (frame.lineNumber) {
|
| + InspectorTest.log(" functionName: " + frame.functionName);
|
| + InspectorTest.log(" url: " + cleanUrl(frame.url));
|
| + InspectorTest.log(" lineNumber: " + frame.lineNumber);
|
| +
|
| + break;
|
| + }
|
| + }
|
| + InspectorTest.completeTest();
|
| + }
|
| +
|
| + function cleanUrl(url)
|
| + {
|
| + url = url.match(/\/[^\/]+$/);
|
| + if (url.length)
|
| + return url[0].substr(1);
|
| + return url;
|
| + }
|
| +
|
| + enableNetwork();
|
| +}
|
| +</script>
|
| +</head>
|
| +<body onload="runTest();">
|
| +<p>Initiator for Websockets check fixes http://crbug.com/457811</p>
|
| +</body>
|
|
|