| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/stringprintf.h" |
| 10 #include "base/time.h" | 11 #include "base/time.h" |
| 11 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/browser/password_manager/native_backend_gnome_x.h" | 13 #include "chrome/browser/password_manager/native_backend_gnome_x.h" |
| 13 #include "chrome/browser/prefs/pref_service.h" | 14 #include "chrome/browser/prefs/pref_service.h" |
| 14 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
| 15 #include "chrome/test/base/testing_browser_process_test.h" | 16 #include "chrome/test/base/testing_browser_process_test.h" |
| 16 #include "chrome/test/base/testing_profile.h" | 17 #include "chrome/test/base/testing_profile.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 19 |
| 19 using webkit_glue::PasswordForm; | 20 using webkit_glue::PasswordForm; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 const gchar* keyring, | 96 const gchar* keyring, |
| 96 const gchar* display_name, | 97 const gchar* display_name, |
| 97 const gchar* password, | 98 const gchar* password, |
| 98 GnomeKeyringOperationDoneCallback callback, | 99 GnomeKeyringOperationDoneCallback callback, |
| 99 gpointer data, | 100 gpointer data, |
| 100 GDestroyNotify destroy_data, | 101 GDestroyNotify destroy_data, |
| 101 ...) { | 102 ...) { |
| 102 mock_keyring_items.push_back( | 103 mock_keyring_items.push_back( |
| 103 MockKeyringItem(keyring, display_name, password)); | 104 MockKeyringItem(keyring, display_name, password)); |
| 104 MockKeyringItem* item = &mock_keyring_items.back(); | 105 MockKeyringItem* item = &mock_keyring_items.back(); |
| 105 const std::string keyring_desc = keyring ? StringPrintf("keyring %s", keyring) | 106 const std::string keyring_desc = |
| 106 : std::string("default keyring"); | 107 keyring ? base::StringPrintf("keyring %s", keyring) |
| 108 : std::string("default keyring"); |
| 107 VLOG(1) << "Adding item with origin " << display_name | 109 VLOG(1) << "Adding item with origin " << display_name |
| 108 << " to " << keyring_desc; | 110 << " to " << keyring_desc; |
| 109 va_list ap; | 111 va_list ap; |
| 110 va_start(ap, destroy_data); | 112 va_start(ap, destroy_data); |
| 111 char* name; | 113 char* name; |
| 112 while ((name = va_arg(ap, gchar*))) { | 114 while ((name = va_arg(ap, gchar*))) { |
| 113 if (IsStringAttribute(schema, name)) { | 115 if (IsStringAttribute(schema, name)) { |
| 114 item->attributes[name] = | 116 item->attributes[name] = |
| 115 MockKeyringItem::ItemAttribute(va_arg(ap, gchar*)); | 117 MockKeyringItem::ItemAttribute(va_arg(ap, gchar*)); |
| 116 VLOG(1) << "Adding item attribute " << name | 118 VLOG(1) << "Adding item attribute " << name |
| (...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 RunBothThreads(); | 860 RunBothThreads(); |
| 859 | 861 |
| 860 // The other two copies of the password in different profiles should remain. | 862 // The other two copies of the password in different profiles should remain. |
| 861 EXPECT_EQ(2u, mock_keyring_items.size()); | 863 EXPECT_EQ(2u, mock_keyring_items.size()); |
| 862 if (mock_keyring_items.size() > 0) | 864 if (mock_keyring_items.size() > 0) |
| 863 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); | 865 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); |
| 864 if (mock_keyring_items.size() > 1) | 866 if (mock_keyring_items.size() > 1) |
| 865 CheckMockKeyringItem(&mock_keyring_items[1], form_google_, "chrome-42"); | 867 CheckMockKeyringItem(&mock_keyring_items[1], form_google_, "chrome-42"); |
| 866 } | 868 } |
| 867 } | 869 } |
| OLD | NEW |