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

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: unnecessary null termination 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
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 = &mock_gnome_keyring_is_available;
283 GNOME_KEYRING_FOR_EACH_MOCKED_FUNC(GNOME_KEYRING_ASSIGN_POINTER) 283 gnome_keyring_store_password = &mock_gnome_keyring_store_password;
284 #undef GNOME_KEYRING_ASSIGN_POINTER 284 gnome_keyring_delete_password = &mock_gnome_keyring_delete_password;
285 285 gnome_keyring_find_items = &mock_gnome_keyring_find_items;
286 #define GNOME_KEYRING_ASSIGN_POINTER(name) \ 286 gnome_keyring_result_to_message = &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 = &::gnome_keyring_attribute_list_free;
289 #undef GNOME_KEYRING_ASSIGN_POINTER 289 gnome_keyring_attribute_list_new = &::gnome_keyring_attribute_list_new;
290 gnome_keyring_attribute_list_append_string =
291 &::gnome_keyring_attribute_list_append_string;
292 gnome_keyring_attribute_list_append_uint32 =
293 &::gnome_keyring_attribute_list_append_uint32;
290 294
291 keyring_loaded = true; 295 keyring_loaded = true;
292 // Reset the state of the mock library. 296 // Reset the state of the mock library.
293 mock_keyring_items.clear(); 297 mock_keyring_items.clear();
294 mock_keyring_reject_local_ids = false; 298 mock_keyring_reject_local_ids = false;
295 return true; 299 return true;
296 } 300 }
297 }; 301 };
298 302
299 void CheckPasswordChanges(const PasswordStoreChangeList& expected_list, 303 void CheckPasswordChanges(const PasswordStoreChangeList& expected_list,
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 base::Bind(&CheckTrue)); 1297 base::Bind(&CheckTrue));
1294 1298
1295 RunBothThreads(); 1299 RunBothThreads();
1296 1300
1297 EXPECT_EQ(2u, form_list.size()); 1301 EXPECT_EQ(2u, form_list.size());
1298 EXPECT_THAT(form_list, UnorderedElementsAre(Pointee(form_google_), 1302 EXPECT_THAT(form_list, UnorderedElementsAre(Pointee(form_google_),
1299 Pointee(form_facebook_))); 1303 Pointee(form_facebook_)));
1300 } 1304 }
1301 1305
1302 // TODO(mdm): add more basic tests here at some point. 1306 // TODO(mdm): add more basic tests here at some point.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698