tests/integration/scenarios/mediaCapabilitiesProber/getCompatibleDRM.js
/**
 * Mock requestMediaKeySystemAccess delivering either mediaKeySystemAccess
 * or rejecting (start with rejection).
 */
Mock requestMediaKeySystemAccess delivering either mediaKeySystemAccess
or rejecting (start with rejection).
Mock requestMediaKeySystemAccess delivering either mediaKeySystemAccess or rejecting ( start with rejection ) .
function mockMixedResultsRMKSA() {
  let i = 0;
  const saveRMKSA = navigator.requestMediaKeySystemAccess;
  navigator.requestMediaKeySystemAccess = (_, configurations) => {
    return new Promise((resolve, reject) => {
      i++;
      if (i % 2) {
        reject();
        return;
      }
      resolve({
        getConfiguration: () => {
          return configurations[0];
        },
      });
    });
  };
  return function reset() {
    navigator.requestMediaKeySystemAccess = saveRMKSA;
  };
}
function mockMixedResultsRMKSA ( ) { let i = 0 ; const saveRMKSA = navigator . requestMediaKeySystemAccess ; navigator . requestMediaKeySystemAccess = ( _ , configurations ) => { return new Promise ( ( resolve , reject ) => { i ++ ; if ( i % 2 ) { reject ( ) ; return ; } resolve ( { getConfiguration : ( ) => { return configurations [ 0 ] ; } , } ) ; } ) ; } ; return function reset ( ) { navigator . requestMediaKeySystemAccess = saveRMKSA ; } ; }
Mock requestMediaKeySystemAccess delivering either mediaKeySystemAccess
 or rejecting (start with rejection).
Mock requestMediaKeySystemAccess delivering either mediaKeySystemAccess or rejecting ( start with rejection ) .