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

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

Issue 2664763002: Only apply federated matches on HTTPS (Closed)
Patch Set: Fix Subdomain. 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 (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 #include <stddef.h> 6 #include <stddef.h>
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 TEST_F(NativeBackendLibsecretTest, PSLUpdatingStrictUpdateLogin) { 686 TEST_F(NativeBackendLibsecretTest, PSLUpdatingStrictUpdateLogin) {
687 CheckPSLUpdate(UPDATE_BY_UPDATELOGIN); 687 CheckPSLUpdate(UPDATE_BY_UPDATELOGIN);
688 } 688 }
689 689
690 TEST_F(NativeBackendLibsecretTest, PSLUpdatingStrictAddLogin) { 690 TEST_F(NativeBackendLibsecretTest, PSLUpdatingStrictAddLogin) {
691 // TODO(vabr): if AddLogin becomes no longer valid for existing logins, then 691 // TODO(vabr): if AddLogin becomes no longer valid for existing logins, then
692 // just delete this test. 692 // just delete this test.
693 CheckPSLUpdate(UPDATE_BY_ADDLOGIN); 693 CheckPSLUpdate(UPDATE_BY_ADDLOGIN);
694 } 694 }
695 695
696 TEST_F(NativeBackendLibsecretTest, FetchFederatedCredential) { 696 TEST_F(NativeBackendLibsecretTest, FetchFederatedCredentialOnHTTPS) {
697 other_auth_.signon_realm = "federation://www.example.com/google.com";
698 other_auth_.federation_origin = url::Origin(GURL("https://google.com/"));
699 EXPECT_TRUE(CheckCredentialAvailability(other_auth_,
700 GURL("http://www.example.com/"),
701 PasswordForm::SCHEME_HTML, nullptr));
702 }
703
704 TEST_F(NativeBackendLibsecretTest, FetchPSLMatchedFederatedCredentialOnHTTPS) {
705 other_auth_.signon_realm = "federation://www.example.com/google.com"; 697 other_auth_.signon_realm = "federation://www.example.com/google.com";
706 other_auth_.federation_origin = url::Origin(GURL("https://google.com/")); 698 other_auth_.federation_origin = url::Origin(GURL("https://google.com/"));
707 EXPECT_TRUE(CheckCredentialAvailability(other_auth_, 699 EXPECT_TRUE(CheckCredentialAvailability(other_auth_,
708 GURL("https://www.example.com/"), 700 GURL("https://www.example.com/"),
709 PasswordForm::SCHEME_HTML, nullptr)); 701 PasswordForm::SCHEME_HTML, nullptr));
702 }
703
704 TEST_F(NativeBackendLibsecretTest, DontFetchFederatedCredentialOnHTTP) {
705 other_auth_.signon_realm = "federation://www.example.com/google.com";
706 other_auth_.federation_origin = url::Origin(GURL("https://google.com/"));
707 EXPECT_FALSE(CheckCredentialAvailability(other_auth_,
708 GURL("http://www.example.com/"),
709 PasswordForm::SCHEME_HTML, nullptr));
710 }
711
712 TEST_F(NativeBackendLibsecretTest, FetchPSLMatchedFederatedCredentialOnHTTPS) {
713 other_auth_.signon_realm = "federation://www.sub.example.com/google.com";
714 other_auth_.federation_origin = url::Origin(GURL("https://google.com/"));
715 EXPECT_TRUE(CheckCredentialAvailability(other_auth_,
716 GURL("https://www.example.com/"),
717 PasswordForm::SCHEME_HTML, nullptr));
710 } 718 }
711 719
712 TEST_F(NativeBackendLibsecretTest, 720 TEST_F(NativeBackendLibsecretTest,
713 DontFetchPSLMatchedFederatedCredentialOnHTTP) { 721 DontFetchPSLMatchedFederatedCredentialOnHTTP) {
714 other_auth_.signon_realm = "federation://www.example.com/google.com"; 722 other_auth_.signon_realm = "federation://www.sub.example.com/google.com";
715 other_auth_.federation_origin = url::Origin(GURL("https://google.com/")); 723 other_auth_.federation_origin = url::Origin(GURL("https://google.com/"));
716 EXPECT_TRUE(CheckCredentialAvailability(other_auth_, 724 EXPECT_FALSE(CheckCredentialAvailability(other_auth_,
717 GURL("http://www.example.com/"), 725 GURL("http://www.example.com/"),
718 PasswordForm::SCHEME_HTML, nullptr)); 726 PasswordForm::SCHEME_HTML, nullptr));
719 } 727 }
720 728
721 TEST_F(NativeBackendLibsecretTest, BasicUpdateLogin) { 729 TEST_F(NativeBackendLibsecretTest, BasicUpdateLogin) {
722 NativeBackendLibsecret backend(42); 730 NativeBackendLibsecret backend(42);
723 731
724 VerifiedAdd(&backend, form_google_); 732 VerifiedAdd(&backend, form_google_);
725 733
726 PasswordForm new_form_google(form_google_); 734 PasswordForm new_form_google(form_google_);
727 new_form_google.times_used = 1; 735 new_form_google.times_used = 1;
728 new_form_google.action = GURL("http://www.google.com/different/login"); 736 new_form_google.action = GURL("http://www.google.com/different/login");
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 EXPECT_EQ(form_google_, *form_list[0]); 1001 EXPECT_EQ(form_google_, *form_list[0]);
994 1002
995 EXPECT_EQ(1u, global_mock_libsecret_items->size()); 1003 EXPECT_EQ(1u, global_mock_libsecret_items->size());
996 if (!global_mock_libsecret_items->empty()) { 1004 if (!global_mock_libsecret_items->empty()) {
997 CheckMockSecretItem((*global_mock_libsecret_items)[0].get(), form_google_, 1005 CheckMockSecretItem((*global_mock_libsecret_items)[0].get(), form_google_,
998 "chrome-42"); 1006 "chrome-42");
999 } 1007 }
1000 } 1008 }
1001 1009
1002 // TODO(mdm): add more basic tests here at some point. 1010 // TODO(mdm): add more basic tests here at some point.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698