Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2143)

Unified Diff: chrome/browser/password_manager/chrome_password_manager_client_unittest.cc

Issue 2344943002: Make ChromePasswordManagerClient::BindCredentialManager handle missing client gracefully (Closed)
Patch Set: Make ChromePasswordManagerClient::BindCredentialManager handle missing client gracefully Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/password_manager/chrome_password_manager_client.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/password_manager/chrome_password_manager_client_unittest.cc
diff --git a/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc b/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc
index 82edfffa98a167ce0d119560cfe8d464c7265ace..b47c5760b9b8b55c318669e8ba7bb5638bf8b38c 100644
--- a/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc
+++ b/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc
@@ -549,3 +549,21 @@ TEST_F(ChromePasswordManagerClientTest, AnnotateNavigationEntryTrueToFalse) {
SerializedNavigationEntry::HAS_PASSWORD_FIELD,
GetPasswordStateFromNavigation(*controller().GetLastCommittedEntry()));
}
+
+// Handle missing ChromePasswordManagerClient instance in BindCredentialManager
+// gracefully.
+TEST_F(ChromePasswordManagerClientTest, BindCredentialManager_MissingInstance) {
+ // Create a WebContent without tab helpers.
+ std::unique_ptr<content::WebContents> web_contents(
+ content::WebContents::Create(
+ content::WebContents::CreateParams(profile())));
+ // In particular, this WebContent should not have the
+ // ChromePasswordManagerClient.
+ ASSERT_FALSE(
+ ChromePasswordManagerClient::FromWebContents(web_contents.get()));
+
+ // This call should not crash.
+ ChromePasswordManagerClient::BindCredentialManager(
+ web_contents->GetMainFrame(),
+ password_manager::mojom::CredentialManagerRequest());
+}
« no previous file with comments | « chrome/browser/password_manager/chrome_password_manager_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698