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

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

Issue 1031153002: [Credential Management] Smart lock save Credentials bubble should not always pop up. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
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 0a497986eec18625570c7989a574143e9481d622..355dd1ca80b67c8c513de1660e97d93302947674 100644
--- a/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc
+++ b/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc
@@ -50,12 +50,30 @@ class TestChromePasswordManagerClient : public ChromePasswordManagerClient {
return is_sync_account_credential_;
}
+ bool DidLastPageLoadEncounterSSLErrors() const override {
+ return ssl_errors_;
+ }
+
+ bool IsPasswordManagerEnabledForCurrentPage() const override {
+ return is_password_manager_enabled_for_current_page_;
+ }
+
void set_is_sync_account_credential(bool is_sync_account_credential) {
is_sync_account_credential_ = is_sync_account_credential;
}
+ void set_ssl_errors(bool ssl_errors) { ssl_errors_ = ssl_errors; }
+
+ void set_is_password_manager_enabled_for_current_page(
+ bool is_password_manager_enabled_for_current_page) {
+ is_password_manager_enabled_for_current_page_ =
+ is_password_manager_enabled_for_current_page;
+ }
+
private:
bool is_sync_account_credential_;
+ bool is_password_manager_enabled_for_current_page_;
+ bool ssl_errors_;
DISALLOW_COPY_AND_ASSIGN(TestChromePasswordManagerClient);
};
@@ -274,6 +292,26 @@ TEST_F(ChromePasswordManagerClientTest, ShouldFilterAutofillResult) {
EXPECT_TRUE(client->ShouldFilterAutofillResult(form));
}
+TEST_F(ChromePasswordManagerClientTest, IsEnabledForCurrentPage) {
vabr (Chromium) 2015/03/26 14:51:59 If you get rid of IsEnabledForCurrentPage, then of
melandory 2015/03/30 09:50:17 Done.
+ scoped_ptr<TestChromePasswordManagerClient> client(
+ new TestChromePasswordManagerClient(web_contents()));
+ client->set_ssl_errors(true);
+ client->set_is_password_manager_enabled_for_current_page(true);
+ EXPECT_FALSE(client->IsEnabledForCurrentPage());
+
+ client->set_ssl_errors(true);
+ client->set_is_password_manager_enabled_for_current_page(false);
+ EXPECT_FALSE(client->IsEnabledForCurrentPage());
+
+ client->set_ssl_errors(false);
+ client->set_is_password_manager_enabled_for_current_page(false);
+ EXPECT_FALSE(client->IsEnabledForCurrentPage());
+
+ client->set_ssl_errors(false);
+ client->set_is_password_manager_enabled_for_current_page(true);
+ EXPECT_TRUE(client->IsEnabledForCurrentPage());
+}
+
TEST_F(ChromePasswordManagerClientTest,
IsPasswordManagerEnabledForCurrentPage) {
ChromePasswordManagerClient* client = GetClient();

Powered by Google App Engine
This is Rietveld 408576698