async function assertFullVersionOf(brandVersions, alreadyLoaded = false) {
  // A test will call this function with alreadyLoaded = true if it is
  // expected that versions will be synchronously available without calling
  // load() for the first time. Otherwise, it should be expected that
  // getIfLoaded returns undefined.
  for (const {brand, version} of brandVersions) {
    const fullVersion = userAgentBrowser.fullVersionOf(brand);
    assertNotNullNorUndefined(fullVersion);
    if (!alreadyLoaded) {
      // Check that the version hasn't already been loaded yet.
      assertNullOrUndefined(fullVersion.getIfLoaded());
    }

    // Check that for each given brand-version pair, the requested version
    // matches what is expected for the given brand.
    assertEquals(
        version, (await fullVersion.load()).toVersionStringForLogging());
    assertEquals(
        version, fullVersion.getIfLoaded()?.toVersionStringForLogging());
  }

  // Check that for all other browsers, there is no version for each brand.
  for (const brand of brands) {
    if (!brandVersions.find(brandVersion => brandVersion.brand === brand)) {
      assertUndefined(
          `fullVersionOf(${brand}) returns a value for a browser that is not ${
              brand}`,
          userAgentBrowser.fullVersionOf(brand));
    }
  }
}
Assert that fullVersionOf returns the correct full version for each given
brand, and correctly returns undefined for brands not in the list.
@param {!Array<!BrandFullVersion>} brandVersions A list of objects
    that represent which brands the browser is expected to match, and their
    corresponding versions.
@param {boolean=} alreadyLoaded Whether the full version container is
    expected to be cached and fully loaded already.