Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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)); |
| 710 } | 702 } |
| 711 | 703 |
| 712 TEST_F(NativeBackendLibsecretTest, | 704 TEST_F(NativeBackendLibsecretTest, DontFetchFederatedCredentialOnHTTP) { |
| 713 DontFetchPSLMatchedFederatedCredentialOnHTTP) { | |
| 714 other_auth_.signon_realm = "federation://www.example.com/google.com"; | 705 other_auth_.signon_realm = "federation://www.example.com/google.com"; |
| 715 other_auth_.federation_origin = url::Origin(GURL("https://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/")); | |
| 716 EXPECT_TRUE(CheckCredentialAvailability(other_auth_, | 715 EXPECT_TRUE(CheckCredentialAvailability(other_auth_, |
| 717 GURL("http://www.example.com/"), | 716 GURL("https://www.sub.example.com/"), |
|
jdoerrie
2017/01/30 13:04:12
I missed this during the last CL. Let me know if i
vasilii
2017/01/30 13:29:50
I didn't get why the test is called "FetchPSLMatch
jdoerrie
2017/01/30 13:51:38
Yeah, you are right. Fixed.
| |
| 718 PasswordForm::SCHEME_HTML, nullptr)); | 717 PasswordForm::SCHEME_HTML, nullptr)); |
| 719 } | 718 } |
| 720 | 719 |
| 720 TEST_F(NativeBackendLibsecretTest, | |
| 721 DontFetchPSLMatchedFederatedCredentialOnHTTP) { | |
| 722 other_auth_.signon_realm = "federation://www.sub.example.com/google.com"; | |
| 723 other_auth_.federation_origin = url::Origin(GURL("https://google.com/")); | |
| 724 EXPECT_FALSE(CheckCredentialAvailability(other_auth_, | |
| 725 GURL("http://www.sub.example.com/"), | |
| 726 PasswordForm::SCHEME_HTML, nullptr)); | |
| 727 } | |
| 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"); |
| 729 | 737 |
| 730 EXPECT_EQ(1u, global_mock_libsecret_items->size()); | 738 EXPECT_EQ(1u, global_mock_libsecret_items->size()); |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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. |
| OLD | NEW |