function testShowDialog_dialogClosedByOtherMeans() {
  dialog = goog.soy.renderAsElement(
      firebaseui.auth.soy2.element.dialog,
      {content: 'Hello, world!'});
  dialog.close = function() {};
  var mockClose = mockControl.createMethodMock(dialog, 'close');
  mockUpgrade(dialog);
  mockDowngrade(dialog);
  mockClose().$never();

  mockControl.$replayAll();

  // Show the dialog.
  firebaseui.auth.ui.element.dialog.showDialog.call(component, dialog);
  assertTrue(document.body.contains(dialog));
  assertEquals(dialog, firebaseui.auth.ui.element.dialog.getDialogElement());

  // Simulate the dialog being closed by hitting the escape key. This hides
  // the dialog but does not remove it from the DOM..
  dialog.open = false;

  // Dismiss the dialog. The dialog should be removed from the DOM at this
  // point.
  firebaseui.auth.ui.element.dialog.dismissDialog();
  assertFalse(document.body.contains(dialog));
  assertNull(firebaseui.auth.ui.element.dialog.getDialogElement());
}
Test that dismissDialog still works if the dialog has been closed by some
other means. For example, the ESC key closes the HTML5 dialog.