graduation: Fix flaky GraduationAppIntegrationTest

The bound callback was not being invoked before the handler is
destructed, so wrap the callback with
WrapCallbackWithDefaultInvokeIfNotRun with a default value of false.

Bug: b:401413589
Tested: Ran the test 10 times with 100% pass rate
Change-Id: I459171f02b02c27196d430cb23cee25753f0ab49
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6351895
Commit-Queue: Courtney Wong <courtneywong@chromium.org>
Reviewed-by: Aga Wronska <agawronska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1432340}
diff --git a/ash/webui/graduation/graduation_ui_handler.cc b/ash/webui/graduation/graduation_ui_handler.cc
index 3122173..99263f2 100644
--- a/ash/webui/graduation/graduation_ui_handler.cc
+++ b/ash/webui/graduation/graduation_ui_handler.cc
@@ -14,6 +14,7 @@
 #include "base/functional/bind.h"
 #include "base/functional/callback_helpers.h"
 #include "components/user_manager/user.h"
+#include "mojo/public/cpp/bindings/callback_helpers.h"
 #include "mojo/public/cpp/bindings/pending_receiver.h"
 #include "ui/base/webui/web_ui_util.h"
 #include "ui/gfx/image/image.h"
@@ -48,8 +49,10 @@
 void GraduationUiHandler::AuthenticateWebview(
     AuthenticateWebviewCallback callback) {
   auth_handler_->AuthenticateWebview(
-      base::BindOnce(&GraduationUiHandler::OnAuthenticationFinished,
-                     base::Unretained(this), std::move(callback)));
+      mojo::WrapCallbackWithDefaultInvokeIfNotRun(
+          base::BindOnce(&GraduationUiHandler::OnAuthenticationFinished,
+                         base::Unretained(this), std::move(callback)),
+          false));
 }
 
 void GraduationUiHandler::GetProfileInfo(GetProfileInfoCallback callback) {