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/stringprintf.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 : type(UINT32), value_uint32(value) {} | 41 : type(UINT32), value_uint32(value) {} |
42 explicit ItemAttribute(const std::string& value) | 42 explicit ItemAttribute(const std::string& value) |
43 : type(STRING), value_string(value) {} | 43 : type(STRING), value_string(value) {} |
44 | 44 |
45 bool Equals(const ItemAttribute& x) const { | 45 bool Equals(const ItemAttribute& x) const { |
46 if (type != x.type) return false; | 46 if (type != x.type) return false; |
47 return (type == STRING) ? value_string == x.value_string | 47 return (type == STRING) ? value_string == x.value_string |
48 : value_uint32 == x.value_uint32; | 48 : value_uint32 == x.value_uint32; |
49 } | 49 } |
50 | 50 |
51 enum { UINT32, STRING } type; | 51 enum Type { UINT32, STRING } type; |
52 uint32_t value_uint32; | 52 uint32_t value_uint32; |
53 std::string value_string; | 53 std::string value_string; |
54 }; | 54 }; |
55 | 55 |
56 typedef std::map<std::string, ItemAttribute> attribute_map; | 56 typedef std::map<std::string, ItemAttribute> attribute_map; |
57 typedef std::vector<std::pair<std::string, ItemAttribute> > attribute_query; | 57 typedef std::vector<std::pair<std::string, ItemAttribute> > attribute_query; |
58 | 58 |
59 bool Matches(const attribute_query& query) const { | 59 bool Matches(const attribute_query& query) const { |
60 // The real GNOME Keyring doesn't match empty queries. | 60 // The real GNOME Keyring doesn't match empty queries. |
61 if (query.empty()) return false; | 61 if (query.empty()) return false; |
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 RunBothThreads(); | 894 RunBothThreads(); |
895 | 895 |
896 // The other two copies of the password in different profiles should remain. | 896 // The other two copies of the password in different profiles should remain. |
897 EXPECT_EQ(2u, mock_keyring_items.size()); | 897 EXPECT_EQ(2u, mock_keyring_items.size()); |
898 if (mock_keyring_items.size() > 0) | 898 if (mock_keyring_items.size() > 0) |
899 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); | 899 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); |
900 if (mock_keyring_items.size() > 1) | 900 if (mock_keyring_items.size() > 1) |
901 CheckMockKeyringItem(&mock_keyring_items[1], form_google_, "chrome-42"); | 901 CheckMockKeyringItem(&mock_keyring_items[1], form_google_, "chrome-42"); |
902 } | 902 } |
903 } | 903 } |
OLD | NEW |