testLoadingUntilCompletion() {
    const resolver = GoogPromise.withResolver();
    const results = {};
    events.listen(loader, TEST_EVENT_TYPES, (e) => {
      let image;
      switch (e.type) {
        case EventType.LOAD:
          image = e.target;
          results[image.src.substring(image.src.lastIndexOf('/') + 1)] =
              [image.naturalWidth, image.naturalHeight, e.type];
          return;

        case NetEventType.ERROR:
          image = e.target;
          results[image.src.substring(image.src.lastIndexOf('/') + 1)] =
              [image.naturalWidth, image.naturalHeight, e.type];
          return;

        case NetEventType.COMPLETE:
          try {
            assertImagesAreCorrect(results);
          } catch (e) {
            resolver.reject(e);
            return;
          }
          resolver.resolve();
          return;
      }
    });

    loader.start();
    return resolver.promise;
  }
Tests loading of images until completion.