static expectRequest(requestSpy, uri, type, context) {
    // Jasmine "toHaveBeenCalledWith" doesn't handle optional parameters well.
    if (context != undefined) {
      expect(requestSpy).toHaveBeenCalledWith(
          type, jasmine.objectContaining({uris: [uri]}),
          jasmine.objectContaining({type: context.type}));
    } else {
      expect(requestSpy).toHaveBeenCalledWith(
          type, jasmine.objectContaining({uris: [uri]}),
          jasmine.anything());
    }
  }
Expects that a request for the given segment has occurred.

@param {!Object} requestSpy
@param {string} uri
@param {shaka.net.NetworkingEngine.RequestType} type
@param {shaka.extern.RequestContext=} context