OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <map> | 9 #include <map> |
10 #include <utility> | 10 #include <utility> |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
271 } | 271 } |
272 | 272 |
273 const gchar* mock_gnome_keyring_result_to_message(GnomeKeyringResult res) { | 273 const gchar* mock_gnome_keyring_result_to_message(GnomeKeyringResult res) { |
274 return "mock keyring simulating failure"; | 274 return "mock keyring simulating failure"; |
275 } | 275 } |
276 | 276 |
277 // Inherit to get access to protected fields. | 277 // Inherit to get access to protected fields. |
278 class MockGnomeKeyringLoader : public GnomeKeyringLoader { | 278 class MockGnomeKeyringLoader : public GnomeKeyringLoader { |
279 public: | 279 public: |
280 static bool LoadMockGnomeKeyring() { | 280 static bool LoadMockGnomeKeyring() { |
281 if (!LoadGnomeKeyring()) | |
282 return false; | |
283 #define GNOME_KEYRING_ASSIGN_POINTER(name) \ | 281 #define GNOME_KEYRING_ASSIGN_POINTER(name) \ |
284 gnome_keyring_##name = &mock_gnome_keyring_##name; | 282 gnome_keyring_##name = &mock_gnome_keyring_##name; |
285 GNOME_KEYRING_FOR_EACH_MOCKED_FUNC(GNOME_KEYRING_ASSIGN_POINTER) | 283 GNOME_KEYRING_FOR_EACH_MOCKED_FUNC(GNOME_KEYRING_ASSIGN_POINTER) |
286 #undef GNOME_KEYRING_ASSIGN_POINTER | 284 #undef GNOME_KEYRING_ASSIGN_POINTER |
285 | |
286 #define GNOME_KEYRING_ASSIGN_POINTER(name) \ | |
287 gnome_keyring_##name = &::gnome_keyring_##name; | |
288 GNOME_KEYRING_FOR_EACH_NON_MOCKED_FUNC(GNOME_KEYRING_ASSIGN_POINTER) | |
289 #undef GNOME_KEYRING_ASSIGN_POINTER | |
vasilii
2016/07/28 13:33:22
It looks complex. If you find a way to get rid of
cfroussios
2016/07/28 16:06:39
Acknowledged.
| |
290 | |
287 keyring_loaded = true; | 291 keyring_loaded = true; |
288 // Reset the state of the mock library. | 292 // Reset the state of the mock library. |
289 mock_keyring_items.clear(); | 293 mock_keyring_items.clear(); |
290 mock_keyring_reject_local_ids = false; | 294 mock_keyring_reject_local_ids = false; |
291 return true; | 295 return true; |
292 } | 296 } |
293 }; | 297 }; |
294 | 298 |
295 void CheckPasswordChanges(const PasswordStoreChangeList& expected_list, | 299 void CheckPasswordChanges(const PasswordStoreChangeList& expected_list, |
296 const PasswordStoreChangeList& actual_list) { | 300 const PasswordStoreChangeList& actual_list) { |
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1289 base::Bind(&CheckTrue)); | 1293 base::Bind(&CheckTrue)); |
1290 | 1294 |
1291 RunBothThreads(); | 1295 RunBothThreads(); |
1292 | 1296 |
1293 EXPECT_EQ(2u, form_list.size()); | 1297 EXPECT_EQ(2u, form_list.size()); |
1294 EXPECT_THAT(form_list, UnorderedElementsAre(Pointee(form_google_), | 1298 EXPECT_THAT(form_list, UnorderedElementsAre(Pointee(form_google_), |
1295 Pointee(form_facebook_))); | 1299 Pointee(form_facebook_))); |
1296 } | 1300 } |
1297 | 1301 |
1298 // TODO(mdm): add more basic tests here at some point. | 1302 // TODO(mdm): add more basic tests here at some point. |
OLD | NEW |