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

Side by Side Diff: components/password_manager/core/browser/password_autofill_manager_unittest.cc

Issue 2665313002: Add a counter for clicking on Form-Not-Secure warnings (Closed)
Patch Set: rebase fixup again Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/password_manager/core/browser/password_autofill_manager.h" 5 #include "components/password_manager/core/browser/password_autofill_manager.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "base/test/scoped_feature_list.h" 12 #include "base/test/scoped_feature_list.h"
13 #include "base/test/user_action_tester.h"
13 #include "components/autofill/core/browser/popup_item_ids.h" 14 #include "components/autofill/core/browser/popup_item_ids.h"
14 #include "components/autofill/core/browser/suggestion_test_helpers.h" 15 #include "components/autofill/core/browser/suggestion_test_helpers.h"
15 #include "components/autofill/core/browser/test_autofill_client.h" 16 #include "components/autofill/core/browser/test_autofill_client.h"
16 #include "components/autofill/core/browser/test_autofill_driver.h" 17 #include "components/autofill/core/browser/test_autofill_driver.h"
17 #include "components/autofill/core/common/autofill_constants.h" 18 #include "components/autofill/core/common/autofill_constants.h"
18 #include "components/autofill/core/common/autofill_switches.h" 19 #include "components/autofill/core/common/autofill_switches.h"
19 #include "components/autofill/core/common/form_field_data.h" 20 #include "components/autofill/core/common/form_field_data.h"
20 #include "components/autofill/core/common/password_form_fill_data.h" 21 #include "components/autofill/core/common/password_form_fill_data.h"
21 #include "components/password_manager/core/browser/stub_password_manager_client. h" 22 #include "components/password_manager/core/browser/stub_password_manager_client. h"
22 #include "components/password_manager/core/browser/stub_password_manager_driver. h" 23 #include "components/password_manager/core/browser/stub_password_manager_driver. h"
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 EXPECT_CALL(*autofill_client, 782 EXPECT_CALL(*autofill_client,
782 ShowAutofillPopup(element_bounds, _, 783 ShowAutofillPopup(element_bounds, _,
783 SuggestionVectorValuesAre(testing::ElementsAre( 784 SuggestionVectorValuesAre(testing::ElementsAre(
784 title, test_username_)), 785 title, test_username_)),
785 _)); 786 _));
786 password_autofill_manager_->OnShowPasswordSuggestions( 787 password_autofill_manager_->OnShowPasswordSuggestions(
787 dummy_key, base::i18n::RIGHT_TO_LEFT, test_username_, 788 dummy_key, base::i18n::RIGHT_TO_LEFT, test_username_,
788 autofill::IS_PASSWORD_FIELD, element_bounds); 789 autofill::IS_PASSWORD_FIELD, element_bounds);
789 } 790 }
790 791
792 // Test that a user action is logged when the user selects the Form-Not-Secure
793 // warning to receive more information about the warning.
794 TEST_F(PasswordAutofillManagerTest, FormNotSecureUserAction) {
795 std::unique_ptr<TestPasswordManagerClient> client(
796 new TestPasswordManagerClient);
797 std::unique_ptr<MockAutofillClient> autofill_client(new MockAutofillClient);
798 InitializePasswordAutofillManager(client.get(), autofill_client.get());
799 base::UserActionTester user_action_tester;
800 password_autofill_manager_->DidAcceptSuggestion(
801 test_username_, autofill::POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE,
802 0);
803 EXPECT_EQ(1, user_action_tester.GetActionCount(
804 "PasswordManager_ShowedHttpNotSecureExplanation"));
805 }
806
791 } // namespace password_manager 807 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698