Safely dismiss ExportWarningDialogFragment

The ExportWarningDialogFragment should be able to be safely dismissed
even if it was not fully initialized. The fragment can be shown on
re-creation of Chrome by Android, in which case it does not get
initialized, and dismisses itself for that very reason. However, the
current onDismiss procedure tries to call back to a handler obtained
during initialization.

This CL makes that calling back optional, only for cases when the
handler is already set.

Bug: 816377
Change-Id: Ib9e1b498e7dbb14afc31634a48829782cb4b020b
Reviewed-on: https://chromium-review.googlesource.com/939461
Reviewed-by: Finnur Thorarinsson <[email protected]>
Reviewed-by: Jochen Eisinger <[email protected]>
Commit-Queue: Vaclav Brozek <[email protected]>
Cr-Commit-Position: refs/heads/master@{#539762}
diff --git a/chrome/android/java_sources.gni b/chrome/android/java_sources.gni
index 3678611..92c5d20d 100644
--- a/chrome/android/java_sources.gni
+++ b/chrome/android/java_sources.gni
@@ -1996,6 +1996,7 @@
   "junit/src/org/chromium/chrome/browser/physicalweb/PwsResultTest.java",
   "junit/src/org/chromium/chrome/browser/physicalweb/UrlInfoTest.java",
   "junit/src/org/chromium/chrome/browser/preferences/privacy/PrivacyPreferencesManagerTest.java",
+  "junit/src/org/chromium/chrome/browser/preferences/password/ExportWarningDialogFragmentTest.java",
   "junit/src/org/chromium/chrome/browser/preferences/password/PasswordReauthenticationFragmentTest.java",
   "junit/src/org/chromium/chrome/browser/preferences/password/ReauthenticationManagerTest.java",
   "junit/src/org/chromium/chrome/browser/signin/SigninPromoUtilTest.java",