static populateDatabase_(db, savedDatabase) {
    return new Promise((resolve, reject) => {
      const transactionType = 'readwrite';
      const storeNames = Object.keys(savedDatabase.stores);
      const transaction = db.transaction(storeNames, transactionType);

      for (const storeName in savedDatabase.stores) {
        const store = transaction.objectStore(storeName);
        const storeInfo = savedDatabase.stores[storeName];

        shaka.log.debug('Populating store', storeName, 'with',
            storeInfo.data.length, 'entries');
        for (const item of storeInfo.data) {
          // If this store uses an explicit keyPath, we can't specify a key.
          if (storeInfo.parameters.keyPath) {
            store.add(item.value);
          } else {
            store.add(item.value, item.key);
          }
        }
      }

      transaction.oncomplete = (event) => {
        resolve();
      };

      transaction.onerror = (event) => {
        reject(event.error);
        event.preventDefault();
      };
    });
  }
@param {IDBDatabase} db An open database connection.
@param {shaka.test.CannedIDB.SavedDatabase} savedDatabase An object
  containing the database definition and the data to populate it with.
@return {!Promise} Resolved when the named DB has been populated with data.
@private