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

Unified Diff: chrome/browser/ui/passwords/manage_passwords_state_unittest.cc

Issue 1832933002: Update the |skip_zero_click| flag of a credential when selected in the account chooser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 4 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/ui/passwords/manage_passwords_state_unittest.cc
diff --git a/chrome/browser/ui/passwords/manage_passwords_state_unittest.cc b/chrome/browser/ui/passwords/manage_passwords_state_unittest.cc
index 8fc1a57dc82c6bbb2d3119f57f41644438c14fe9..8958abe86cb2febabc9f5a79b332b2fb5a6e2e96 100644
--- a/chrome/browser/ui/passwords/manage_passwords_state_unittest.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_state_unittest.cc
@@ -12,7 +12,6 @@
#include "components/password_manager/core/browser/password_manager.h"
#include "components/password_manager/core/browser/stub_password_manager_client.h"
#include "components/password_manager/core/browser/stub_password_manager_driver.h"
-#include "components/password_manager/core/common/credential_manager_types.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
@@ -84,8 +83,7 @@ class ManagePasswordsStateTest : public testing::Test {
// Pushes a blacklisted form and checks that it doesn't affect the state.
void TestBlacklistedUpdates();
- MOCK_METHOD1(CredentialCallback,
- void(const password_manager::CredentialInfo&));
+ MOCK_METHOD1(CredentialCallback, void(const autofill::PasswordForm*));
private:
// Implements both CreateFormManager and CreateFormManagerWithFederation.
@@ -339,14 +337,8 @@ TEST_F(ManagePasswordsStateTest, OnRequestCredentials) {
EXPECT_EQ(origin, passwords_data().origin());
TestAllUpdates();
- password_manager::CredentialInfo credential_info(
- test_local_form(),
- password_manager::CredentialType::CREDENTIAL_TYPE_PASSWORD);
- EXPECT_CALL(*this, CredentialCallback(_))
- .WillOnce(testing::SaveArg<0>(&credential_info));
+ EXPECT_CALL(*this, CredentialCallback(nullptr));
passwords_data().TransitionToState(password_manager::ui::MANAGE_STATE);
- EXPECT_EQ(password_manager::CredentialType::CREDENTIAL_TYPE_EMPTY,
- credential_info.type);
EXPECT_TRUE(passwords_data().credentials_callback().is_null());
EXPECT_THAT(passwords_data().GetCurrentForms(),
ElementsAre(Pointee(test_local_form())));
@@ -662,59 +654,31 @@ TEST_F(ManagePasswordsStateTest, ChooseCredentialLocal) {
test_local_form().origin);
passwords_data().set_credentials_callback(base::Bind(
&ManagePasswordsStateTest::CredentialCallback, base::Unretained(this)));
- password_manager::CredentialInfo credential_info(
- test_local_form(),
- password_manager::CredentialType::CREDENTIAL_TYPE_PASSWORD);
- EXPECT_CALL(*this, CredentialCallback(credential_info));
- passwords_data().ChooseCredential(
- test_local_form(),
- password_manager::CredentialType::CREDENTIAL_TYPE_PASSWORD);
-}
-
-TEST_F(ManagePasswordsStateTest, ChooseCredentialFederated) {
- passwords_data().OnRequestCredentials(ScopedVector<autofill::PasswordForm>(),
- ScopedVector<autofill::PasswordForm>(),
- test_local_form().origin);
- passwords_data().set_credentials_callback(base::Bind(
- &ManagePasswordsStateTest::CredentialCallback, base::Unretained(this)));
- password_manager::CredentialInfo credential_info(
- test_federated_form(),
- password_manager::CredentialType::CREDENTIAL_TYPE_FEDERATED);
- EXPECT_CALL(*this, CredentialCallback(credential_info));
- passwords_data().ChooseCredential(
- test_federated_form(),
- password_manager::CredentialType::CREDENTIAL_TYPE_FEDERATED);
+ EXPECT_CALL(*this, CredentialCallback(&test_local_form()));
+ passwords_data().ChooseCredential(&test_local_form());
}
TEST_F(ManagePasswordsStateTest, ChooseCredentialEmpty) {
passwords_data().OnRequestCredentials(ScopedVector<autofill::PasswordForm>(),
ScopedVector<autofill::PasswordForm>(),
test_local_form().origin);
- autofill::PasswordForm password_form(test_local_form());
passwords_data().set_credentials_callback(base::Bind(
&ManagePasswordsStateTest::CredentialCallback, base::Unretained(this)));
password_manager::CredentialInfo credential_info(
test_federated_form(),
password_manager::CredentialType::CREDENTIAL_TYPE_EMPTY);
- EXPECT_CALL(*this, CredentialCallback(credential_info));
- passwords_data().ChooseCredential(
- test_federated_form(),
- password_manager::CredentialType::CREDENTIAL_TYPE_EMPTY);
+ EXPECT_CALL(*this, CredentialCallback(nullptr));
+ passwords_data().ChooseCredential(nullptr);
}
TEST_F(ManagePasswordsStateTest, ChooseCredentialLocalWithNonEmptyFederation) {
passwords_data().OnRequestCredentials(ScopedVector<autofill::PasswordForm>(),
ScopedVector<autofill::PasswordForm>(),
test_local_form().origin);
- autofill::PasswordForm form(test_federated_form());
- form.federation_origin = url::Origin(GURL("https://federation.test/"));
passwords_data().set_credentials_callback(base::Bind(
&ManagePasswordsStateTest::CredentialCallback, base::Unretained(this)));
- password_manager::CredentialInfo credential_info(
- form, password_manager::CredentialType::CREDENTIAL_TYPE_FEDERATED);
- EXPECT_CALL(*this, CredentialCallback(credential_info));
- passwords_data().ChooseCredential(
- form, password_manager::CredentialType::CREDENTIAL_TYPE_PASSWORD);
+ EXPECT_CALL(*this, CredentialCallback(&test_local_federated_form()));
+ passwords_data().ChooseCredential(&test_local_federated_form());
}
} // namespace
« no previous file with comments | « chrome/browser/ui/passwords/manage_passwords_state.cc ('k') | chrome/browser/ui/passwords/manage_passwords_ui_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698