| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 uint32_t intvalue = va_arg(ap, uint32_t); | 155 uint32_t intvalue = va_arg(ap, uint32_t); |
| 156 VLOG(1) << "Adding item attribute " << name << ", value " << intvalue; | 156 VLOG(1) << "Adding item attribute " << name << ", value " << intvalue; |
| 157 value = g_strdup_printf("%u", intvalue); | 157 value = g_strdup_printf("%u", intvalue); |
| 158 } | 158 } |
| 159 g_hash_table_insert(attributes, g_strdup(name), value); | 159 g_hash_table_insert(attributes, g_strdup(name), value); |
| 160 } | 160 } |
| 161 va_end(ap); | 161 va_end(ap); |
| 162 | 162 |
| 163 ScopedVector<MockSecretItem> kept_mock_libsecret_items; | 163 ScopedVector<MockSecretItem> kept_mock_libsecret_items; |
| 164 kept_mock_libsecret_items.reserve(global_mock_libsecret_items->size()); | 164 kept_mock_libsecret_items.reserve(global_mock_libsecret_items->size()); |
| 165 for (auto& item : *global_mock_libsecret_items) { | 165 for (auto*& item : *global_mock_libsecret_items) { |
| 166 if (!Matches(item, attributes)) { | 166 if (!Matches(item, attributes)) { |
| 167 kept_mock_libsecret_items.push_back(item); | 167 kept_mock_libsecret_items.push_back(item); |
| 168 item = nullptr; | 168 item = nullptr; |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 global_mock_libsecret_items->swap(kept_mock_libsecret_items); | 171 global_mock_libsecret_items->swap(kept_mock_libsecret_items); |
| 172 | 172 |
| 173 g_hash_table_unref(attributes); | 173 g_hash_table_unref(attributes); |
| 174 return | 174 return |
| 175 global_mock_libsecret_items->size() != kept_mock_libsecret_items.size(); | 175 global_mock_libsecret_items->size() != kept_mock_libsecret_items.size(); |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 TEST_F(NativeBackendLibsecretTest, DisableAutoSignInForOrigins) { | 888 TEST_F(NativeBackendLibsecretTest, DisableAutoSignInForOrigins) { |
| 889 NativeBackendLibsecret backend(42); | 889 NativeBackendLibsecret backend(42); |
| 890 backend.Init(); | 890 backend.Init(); |
| 891 form_google_.skip_zero_click = false; | 891 form_google_.skip_zero_click = false; |
| 892 form_facebook_.skip_zero_click = false; | 892 form_facebook_.skip_zero_click = false; |
| 893 | 893 |
| 894 VerifiedAdd(&backend, form_google_); | 894 VerifiedAdd(&backend, form_google_); |
| 895 VerifiedAdd(&backend, form_facebook_); | 895 VerifiedAdd(&backend, form_facebook_); |
| 896 | 896 |
| 897 EXPECT_EQ(2u, global_mock_libsecret_items->size()); | 897 EXPECT_EQ(2u, global_mock_libsecret_items->size()); |
| 898 for (const auto& item : *global_mock_libsecret_items) | 898 for (auto* item : *global_mock_libsecret_items) |
| 899 CheckUint32Attribute(item, "should_skip_zero_click", 0); | 899 CheckUint32Attribute(item, "should_skip_zero_click", 0); |
| 900 | 900 |
| 901 // Set the canonical forms to the updated value for the following comparison. | 901 // Set the canonical forms to the updated value for the following comparison. |
| 902 form_google_.skip_zero_click = true; | 902 form_google_.skip_zero_click = true; |
| 903 form_facebook_.skip_zero_click = true; | 903 form_facebook_.skip_zero_click = true; |
| 904 PasswordStoreChangeList expected_changes; | 904 PasswordStoreChangeList expected_changes; |
| 905 expected_changes.push_back( | 905 expected_changes.push_back( |
| 906 PasswordStoreChange(PasswordStoreChange::UPDATE, form_facebook_)); | 906 PasswordStoreChange(PasswordStoreChange::UPDATE, form_facebook_)); |
| 907 | 907 |
| 908 PasswordStoreChangeList changes; | 908 PasswordStoreChangeList changes; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 EXPECT_EQ(form_google_, *form_list[0]); | 974 EXPECT_EQ(form_google_, *form_list[0]); |
| 975 | 975 |
| 976 EXPECT_EQ(1u, global_mock_libsecret_items->size()); | 976 EXPECT_EQ(1u, global_mock_libsecret_items->size()); |
| 977 if (!global_mock_libsecret_items->empty()) { | 977 if (!global_mock_libsecret_items->empty()) { |
| 978 CheckMockSecretItem((*global_mock_libsecret_items)[0], form_google_, | 978 CheckMockSecretItem((*global_mock_libsecret_items)[0], form_google_, |
| 979 "chrome-42"); | 979 "chrome-42"); |
| 980 } | 980 } |
| 981 } | 981 } |
| 982 | 982 |
| 983 // TODO(mdm): add more basic tests here at some point. | 983 // TODO(mdm): add more basic tests here at some point. |
| OLD | NEW |