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

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

Issue 2816033002: Fix retrieving federated credentials for the password store for localhost. (Closed)
Patch Set: comments Created 3 years, 8 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 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, FetchFederatedCredentialOnHTTPS) { 696 TEST_F(NativeBackendLibsecretTest, FetchFederatedCredentialOnHTTPS) {
697 other_auth_.signon_realm = "federation://www.example.com/google.com"; 697 other_auth_.signon_realm = "federation://www.example.com/google.com";
698 other_auth_.origin = GURL("https://www.example.com/");
698 other_auth_.federation_origin = url::Origin(GURL("https://google.com/")); 699 other_auth_.federation_origin = url::Origin(GURL("https://google.com/"));
699 EXPECT_TRUE(CheckCredentialAvailability(other_auth_, 700 EXPECT_TRUE(CheckCredentialAvailability(other_auth_,
700 GURL("https://www.example.com/"), 701 GURL("https://www.example.com/"),
701 PasswordForm::SCHEME_HTML, nullptr)); 702 PasswordForm::SCHEME_HTML, nullptr));
702 } 703 }
703 704
705 TEST_F(NativeBackendLibsecretTest, FetchFederatedCredentialOnLocalhost) {
706 other_auth_.signon_realm = "federation://localhost/google.com";
707 other_auth_.origin = GURL("http://localhost:8080/");
708 other_auth_.federation_origin = url::Origin(GURL("https://google.com/"));
709 EXPECT_TRUE(CheckCredentialAvailability(other_auth_,
710 GURL("http://localhost:8080/"),
711 PasswordForm::SCHEME_HTML, nullptr));
712 }
713
704 TEST_F(NativeBackendLibsecretTest, DontFetchFederatedCredentialOnHTTP) { 714 TEST_F(NativeBackendLibsecretTest, DontFetchFederatedCredentialOnHTTP) {
705 other_auth_.signon_realm = "federation://www.example.com/google.com"; 715 other_auth_.signon_realm = "federation://www.example.com/google.com";
716 other_auth_.origin = GURL("https://www.example.com/");
706 other_auth_.federation_origin = url::Origin(GURL("https://google.com/")); 717 other_auth_.federation_origin = url::Origin(GURL("https://google.com/"));
707 EXPECT_FALSE(CheckCredentialAvailability(other_auth_, 718 EXPECT_FALSE(CheckCredentialAvailability(other_auth_,
708 GURL("http://www.example.com/"), 719 GURL("http://www.example.com/"),
709 PasswordForm::SCHEME_HTML, nullptr)); 720 PasswordForm::SCHEME_HTML, nullptr));
710 } 721 }
711 722
712 TEST_F(NativeBackendLibsecretTest, FetchPSLMatchedFederatedCredentialOnHTTPS) { 723 TEST_F(NativeBackendLibsecretTest, FetchPSLMatchedFederatedCredentialOnHTTPS) {
713 other_auth_.signon_realm = "federation://www.sub.example.com/google.com"; 724 other_auth_.signon_realm = "federation://www.sub.example.com/google.com";
725 other_auth_.origin = GURL("https://www.sub.example.com/");
714 other_auth_.federation_origin = url::Origin(GURL("https://google.com/")); 726 other_auth_.federation_origin = url::Origin(GURL("https://google.com/"));
715 EXPECT_TRUE(CheckCredentialAvailability(other_auth_, 727 EXPECT_TRUE(CheckCredentialAvailability(other_auth_,
716 GURL("https://www.example.com/"), 728 GURL("https://www.example.com/"),
717 PasswordForm::SCHEME_HTML, nullptr)); 729 PasswordForm::SCHEME_HTML, nullptr));
718 } 730 }
719 731
720 TEST_F(NativeBackendLibsecretTest, 732 TEST_F(NativeBackendLibsecretTest,
721 DontFetchPSLMatchedFederatedCredentialOnHTTP) { 733 DontFetchPSLMatchedFederatedCredentialOnHTTP) {
722 other_auth_.signon_realm = "federation://www.sub.example.com/google.com"; 734 other_auth_.signon_realm = "federation://www.sub.example.com/google.com";
735 other_auth_.origin = GURL("https://www.sub.example.com/");
723 other_auth_.federation_origin = url::Origin(GURL("https://google.com/")); 736 other_auth_.federation_origin = url::Origin(GURL("https://google.com/"));
724 EXPECT_FALSE(CheckCredentialAvailability(other_auth_, 737 EXPECT_FALSE(CheckCredentialAvailability(other_auth_,
725 GURL("http://www.example.com/"), 738 GURL("http://www.example.com/"),
726 PasswordForm::SCHEME_HTML, nullptr)); 739 PasswordForm::SCHEME_HTML, nullptr));
727 } 740 }
728 741
729 TEST_F(NativeBackendLibsecretTest, BasicUpdateLogin) { 742 TEST_F(NativeBackendLibsecretTest, BasicUpdateLogin) {
730 NativeBackendLibsecret backend(42); 743 NativeBackendLibsecret backend(42);
731 744
732 VerifiedAdd(&backend, form_google_); 745 VerifiedAdd(&backend, form_google_);
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 EXPECT_EQ(form_google_, *form_list[0]); 1014 EXPECT_EQ(form_google_, *form_list[0]);
1002 1015
1003 EXPECT_EQ(1u, global_mock_libsecret_items->size()); 1016 EXPECT_EQ(1u, global_mock_libsecret_items->size());
1004 if (!global_mock_libsecret_items->empty()) { 1017 if (!global_mock_libsecret_items->empty()) {
1005 CheckMockSecretItem((*global_mock_libsecret_items)[0].get(), form_google_, 1018 CheckMockSecretItem((*global_mock_libsecret_items)[0].get(), form_google_,
1006 "chrome-42"); 1019 "chrome-42");
1007 } 1020 }
1008 } 1021 }
1009 1022
1010 // TODO(mdm): add more basic tests here at some point. 1023 // TODO(mdm): add more basic tests here at some point.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698