OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/sync_file_system/drive_backend/metadata_database.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <unordered_map> | 9 #include <unordered_map> |
10 #include <utility> | 10 #include <utility> |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 template <typename Container> | 97 template <typename Container> |
98 void ExpectEquivalentMaps(const Container& left, const Container& right); | 98 void ExpectEquivalentMaps(const Container& left, const Container& right); |
99 | 99 |
100 template <typename Key, typename Value> | 100 template <typename Key, typename Value> |
101 void ExpectEquivalent(const std::map<Key, Value>& left, | 101 void ExpectEquivalent(const std::map<Key, Value>& left, |
102 const std::map<Key, Value>& right) { | 102 const std::map<Key, Value>& right) { |
103 ExpectEquivalentMaps(left, right); | 103 ExpectEquivalentMaps(left, right); |
104 } | 104 } |
105 | 105 |
106 template <typename Key, typename Value> | 106 template <typename Key, typename Value> |
107 void ExpectEquivalent(const base::hash_map<Key, Value>& left, | 107 void ExpectEquivalent(const std::unordered_map<Key, Value>& left, |
108 const base::hash_map<Key, Value>& right) { | 108 const std::unordered_map<Key, Value>& right) { |
109 // Convert from a hash container to an ordered container for comparison. | 109 // Convert from a hash container to an ordered container for comparison. |
110 ExpectEquivalentMaps(std::map<Key, Value>(left.begin(), left.end()), | 110 ExpectEquivalentMaps(std::map<Key, Value>(left.begin(), left.end()), |
111 std::map<Key, Value>(right.begin(), right.end())); | 111 std::map<Key, Value>(right.begin(), right.end())); |
112 } | 112 } |
113 | 113 |
114 template <typename Key, typename Value> | 114 template <typename Key, typename Value> |
115 void ExpectEquivalent( | 115 void ExpectEquivalent( |
116 const std::unordered_map<Key, std::unique_ptr<Value>>& left, | 116 const std::unordered_map<Key, std::unique_ptr<Value>>& left, |
117 const std::unordered_map<Key, std::unique_ptr<Value>>& right) { | 117 const std::unordered_map<Key, std::unique_ptr<Value>>& right) { |
118 // Convert from a hash container to an ordered container for comparison. | 118 // Convert from a hash container to an ordered container for comparison. |
(...skipping 10 matching lines...) Expand all Loading... |
129 template <typename Container> | 129 template <typename Container> |
130 void ExpectEquivalentSets(const Container& left, const Container& right); | 130 void ExpectEquivalentSets(const Container& left, const Container& right); |
131 | 131 |
132 template <typename Value, typename Comparator> | 132 template <typename Value, typename Comparator> |
133 void ExpectEquivalent(const std::set<Value, Comparator>& left, | 133 void ExpectEquivalent(const std::set<Value, Comparator>& left, |
134 const std::set<Value, Comparator>& right) { | 134 const std::set<Value, Comparator>& right) { |
135 return ExpectEquivalentSets(left, right); | 135 return ExpectEquivalentSets(left, right); |
136 } | 136 } |
137 | 137 |
138 template <typename Value> | 138 template <typename Value> |
139 void ExpectEquivalent(const base::hash_set<Value>& left, | 139 void ExpectEquivalent(const std::unordered_set<Value>& left, |
140 const base::hash_set<Value>& right) { | 140 const std::unordered_set<Value>& right) { |
141 // Convert from a hash container to an ordered container for comparison. | 141 // Convert from a hash container to an ordered container for comparison. |
142 return ExpectEquivalentSets(std::set<Value>(left.begin(), left.end()), | 142 return ExpectEquivalentSets(std::set<Value>(left.begin(), left.end()), |
143 std::set<Value>(right.begin(), right.end())); | 143 std::set<Value>(right.begin(), right.end())); |
144 } | 144 } |
145 | 145 |
146 void ExpectEquivalent(const TrackerIDSet& left, | 146 void ExpectEquivalent(const TrackerIDSet& left, |
147 const TrackerIDSet& right) { | 147 const TrackerIDSet& right) { |
148 { | 148 { |
149 SCOPED_TRACE("Expect equivalent active_tracker"); | 149 SCOPED_TRACE("Expect equivalent active_tracker"); |
150 EXPECT_EQ(left.active_tracker(), right.active_tracker()); | 150 EXPECT_EQ(left.active_tracker(), right.active_tracker()); |
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 EXPECT_TRUE(file->HasKey("details")); | 1168 EXPECT_TRUE(file->HasKey("details")); |
1169 | 1169 |
1170 ASSERT_TRUE(files->GetDictionary(1, &file)); | 1170 ASSERT_TRUE(files->GetDictionary(1, &file)); |
1171 EXPECT_TRUE(file->GetString("title", &str) && str == "file_0"); | 1171 EXPECT_TRUE(file->GetString("title", &str) && str == "file_0"); |
1172 EXPECT_TRUE(file->GetString("type", &str) && str == "file"); | 1172 EXPECT_TRUE(file->GetString("type", &str) && str == "file"); |
1173 EXPECT_TRUE(file->HasKey("details")); | 1173 EXPECT_TRUE(file->HasKey("details")); |
1174 } | 1174 } |
1175 | 1175 |
1176 } // namespace drive_backend | 1176 } // namespace drive_backend |
1177 } // namespace sync_file_system | 1177 } // namespace sync_file_system |
OLD | NEW |