Index: chrome/browser/ui/passwords/manage_passwords_ui_controller_unittest.cc |
diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller_unittest.cc b/chrome/browser/ui/passwords/manage_passwords_ui_controller_unittest.cc |
index b5c3cec7735550633e779cea316f47504484b2ca..ddf92ce36605aede411820972f9b8395244cbbc5 100644 |
--- a/chrome/browser/ui/passwords/manage_passwords_ui_controller_unittest.cc |
+++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller_unittest.cc |
@@ -155,19 +155,22 @@ TEST_F(ManagePasswordsUIControllerTest, DefaultState) { |
} |
TEST_F(ManagePasswordsUIControllerTest, PasswordAutofilled) { |
- base::string16 kTestUsername = test_local_form().username_value; |
+ scoped_ptr<autofill::PasswordForm> test_form( |
+ new autofill::PasswordForm(test_local_form())); |
+ autofill::PasswordForm* test_form_ptr = test_form.get(); |
+ base::string16 kTestUsername = test_form->username_value; |
autofill::PasswordFormMap map; |
- map[kTestUsername] = &test_local_form(); |
+ map.insert(kTestUsername, test_form.Pass()); |
controller()->OnPasswordAutofilled(map); |
EXPECT_EQ(password_manager::ui::MANAGE_STATE, controller()->state()); |
EXPECT_FALSE(controller()->PasswordPendingUserDecision()); |
- EXPECT_EQ(test_local_form().origin, controller()->origin()); |
+ EXPECT_EQ(test_form_ptr->origin, controller()->origin()); |
ASSERT_EQ(1u, controller()->GetCurrentForms().size()); |
EXPECT_EQ(kTestUsername, controller()->GetCurrentForms()[0]->username_value); |
// Controller should store a separate copy of the form as it doesn't own it. |
- EXPECT_NE(&test_local_form(), controller()->GetCurrentForms()[0]); |
+ EXPECT_NE(test_form_ptr, controller()->GetCurrentForms()[0]); |
ManagePasswordsIconMock mock; |
controller()->UpdateIconAndBubbleState(&mock); |
@@ -288,20 +291,23 @@ TEST_F(ManagePasswordsUIControllerTest, PasswordSubmittedToNonWebbyURL) { |
} |
TEST_F(ManagePasswordsUIControllerTest, BlacklistBlockedAutofill) { |
- test_local_form().blacklisted_by_user = true; |
- base::string16 kTestUsername = test_local_form().username_value; |
+ scoped_ptr<autofill::PasswordForm> test_form( |
+ new autofill::PasswordForm(test_local_form())); |
+ autofill::PasswordForm* test_form_ptr = test_form.get(); |
+ test_form->blacklisted_by_user = true; |
+ base::string16 kTestUsername = test_form->username_value; |
autofill::PasswordFormMap map; |
- map[kTestUsername] = &test_local_form(); |
+ map.insert(kTestUsername, test_form.Pass()); |
controller()->OnBlacklistBlockedAutofill(map); |
EXPECT_EQ(password_manager::ui::BLACKLIST_STATE, controller()->state()); |
EXPECT_FALSE(controller()->PasswordPendingUserDecision()); |
- EXPECT_EQ(test_local_form().origin, controller()->origin()); |
+ EXPECT_EQ(test_form_ptr->origin, controller()->origin()); |
ASSERT_EQ(1u, controller()->GetCurrentForms().size()); |
EXPECT_EQ(kTestUsername, controller()->GetCurrentForms()[0]->username_value); |
// Controller should store a separate copy of the form as it doesn't own it. |
- EXPECT_NE(&test_local_form(), controller()->GetCurrentForms()[0]); |
+ EXPECT_NE(test_form_ptr, controller()->GetCurrentForms()[0]); |
ManagePasswordsIconMock mock; |
controller()->UpdateIconAndBubbleState(&mock); |
@@ -311,8 +317,11 @@ TEST_F(ManagePasswordsUIControllerTest, BlacklistBlockedAutofill) { |
TEST_F(ManagePasswordsUIControllerTest, ClickedUnblacklist) { |
base::string16 kTestUsername = base::ASCIIToUTF16("test_username"); |
autofill::PasswordFormMap map; |
- map[kTestUsername] = &test_local_form(); |
- test_local_form().blacklisted_by_user = true; |
+ scoped_ptr<autofill::PasswordForm> test_form( |
+ new autofill::PasswordForm(test_local_form())); |
+ autofill::PasswordForm& test_form_ref = *test_form; |
+ map.insert(kTestUsername, test_form.Pass()); |
+ test_form_ref.blacklisted_by_user = true; |
controller()->OnBlacklistBlockedAutofill(map); |
controller()->UnblacklistSite(); |
@@ -329,7 +338,8 @@ TEST_F(ManagePasswordsUIControllerTest, UnblacklistedElsewhere) { |
test_local_form().blacklisted_by_user = true; |
base::string16 kTestUsername = base::ASCIIToUTF16("test_username"); |
autofill::PasswordFormMap map; |
- map[kTestUsername] = &test_local_form(); |
+ map.insert(kTestUsername, |
+ make_scoped_ptr(new autofill::PasswordForm(test_local_form()))); |
controller()->OnBlacklistBlockedAutofill(map); |
password_manager::PasswordStoreChange change( |
@@ -349,7 +359,8 @@ TEST_F(ManagePasswordsUIControllerTest, UnblacklistedElsewhere) { |
TEST_F(ManagePasswordsUIControllerTest, BlacklistedElsewhere) { |
base::string16 kTestUsername = base::ASCIIToUTF16("test_username"); |
autofill::PasswordFormMap map; |
- map[kTestUsername] = &test_local_form(); |
+ map.insert(kTestUsername, |
+ make_scoped_ptr(new autofill::PasswordForm(test_local_form()))); |
controller()->OnPasswordAutofilled(map); |
test_local_form().blacklisted_by_user = true; |
@@ -543,9 +554,11 @@ TEST_F(ManagePasswordsUIControllerTest, AutoSigninClickThrough) { |
TEST_F(ManagePasswordsUIControllerTest, InactiveOnPSLMatched) { |
base::string16 kTestUsername = base::ASCIIToUTF16("test_username"); |
autofill::PasswordFormMap map; |
- autofill::PasswordForm psl_matched_test_form = test_local_form(); |
- psl_matched_test_form.original_signon_realm = "http://pslmatched.example.com"; |
- map[kTestUsername] = &psl_matched_test_form; |
+ scoped_ptr<autofill::PasswordForm> psl_matched_test_form( |
+ new autofill::PasswordForm(test_local_form())); |
+ psl_matched_test_form->original_signon_realm = |
+ "http://pslmatched.example.com"; |
+ map.insert(kTestUsername, psl_matched_test_form.Pass()); |
controller()->OnPasswordAutofilled(map); |
EXPECT_EQ(password_manager::ui::INACTIVE_STATE, controller()->state()); |