function testDetectCascadeDeletion_TableChain() {
  var schema = lf.testing.schemas.getTableChain(lf.ConstraintAction.CASCADE);
  var tableA;
  var tableARow;
  var tableB;
  var tableBRow;
  var tableC;
  var tableCRow;

  return setUpEnvForSchema(schema).then(function() {
    tableA = env.schema.table('TableA');
    tableB = env.schema.table('TableB');
    tableC = env.schema.table('TableC');
    tableARow = tableA.createRow({id: 'tableADummyId'});
    tableBRow = tableB.createRow({
      id: 'tableBDummyId',
      foreignKey: tableARow.payload()['id']
    });
    tableCRow = tableC.createRow({
      id: 'tableCDummyId',
      foreignKey: tableBRow.payload()['id']
    });

    return env.db.insert().into(tableA).values([tableARow]).exec();
  }).then(function() {
    // Checking the case where no referring rows exist.
    var cascadedDeletion = checker.detectCascadeDeletion(tableA, [tableARow]);
    assertEquals(0, cascadedDeletion.tableOrder.length);
    assertEquals(0, cascadedDeletion.rowIdsPerTable.size);

    // Inserting row referring to TableA's row.
    return env.db.insert().into(tableB).values([tableBRow]).exec();
  }).then(function() {
    var cascadedDeletion = checker.detectCascadeDeletion(tableA, [tableARow]);
    // Ensure that TableB's row has been detected for deletion.
    assertEquals(1, cascadedDeletion.tableOrder.length);
    assertArrayEquals([tableB.getName()], cascadedDeletion.tableOrder);
    assertEquals(1, cascadedDeletion.rowIdsPerTable.size);
    assertArrayEquals(
        [tableBRow.id()],
        cascadedDeletion.rowIdsPerTable.get(tableB.getName()));

    // Inserting row referring to TableB's row.
    return env.db.insert().into(tableC).values([tableCRow]).exec();
  }).then(function() {
    var cascadedDeletion = checker.detectCascadeDeletion(tableA, [tableARow]);
    // Ensure that both TableC's and TableB's row have been detected for
    // deletion.
    assertEquals(2, cascadedDeletion.tableOrder.length);
    assertArrayEquals(
        [tableC.getName(), tableB.getName()], cascadedDeletion.tableOrder);
    assertEquals(2, cascadedDeletion.rowIdsPerTable.size);
    assertArrayEquals(
        [tableBRow.id()],
        cascadedDeletion.rowIdsPerTable.get(tableB.getName()));
    assertArrayEquals(
        [tableCRow.id()],
        cascadedDeletion.rowIdsPerTable.get(tableC.getName()));
  });
}
Tests that ConstraintChecker#detectCascadeDeletion() correctly detects
referring rows of the rows that are about to be deleted.
@return {!IThenable}