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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 std::unique_ptr<base::DictionaryValue> entities = | 97 std::unique_ptr<base::DictionaryValue> entities = |
98 fake_server_->GetEntitiesAsDictionaryValue(); | 98 fake_server_->GetEntitiesAsDictionaryValue(); |
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::StringValue 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.get())) | 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) |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 return AssertionFailure() << "Malformed data: Tab entity not found."; | 172 return AssertionFailure() << "Malformed data: Tab entity not found."; |
173 } | 173 } |
174 tab_urls.insert(tab_ids_to_urls[tab_id]); | 174 tab_urls.insert(tab_ids_to_urls[tab_id]); |
175 } | 175 } |
176 actual_sessions.AddWindow(tab_urls); | 176 actual_sessions.AddWindow(tab_urls); |
177 } | 177 } |
178 return VerifySessionsHierarchyEquality(expected_sessions, actual_sessions); | 178 return VerifySessionsHierarchyEquality(expected_sessions, actual_sessions); |
179 } | 179 } |
180 | 180 |
181 } // namespace fake_server | 181 } // namespace fake_server |
OLD | NEW |