function testPersistedIndices() {
  /**
   * Inserts 5 records to the database.
   * @return {!IThenable}
   */
  var insertFn = function() {
    return db.
        insert().
        into(table).
        values(generateSampleRows()).
        exec();
  };

  /**
   * Upadates the 'name' field of rows 1 and 3.
   * @return {!IThenable}
   */
  var updateFn = function() {
    var updatedDate = new Date(0);
    sampleRows[1].setBegin(updatedDate);
    sampleRows[3].setBegin(updatedDate);

    return db.
        update(table).
        where(table.name.in(
            [sampleRows[1].getName(), sampleRows[3].getName()])).
        set(table.begin, updatedDate).
        exec();
  };

  /**
   * Replaces rows 1 and 3.
   * @return {!IThenable}
   */
  var replaceFn = function() {
    var sampleRow1 = sampleRows[1];
    sampleRow1.setBegin(new Date(2015, 0, 20));
    sampleRow1.setEnd(new Date(2015, 0, 21));

    var sampleRow3 = sampleRows[1];
    sampleRow3.setBegin(new Date(2015, 6, 3));
    sampleRow3.setEnd(new Date(2015, 6, 5));

    var replacedRow1 = table.createRow({
      name: sampleRow1.getName(),
      begin: sampleRow1.getBegin(),
      end: sampleRow1.getEnd()
    });
    var replacedRow3 = table.createRow({
      name: sampleRow3.getName(),
      begin: sampleRow3.getBegin(),
      end: sampleRow3.getEnd()
    });

    return db.
        insertOrReplace().
        into(table).
        values([replacedRow1, replacedRow3]).
        exec();
  };

  /**
   * Deletes rows 2 and 3.
   * @return {!IThenable}
   */
  var deleteFn = function() {
    // Removing 'Holiday2' and 'Holiday3' rows.
    var removedRows = sampleRows.splice(2, 2);

    return db.
        delete().
        from(table).
        where(table.name.in(
            [removedRows[0].getName(), removedRows[1].getName()])).
        exec();
  };


  /**
   * Deletes all remaining rows.
   * @return {!IThenable}
   */
  var deleteAllFn = function() {
    sampleRows.length = 0;

    return db.
        delete().
        from(table).
        exec();
  };

  return insertFn().then(
      function() {
        return assertAllIndicesPopulated(table, sampleRows);
      }).then(
      function() {
        return updateFn();
      }).then(
      function() {
        return assertAllIndicesPopulated(table, sampleRows);
      }).then(
      function() {
        return replaceFn();
      }).then(
      function() {
        return assertAllIndicesPopulated(table, sampleRows);
      }).then(
      function() {
        return deleteFn();
      }).then(
      function() {
        return assertAllIndicesPopulated(table, sampleRows);
      }).then(
      function() {
        return deleteAllFn();
      }).then(
      function() {
        return assertAllIndicesPopulated(table, sampleRows);
      });
}
Performs insert, update, replace, delete operations and verifies that
persisted indices are being updated appropriately on disk.
@return {!IThenable}