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

Side by Side Diff: chrome/browser/password_manager/native_backend_gnome_x_unittest.cc

Issue 508143002: Remove Finch kill switch for PSL matching (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <stdarg.h> 5 #include <stdarg.h>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 return true; 527 return true;
528 } 528 }
529 529
530 // Test that updating does not use PSL matching: Add a www.facebook.com 530 // Test that updating does not use PSL matching: Add a www.facebook.com
531 // password, then use PSL matching to get a copy of it for m.facebook.com, and 531 // password, then use PSL matching to get a copy of it for m.facebook.com, and
532 // add that copy as well. Now update the www.facebook.com password -- the 532 // add that copy as well. Now update the www.facebook.com password -- the
533 // m.facebook.com password should not get updated. Depending on the argument, 533 // m.facebook.com password should not get updated. Depending on the argument,
534 // the credential update is done via UpdateLogin or AddLogin. 534 // the credential update is done via UpdateLogin or AddLogin.
535 void CheckPSLUpdate(UpdateType update_type) { 535 void CheckPSLUpdate(UpdateType update_type) {
536 password_manager::PSLMatchingHelper helper; 536 password_manager::PSLMatchingHelper helper;
537 ASSERT_TRUE(helper.IsMatchingEnabled());
538 537
539 NativeBackendGnome backend(321); 538 NativeBackendGnome backend(321);
540 backend.Init(); 539 backend.Init();
541 540
542 // Add |form_facebook_| to saved logins. 541 // Add |form_facebook_| to saved logins.
543 BrowserThread::PostTask( 542 BrowserThread::PostTask(
544 BrowserThread::DB, 543 BrowserThread::DB,
545 FROM_HERE, 544 FROM_HERE,
546 base::Bind(base::IgnoreResult(&NativeBackendGnome::AddLogin), 545 base::Bind(base::IgnoreResult(&NativeBackendGnome::AddLogin),
547 base::Unretained(&backend), 546 base::Unretained(&backend),
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 EXPECT_EQ(1u, mock_keyring_items.size()); 793 EXPECT_EQ(1u, mock_keyring_items.size());
795 if (mock_keyring_items.size() > 0) 794 if (mock_keyring_items.size() > 0)
796 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome-42"); 795 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome-42");
797 } 796 }
798 797
799 // Save a password for www.facebook.com and see it suggested for m.facebook.com. 798 // Save a password for www.facebook.com and see it suggested for m.facebook.com.
800 TEST_F(NativeBackendGnomeTest, PSLMatchingPositive) { 799 TEST_F(NativeBackendGnomeTest, PSLMatchingPositive) {
801 PasswordForm result; 800 PasswordForm result;
802 const GURL kMobileURL("http://m.facebook.com/"); 801 const GURL kMobileURL("http://m.facebook.com/");
803 password_manager::PSLMatchingHelper helper; 802 password_manager::PSLMatchingHelper helper;
804 ASSERT_TRUE(helper.IsMatchingEnabled());
805 EXPECT_TRUE(CheckCredentialAvailability( 803 EXPECT_TRUE(CheckCredentialAvailability(
806 form_facebook_, kMobileURL, PasswordForm::SCHEME_HTML, &result)); 804 form_facebook_, kMobileURL, PasswordForm::SCHEME_HTML, &result));
807 EXPECT_EQ(kMobileURL, result.origin); 805 EXPECT_EQ(kMobileURL, result.origin);
808 EXPECT_EQ(kMobileURL.spec(), result.signon_realm); 806 EXPECT_EQ(kMobileURL.spec(), result.signon_realm);
809 } 807 }
810 808
811 // Save a password for www.facebook.com and see it not suggested for 809 // Save a password for www.facebook.com and see it not suggested for
812 // m-facebook.com. 810 // m-facebook.com.
813 TEST_F(NativeBackendGnomeTest, PSLMatchingNegativeDomainMismatch) { 811 TEST_F(NativeBackendGnomeTest, PSLMatchingNegativeDomainMismatch) {
814 password_manager::PSLMatchingHelper helper; 812 password_manager::PSLMatchingHelper helper;
815 ASSERT_TRUE(helper.IsMatchingEnabled());
816 EXPECT_FALSE(CheckCredentialAvailability( 813 EXPECT_FALSE(CheckCredentialAvailability(
817 form_facebook_, GURL("http://m-facebook.com/"), 814 form_facebook_, GURL("http://m-facebook.com/"),
818 PasswordForm::SCHEME_HTML, NULL)); 815 PasswordForm::SCHEME_HTML, NULL));
819 } 816 }
820 817
821 // Test PSL matching is off for domains excluded from it. 818 // Test PSL matching is off for domains excluded from it.
822 TEST_F(NativeBackendGnomeTest, PSLMatchingDisabledDomains) { 819 TEST_F(NativeBackendGnomeTest, PSLMatchingDisabledDomains) {
823 password_manager::PSLMatchingHelper helper; 820 password_manager::PSLMatchingHelper helper;
824 ASSERT_TRUE(helper.IsMatchingEnabled());
825 EXPECT_FALSE(CheckCredentialAvailability( 821 EXPECT_FALSE(CheckCredentialAvailability(
826 form_google_, GURL("http://one.google.com/"), 822 form_google_, GURL("http://one.google.com/"),
827 PasswordForm::SCHEME_HTML, NULL)); 823 PasswordForm::SCHEME_HTML, NULL));
828 } 824 }
829 825
830 // Make sure PSL matches aren't available for non-HTML forms. 826 // Make sure PSL matches aren't available for non-HTML forms.
831 TEST_F(NativeBackendGnomeTest, PSLMatchingDisabledForNonHTMLForms) { 827 TEST_F(NativeBackendGnomeTest, PSLMatchingDisabledForNonHTMLForms) {
832 password_manager::PSLMatchingHelper helper; 828 password_manager::PSLMatchingHelper helper;
833 ASSERT_TRUE(helper.IsMatchingEnabled());
834 829
835 CheckMatchingWithScheme(PasswordForm::SCHEME_BASIC); 830 CheckMatchingWithScheme(PasswordForm::SCHEME_BASIC);
836 CheckMatchingWithScheme(PasswordForm::SCHEME_DIGEST); 831 CheckMatchingWithScheme(PasswordForm::SCHEME_DIGEST);
837 CheckMatchingWithScheme(PasswordForm::SCHEME_OTHER); 832 CheckMatchingWithScheme(PasswordForm::SCHEME_OTHER);
838 833
839 } 834 }
840 835
841 TEST_F(NativeBackendGnomeTest, PSLUpdatingStrictUpdateLogin) { 836 TEST_F(NativeBackendGnomeTest, PSLUpdatingStrictUpdateLogin) {
842 CheckPSLUpdate(UPDATE_BY_UPDATELOGIN); 837 CheckPSLUpdate(UPDATE_BY_UPDATELOGIN);
843 } 838 }
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 1049
1055 TEST_F(NativeBackendGnomeTest, RemoveLoginsCreatedBetween) { 1050 TEST_F(NativeBackendGnomeTest, RemoveLoginsCreatedBetween) {
1056 CheckRemoveLoginsBetween(CREATED); 1051 CheckRemoveLoginsBetween(CREATED);
1057 } 1052 }
1058 1053
1059 TEST_F(NativeBackendGnomeTest, RemoveLoginsSyncedBetween) { 1054 TEST_F(NativeBackendGnomeTest, RemoveLoginsSyncedBetween) {
1060 CheckRemoveLoginsBetween(SYNCED); 1055 CheckRemoveLoginsBetween(SYNCED);
1061 } 1056 }
1062 1057
1063 // TODO(mdm): add more basic tests here at some point. 1058 // TODO(mdm): add more basic tests here at some point.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698