| 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/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 880 } | 880 } |
| 881 | 881 |
| 882 TEST_F(NativeBackendLibsecretTest, RemoveLoginsCreatedBetween) { | 882 TEST_F(NativeBackendLibsecretTest, RemoveLoginsCreatedBetween) { |
| 883 CheckRemoveLoginsBetween(CREATED); | 883 CheckRemoveLoginsBetween(CREATED); |
| 884 } | 884 } |
| 885 | 885 |
| 886 TEST_F(NativeBackendLibsecretTest, RemoveLoginsSyncedBetween) { | 886 TEST_F(NativeBackendLibsecretTest, RemoveLoginsSyncedBetween) { |
| 887 CheckRemoveLoginsBetween(SYNCED); | 887 CheckRemoveLoginsBetween(SYNCED); |
| 888 } | 888 } |
| 889 | 889 |
| 890 TEST_F(NativeBackendLibsecretTest, DisableAutoSignInForAllLogins) { | 890 TEST_F(NativeBackendLibsecretTest, DisableAutoSignInForOrigins) { |
| 891 NativeBackendLibsecret backend(42); | 891 NativeBackendLibsecret backend(42); |
| 892 backend.Init(); | 892 backend.Init(); |
| 893 form_google_.skip_zero_click = false; | 893 form_google_.skip_zero_click = false; |
| 894 form_facebook_.skip_zero_click = false; | 894 form_facebook_.skip_zero_click = false; |
| 895 | 895 |
| 896 VerifiedAdd(&backend, form_google_); | 896 VerifiedAdd(&backend, form_google_); |
| 897 VerifiedAdd(&backend, form_facebook_); | 897 VerifiedAdd(&backend, form_facebook_); |
| 898 | 898 |
| 899 EXPECT_EQ(2u, global_mock_libsecret_items->size()); | 899 EXPECT_EQ(2u, global_mock_libsecret_items->size()); |
| 900 for (const auto& item : *global_mock_libsecret_items) | 900 for (const auto& item : *global_mock_libsecret_items) |
| 901 CheckUint32Attribute(item, "should_skip_zero_click", 0); | 901 CheckUint32Attribute(item, "should_skip_zero_click", 0); |
| 902 | 902 |
| 903 // Set the canonical forms to the updated value for the following comparison. | 903 // Set the canonical forms to the updated value for the following comparison. |
| 904 form_google_.skip_zero_click = true; | 904 form_google_.skip_zero_click = true; |
| 905 form_facebook_.skip_zero_click = true; | 905 form_facebook_.skip_zero_click = true; |
| 906 PasswordStoreChangeList expected_changes; | 906 PasswordStoreChangeList expected_changes; |
| 907 expected_changes.push_back( | 907 expected_changes.push_back( |
| 908 PasswordStoreChange(PasswordStoreChange::UPDATE, form_facebook_)); | 908 PasswordStoreChange(PasswordStoreChange::UPDATE, form_facebook_)); |
| 909 expected_changes.push_back( | |
| 910 PasswordStoreChange(PasswordStoreChange::UPDATE, form_google_)); | |
| 911 | 909 |
| 912 PasswordStoreChangeList changes; | 910 PasswordStoreChangeList changes; |
| 913 EXPECT_TRUE(backend.DisableAutoSignInForAllLogins(&changes)); | 911 EXPECT_TRUE(backend.DisableAutoSignInForOrigins( |
| 912 base::Bind(&GURL::operator==, base::Unretained(&form_facebook_.origin)), |
| 913 &changes)); |
| 914 CheckPasswordChanges(expected_changes, changes); | 914 CheckPasswordChanges(expected_changes, changes); |
| 915 | 915 |
| 916 EXPECT_EQ(2u, global_mock_libsecret_items->size()); | 916 EXPECT_EQ(2u, global_mock_libsecret_items->size()); |
| 917 for (const auto& item : *global_mock_libsecret_items) | 917 CheckStringAttribute((*global_mock_libsecret_items)[0], |
| 918 CheckUint32Attribute(item, "should_skip_zero_click", 1); | 918 "origin_url", form_google_.origin.spec()); |
| 919 CheckUint32Attribute((*global_mock_libsecret_items)[0], |
| 920 "should_skip_zero_click", 0); |
| 921 CheckStringAttribute((*global_mock_libsecret_items)[1], |
| 922 "origin_url", form_facebook_.origin.spec()); |
| 923 CheckUint32Attribute((*global_mock_libsecret_items)[1], |
| 924 "should_skip_zero_click", 1); |
| 919 } | 925 } |
| 920 | 926 |
| 921 TEST_F(NativeBackendLibsecretTest, SomeKeyringAttributesAreMissing) { | 927 TEST_F(NativeBackendLibsecretTest, SomeKeyringAttributesAreMissing) { |
| 922 // Absent attributes should be filled with default values. | 928 // Absent attributes should be filled with default values. |
| 923 NativeBackendLibsecret backend(42); | 929 NativeBackendLibsecret backend(42); |
| 924 | 930 |
| 925 VerifiedAdd(&backend, form_google_); | 931 VerifiedAdd(&backend, form_google_); |
| 926 | 932 |
| 927 EXPECT_EQ(1u, global_mock_libsecret_items->size()); | 933 EXPECT_EQ(1u, global_mock_libsecret_items->size()); |
| 928 // Remove a string attribute. | 934 // Remove a string attribute. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 EXPECT_EQ(form_google_, *form_list[0]); | 976 EXPECT_EQ(form_google_, *form_list[0]); |
| 971 | 977 |
| 972 EXPECT_EQ(1u, global_mock_libsecret_items->size()); | 978 EXPECT_EQ(1u, global_mock_libsecret_items->size()); |
| 973 if (!global_mock_libsecret_items->empty()) { | 979 if (!global_mock_libsecret_items->empty()) { |
| 974 CheckMockSecretItem((*global_mock_libsecret_items)[0], form_google_, | 980 CheckMockSecretItem((*global_mock_libsecret_items)[0], form_google_, |
| 975 "chrome-42"); | 981 "chrome-42"); |
| 976 } | 982 } |
| 977 } | 983 } |
| 978 | 984 |
| 979 // TODO(mdm): add more basic tests here at some point. | 985 // TODO(mdm): add more basic tests here at some point. |
| OLD | NEW |