Fix VisibleSecurityStateChangedForUnsafeSubresource test with CI
VisibleSecurityStateChangedForUnsafeSubresource was crashing with
committed interstitials enabled since it calls DisplayBlockingPage
without a callback set in the UnsafeResource, this adds a no-op
callback to prevent the crash.
Bug: 940551
Change-Id: I4902133045ebe33637a4ed25d5b76882cc48b956
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2008004
Commit-Queue: Carlos IL <[email protected]>
Commit-Queue: Daniel Rubery <[email protected]>
Auto-Submit: Carlos IL <[email protected]>
Reviewed-by: Daniel Rubery <[email protected]>
Cr-Commit-Position: refs/heads/master@{#733106}
diff --git a/chrome/browser/safe_browsing/ui_manager_unittest.cc b/chrome/browser/safe_browsing/ui_manager_unittest.cc
index 0ae8bfb..c09f9d8 100644
--- a/chrome/browser/safe_browsing/ui_manager_unittest.cc
+++ b/chrome/browser/safe_browsing/ui_manager_unittest.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/safe_browsing/ui_manager.h"
#include "base/bind.h"
+#include "base/bind_helpers.h"
#include "base/run_loop.h"
#include "base/task/post_task.h"
#include "chrome/browser/net/system_network_context_manager.h"
@@ -504,6 +505,13 @@
MakeUnsafeResource(kBadURL, true /* is_subresource */);
// Needed for showing the blocking page.
resource.threat_source = safe_browsing::ThreatSource::REMOTE;
+
+ // The callback needs to be set for committed interstitials, just set it to do
+ // nothing.
+ resource.callback = base::DoNothing();
+ resource.callback_thread =
+ base::CreateSingleThreadTaskRunner({BrowserThread::IO});
+
NavigateAndCommit(GURL("http://example.test"));
delegate.ClearVisibleSecurityStateChanged();