function makeLoaderSynchronous(loader) {
  const originalLoadImage = loader.loadImage_;
  loader.loadImage_ = function(request, id) {
    originalLoadImage.call(this, request, id);

    const event = new GoogEvent(EventType.LOAD);
    /** @suppress {globalThis} suppression added to enable type checking */
    event.currentTarget = this.imageIdToImageMap_[id];
    loader.onNetworkEvent_(event);
  };

  // Make listen() a no-op.
  loader.handler_.listen = () => {};
}
Overrides the loader's loadImage_ method so that it dispatches an image
loaded event immediately, causing any event listeners to receive them
synchronously.  This allows tests to assume synchronous execution.