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

Unified Diff: components/password_manager/content/browser/credential_manager_dispatcher_unittest.cc

Issue 1735013004: CREDENTIAL: Only toggle 'skip_zero_click' state if API is used. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ugh. Created 4 years, 10 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: components/password_manager/content/browser/credential_manager_dispatcher_unittest.cc
diff --git a/components/password_manager/content/browser/credential_manager_dispatcher_unittest.cc b/components/password_manager/content/browser/credential_manager_dispatcher_unittest.cc
index 46d4aba51069b10d49d66e6ff727abdcc6461640..e59d4e33629e4ce36dfd702795b7338c99578c71 100644
--- a/components/password_manager/content/browser/credential_manager_dispatcher_unittest.cc
+++ b/components/password_manager/content/browser/credential_manager_dispatcher_unittest.cc
@@ -56,7 +56,7 @@ class MockPasswordManagerClient : public StubPasswordManagerClient {
MOCK_CONST_METHOD0(DidLastPageLoadEncounterSSLErrors, bool());
MOCK_METHOD1(NotifyUserAutoSigninPtr,
bool(const std::vector<autofill::PasswordForm*>& local_forms));
- MOCK_METHOD1(NotifyUserAutoSigninBlockedOnFirstRunPtr,
+ MOCK_METHOD1(NotifyUserCouldBeAutoSignedInPtr,
bool(autofill::PasswordForm* form));
MOCK_METHOD2(PromptUserToSavePasswordPtr,
void(PasswordFormManager*, CredentialSourceType type));
@@ -82,9 +82,9 @@ class MockPasswordManagerClient : public StubPasswordManagerClient {
return true;
}
- void NotifyUserAutoSigninBlockedOnFirstRun(
+ void NotifyUserCouldBeAutoSignedIn(
scoped_ptr<autofill::PasswordForm> form) override {
- NotifyUserAutoSigninBlockedOnFirstRunPtr(form.get());
+ NotifyUserCouldBeAutoSignedInPtr(form.get());
}
PasswordStore* GetPasswordStore() const override { return store_; }
@@ -626,7 +626,7 @@ TEST_F(CredentialManagerDispatcherTest,
std::vector<GURL> federations;
- EXPECT_CALL(*client_, NotifyUserAutoSigninBlockedOnFirstRunPtr(_)).Times(0);
+ EXPECT_CALL(*client_, NotifyUserCouldBeAutoSignedInPtr(_)).Times(0);
dispatcher()->OnRequestCredential(kRequestId, true, true, federations);
ExpectZeroClickSignInSuccess(CredentialType::CREDENTIAL_TYPE_PASSWORD);
@@ -639,7 +639,7 @@ TEST_F(CredentialManagerDispatcherTest,
std::vector<GURL> federations;
- EXPECT_CALL(*client_, NotifyUserAutoSigninBlockedOnFirstRunPtr(_)).Times(0);
+ EXPECT_CALL(*client_, NotifyUserCouldBeAutoSignedInPtr(_)).Times(0);
dispatcher()->OnRequestCredential(kRequestId, true, false, federations);
ExpectZeroClickSignInFailure();
@@ -654,7 +654,7 @@ TEST_F(CredentialManagerDispatcherTest,
std::vector<GURL> federations;
federations.push_back(GURL("https://example.com/"));
- EXPECT_CALL(*client_, NotifyUserAutoSigninBlockedOnFirstRunPtr(_)).Times(0);
+ EXPECT_CALL(*client_, NotifyUserCouldBeAutoSignedInPtr(_)).Times(0);
dispatcher()->OnRequestCredential(kRequestId, true, true, federations);
ExpectZeroClickSignInSuccess(CredentialType::CREDENTIAL_TYPE_FEDERATED);
@@ -669,7 +669,7 @@ TEST_F(CredentialManagerDispatcherTest,
std::vector<GURL> federations;
federations.push_back(GURL("https://not-example.com/"));
- EXPECT_CALL(*client_, NotifyUserAutoSigninBlockedOnFirstRunPtr(_)).Times(0);
+ EXPECT_CALL(*client_, NotifyUserCouldBeAutoSignedInPtr(_)).Times(0);
dispatcher()->OnRequestCredential(kRequestId, true, true, federations);
ExpectZeroClickSignInFailure();
@@ -770,7 +770,22 @@ TEST_F(CredentialManagerDispatcherTest, RequestCredentialWithoutFirstRun) {
std::vector<GURL> federations;
EXPECT_CALL(*client_,
- NotifyUserAutoSigninBlockedOnFirstRunPtr(testing::Pointee(form_)))
+ NotifyUserCouldBeAutoSignedInPtr(testing::Pointee(form_)))
+ .Times(1);
+ dispatcher()->OnRequestCredential(kRequestId, true, true, federations);
+
+ ExpectZeroClickSignInFailure();
+}
+
+TEST_F(CredentialManagerDispatcherTest, RequestCredentialWithFirstRunAndSkip) {
+ client_->set_first_run_seen(true);
+
+ form_.skip_zero_click = true;
+ store_->AddLogin(form_);
+
+ std::vector<GURL> federations;
+ EXPECT_CALL(*client_,
+ NotifyUserCouldBeAutoSignedInPtr(testing::Pointee(form_)))
.Times(1);
dispatcher()->OnRequestCredential(kRequestId, true, true, federations);

Powered by Google App Engine
This is Rietveld 408576698