function execOnLoadWhilePreloadingAndViceVersa(mm) {
  mm = getModuleManager({'c': [], 'd': []});
  mm.setLoader(createSuccessfulNonBatchLoader(mm));

  const origBeforeLoadModuleCode = mm.beforeLoadModuleCode;
  const origSetLoaded = mm.setLoaded;
  const calls = [0, 0];
  mm.beforeLoadModuleCode = (id) => {
    calls[0]++;
    origBeforeLoadModuleCode.call(mm, id);
  };
  mm.setLoaded = () => {
    calls[1]++;
    origSetLoaded.call(mm);
  };

  mm.preloadModule('c', 2);
  assertFalse('module "c" should not be loading yet', mm.isModuleLoading('c'));
  clock.tick(2);
  assertTrue('module "c" should now be loading', mm.isModuleLoading('c'));
  mm.execOnLoad('c', () => {});
  assertTrue('module "c" should still be loading', mm.isModuleLoading('c'));
  clock.tick(5);
  assertFalse('module "c" should be done loading', mm.isModuleLoading('c'));
  assertEquals('beforeLoad should only be called once for "c"', 1, calls[0]);
  assertEquals('setLoaded should only be called once for "c"', 1, calls[1]);

  mm.execOnLoad('d', () => {});
  assertTrue('module "d" should now be loading', mm.isModuleLoading('d'));
  mm.preloadModule('d', 2);
  clock.tick(5);
  assertFalse('module "d" should be done loading', mm.isModuleLoading('d'));
  assertTrue('module "d" should now be loaded', mm.isModuleLoaded('d'));
  assertEquals('beforeLoad should only be called once for "d"', 2, calls[0]);
  assertEquals('setLoaded should only be called once for "d"', 2, calls[1]);
}
Perform tests with the specified module manager.
@param {ModuleManager} mm The module manager.
@suppress {missingProperties} suppression added to enable type checking