function handshakeSucceeds() {
      var url = getWSTestURL(testWebSocketPort);
      expect(
        [  //events
          { label: 'onBeforeRequest',
            event: 'onBeforeRequest',
            details: {
              url: url,
              type: 'websocket',
              // TODO(pkalinnikov): Figure out why the frame URL is unknown.
              frameUrl: 'unknown frame URL',
              initiator: getDomain(initiators.WEB_INITIATED)
            },
          },
          { label: 'onBeforeSendHeaders',
            event: 'onBeforeSendHeaders',
            details: {
              url: url,
              type: 'websocket',
              initiator: getDomain(initiators.WEB_INITIATED)
            },
          },
          { label: 'onSendHeaders',
            event: 'onSendHeaders',
            details: {
              url: url,
              type: 'websocket',
              initiator: getDomain(initiators.WEB_INITIATED)
            },
          },
          { label: 'onHeadersReceived',
            event: 'onHeadersReceived',
            details: {
              url: url,
              type: 'websocket',
              statusCode: 101,
              statusLine: 'HTTP/1.1 101 Switching Protocols',
              initiator: getDomain(initiators.WEB_INITIATED)
            },
          },
          { label: 'onResponseStarted',
            event: 'onResponseStarted',
            details: {
              url: url,
              type: 'websocket',
              ip: '127.0.0.1',
              fromCache: false,
              statusCode: 101,
              statusLine: 'HTTP/1.1 101 Switching Protocols',
              initiator: getDomain(initiators.WEB_INITIATED)
            },
          },
          { label: 'onCompleted',
            event: 'onCompleted',
            details: {
              url: url,
              type: 'websocket',
              ip: '127.0.0.1',
              fromCache: false,
              statusCode: 101,
              statusLine: 'HTTP/1.1 101 Switching Protocols',
              initiator: getDomain(initiators.WEB_INITIATED)
            }
          },
        ],
        [  // event order
          ['onBeforeRequest', 'onBeforeSendHeaders', 'onSendHeaders',
          'onHeadersReceived', 'onResponseStarted', 'onCompleted']
        ],
        {urls: ['<all_urls>']},  // filter
        ['blocking']  // extraInfoSpec
      );
      testWebSocketConnection(url, true /* expectedToConnect*/);
    }
// connection. WebRequest API should observe the entire handshake.
connection. WebRequest API should observe the entire handshake.
connection . WebRequest API should observe the entire handshake .
function handshakeSucceeds() {
      var url = getWSTestURL(testWebSocketPort);
      expect(
        [  
          { label: 'onBeforeRequest',
            event: 'onBeforeRequest',
            details: {
              url: url,
              type: 'websocket',
              frameUrl: 'unknown frame URL',
              initiator: getDomain(initiators.WEB_INITIATED)
            },
          },
          { label: 'onBeforeSendHeaders',
            event: 'onBeforeSendHeaders',
            details: {
              url: url,
              type: 'websocket',
              initiator: getDomain(initiators.WEB_INITIATED)
            },
          },
          { label: 'onSendHeaders',
            event: 'onSendHeaders',
            details: {
              url: url,
              type: 'websocket',
              initiator: getDomain(initiators.WEB_INITIATED)
            },
          },
          { label: 'onHeadersReceived',
            event: 'onHeadersReceived',
            details: {
              url: url,
              type: 'websocket',
              statusCode: 101,
              statusLine: 'HTTP/1.1 101 Switching Protocols',
              initiator: getDomain(initiators.WEB_INITIATED)
            },
          },
          { label: 'onResponseStarted',
            event: 'onResponseStarted',
            details: {
              url: url,
              type: 'websocket',
              ip: '127.0.0.1',
              fromCache: false,
              statusCode: 101,
              statusLine: 'HTTP/1.1 101 Switching Protocols',
              initiator: getDomain(initiators.WEB_INITIATED)
            },
          },
          { label: 'onCompleted',
            event: 'onCompleted',
            details: {
              url: url,
              type: 'websocket',
              ip: '127.0.0.1',
              fromCache: false,
              statusCode: 101,
              statusLine: 'HTTP/1.1 101 Switching Protocols',
              initiator: getDomain(initiators.WEB_INITIATED)
            }
          },
        ],
        [  
          ['onBeforeRequest', 'onBeforeSendHeaders', 'onSendHeaders',
          'onHeadersReceived', 'onResponseStarted', 'onCompleted']
        ],
        {urls: ['<all_urls>']},  
        ['blocking']  
      );
      testWebSocketConnection(url, true );
    }
function handshakeSucceeds ( ) { var url = getWSTestURL ( testWebSocketPort ) ; expect ( [ { label : 'onBeforeRequest' , event : 'onBeforeRequest' , details : { url : url , type : 'websocket' , frameUrl : 'unknown frame URL' , initiator : getDomain ( initiators . WEB_INITIATED ) } , } , { label : 'onBeforeSendHeaders' , event : 'onBeforeSendHeaders' , details : { url : url , type : 'websocket' , initiator : getDomain ( initiators . WEB_INITIATED ) } , } , { label : 'onSendHeaders' , event : 'onSendHeaders' , details : { url : url , type : 'websocket' , initiator : getDomain ( initiators . WEB_INITIATED ) } , } , { label : 'onHeadersReceived' , event : 'onHeadersReceived' , details : { url : url , type : 'websocket' , statusCode : 101 , statusLine : 'HTTP/1.1 101 Switching Protocols' , initiator : getDomain ( initiators . WEB_INITIATED ) } , } , { label : 'onResponseStarted' , event : 'onResponseStarted' , details : { url : url , type : 'websocket' , ip : '127.0.0.1' , fromCache : false , statusCode : 101 , statusLine : 'HTTP/1.1 101 Switching Protocols' , initiator : getDomain ( initiators . WEB_INITIATED ) } , } , { label : 'onCompleted' , event : 'onCompleted' , details : { url : url , type : 'websocket' , ip : '127.0.0.1' , fromCache : false , statusCode : 101 , statusLine : 'HTTP/1.1 101 Switching Protocols' , initiator : getDomain ( initiators . WEB_INITIATED ) } } , ] , [ [ 'onBeforeRequest' , 'onBeforeSendHeaders' , 'onSendHeaders' , 'onHeadersReceived' , 'onResponseStarted' , 'onCompleted' ] ] , { urls : [ '<all_urls>' ] } , [ 'blocking' ] ) ; testWebSocketConnection ( url , true ) ; }
connection.
connection .
//events // TODO(pkalinnikov): Figure out why the frame URL is unknown. // event order // filter // extraInfoSpec /* expectedToConnect*/