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

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

Issue 2196193002: Expanded GnomeKeyringLoader macros (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix format Created 4 years, 4 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
« no previous file with comments | « chrome/browser/password_manager/native_backend_gnome_x.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 #define GNOME_KEYRING_ASSIGN_POINTER(name) \ 281 // Mocked methods
282 gnome_keyring_##name = &mock_gnome_keyring_##name; 282 gnome_keyring_is_available_ptr = &mock_gnome_keyring_is_available;
283 GNOME_KEYRING_FOR_EACH_MOCKED_FUNC(GNOME_KEYRING_ASSIGN_POINTER) 283 gnome_keyring_store_password_ptr = &mock_gnome_keyring_store_password;
284 #undef GNOME_KEYRING_ASSIGN_POINTER 284 gnome_keyring_delete_password_ptr = &mock_gnome_keyring_delete_password;
285 285 gnome_keyring_find_items_ptr = &mock_gnome_keyring_find_items;
286 #define GNOME_KEYRING_ASSIGN_POINTER(name) \ 286 gnome_keyring_result_to_message_ptr = &mock_gnome_keyring_result_to_message;
287 gnome_keyring_##name = &::gnome_keyring_##name; 287 // Non-mocked methods
288 GNOME_KEYRING_FOR_EACH_NON_MOCKED_FUNC(GNOME_KEYRING_ASSIGN_POINTER) 288 gnome_keyring_attribute_list_free_ptr =
289 #undef GNOME_KEYRING_ASSIGN_POINTER 289 &::gnome_keyring_attribute_list_free;
290 gnome_keyring_attribute_list_new_ptr = &::gnome_keyring_attribute_list_new;
291 gnome_keyring_attribute_list_append_string_ptr =
292 &::gnome_keyring_attribute_list_append_string;
293 gnome_keyring_attribute_list_append_uint32_ptr =
294 &::gnome_keyring_attribute_list_append_uint32;
290 295
291 keyring_loaded = true; 296 keyring_loaded = true;
292 // Reset the state of the mock library. 297 // Reset the state of the mock library.
293 mock_keyring_items.clear(); 298 mock_keyring_items.clear();
294 mock_keyring_reject_local_ids = false; 299 mock_keyring_reject_local_ids = false;
295 return true; 300 return true;
296 } 301 }
297 }; 302 };
298 303
299 void CheckPasswordChanges(const PasswordStoreChangeList& expected_list, 304 void CheckPasswordChanges(const PasswordStoreChangeList& expected_list,
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 base::Bind(&CheckTrue)); 1298 base::Bind(&CheckTrue));
1294 1299
1295 RunBothThreads(); 1300 RunBothThreads();
1296 1301
1297 EXPECT_EQ(2u, form_list.size()); 1302 EXPECT_EQ(2u, form_list.size());
1298 EXPECT_THAT(form_list, UnorderedElementsAre(Pointee(form_google_), 1303 EXPECT_THAT(form_list, UnorderedElementsAre(Pointee(form_google_),
1299 Pointee(form_facebook_))); 1304 Pointee(form_facebook_)));
1300 } 1305 }
1301 1306
1302 // TODO(mdm): add more basic tests here at some point. 1307 // TODO(mdm): add more basic tests here at some point.
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/native_backend_gnome_x.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698