function runTest(builder, onUpgrade, checker, opt_populateOldData) {
  stub.replace(window, 'openDatabase', openDatabaseStub);

  var promise = opt_populateOldData ?
      populateOldData() : goog.Promise.resolve();

  return promise.then(function() {
    // Re-register schema
    upgradeGlobal.registerService(lf.service.SCHEMA, builder.getSchema());
    upgradeGlobal.registerService(lf.service.CACHE,
        new lf.cache.DefaultCache(builder.getSchema()));
    return builder.connect({
      onUpgrade: onUpgrade,
      storeType: lf.schema.DataStoreType.WEB_SQL
    });
  }).then(function(db) {
    var tableA = db.getSchema().tables()[0];
    return db.select().from(tableA).exec();
  }).then(function(results) {
    checker(results);
    return goog.Promise.resolve();
  });
}
@param {!lf.schema.Builder} builder
@param {!function(!lf.raw.BackStore):!IThenable} onUpgrade
@param {!function(!Array<!Object>)} checker
@param {boolean=} opt_populateOldData
@return {!IThenable}