OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/sync/test/fake_server/fake_server_verifier.h" | 5 #include "components/sync/test/fake_server/fake_server_verifier.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 if (!entities.get()) { | 99 if (!entities.get()) { |
100 return DictionaryCreationAssertionFailure(); | 100 return DictionaryCreationAssertionFailure(); |
101 } | 101 } |
102 | 102 |
103 string model_type_string = ModelTypeToString(model_type); | 103 string model_type_string = ModelTypeToString(model_type); |
104 base::ListValue* entity_list = nullptr; | 104 base::ListValue* entity_list = nullptr; |
105 size_t actual_count = 0; | 105 size_t actual_count = 0; |
106 if (entities->GetList(model_type_string, &entity_list)) { | 106 if (entities->GetList(model_type_string, &entity_list)) { |
107 base::Value name_value(name); | 107 base::Value name_value(name); |
108 for (const auto& entity : *entity_list) { | 108 for (const auto& entity : *entity_list) { |
109 if (name_value.Equals(&entity)) | 109 if (name_value.Equals(entity.get())) |
110 actual_count++; | 110 actual_count++; |
111 } | 111 } |
112 } | 112 } |
113 | 113 |
114 if (!entity_list) { | 114 if (!entity_list) { |
115 return UnknownTypeAssertionFailure(model_type_string); | 115 return UnknownTypeAssertionFailure(model_type_string); |
116 } else if (actual_count != expected_count) { | 116 } else if (actual_count != expected_count) { |
117 return VerificationCountAssertionFailure(actual_count, expected_count) | 117 return VerificationCountAssertionFailure(actual_count, expected_count) |
118 << "; Name: " << name << "\n\n" | 118 << "; Name: " << name << "\n\n" |
119 << ConvertFakeServerContentsToString(*entities); | 119 << ConvertFakeServerContentsToString(*entities); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 return AssertionFailure() << "Malformed data: Tab entity not found."; | 183 return AssertionFailure() << "Malformed data: Tab entity not found."; |
184 } | 184 } |
185 tab_urls.insert(tab_ids_to_urls[tab_id]); | 185 tab_urls.insert(tab_ids_to_urls[tab_id]); |
186 } | 186 } |
187 actual_sessions.AddWindow(tab_urls); | 187 actual_sessions.AddWindow(tab_urls); |
188 } | 188 } |
189 return VerifySessionsHierarchyEquality(expected_sessions, actual_sessions); | 189 return VerifySessionsHierarchyEquality(expected_sessions, actual_sessions); |
190 } | 190 } |
191 | 191 |
192 } // namespace fake_server | 192 } // namespace fake_server |
OLD | NEW |