| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Keep this file in sync with the .proto files in this directory. | 5 // Keep this file in sync with the .proto files in this directory. |
| 6 | 6 |
| 7 #include "components/sync/protocol/proto_value_conversions.h" | 7 #include "components/sync/protocol/proto_value_conversions.h" |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 EXPECT_EQ(MODEL_TYPE_COUNT - FIRST_REAL_MODEL_TYPE - | 353 EXPECT_EQ(MODEL_TYPE_COUNT - FIRST_REAL_MODEL_TYPE - |
| 354 (LAST_PROXY_TYPE - FIRST_PROXY_TYPE + 1), | 354 (LAST_PROXY_TYPE - FIRST_PROXY_TYPE + 1), |
| 355 static_cast<int>(value->size())); | 355 static_cast<int>(value->size())); |
| 356 } | 356 } |
| 357 | 357 |
| 358 namespace { | 358 namespace { |
| 359 // Returns whether the given value has specifics under the entries in the given | 359 // Returns whether the given value has specifics under the entries in the given |
| 360 // path. | 360 // path. |
| 361 bool ValueHasSpecifics(const base::DictionaryValue& value, | 361 bool ValueHasSpecifics(const base::DictionaryValue& value, |
| 362 const std::string& path) { | 362 const std::string& path) { |
| 363 const base::ListValue* entities_list = NULL; | 363 const base::ListValue* entities_list = nullptr; |
| 364 const base::DictionaryValue* entry_dictionary = NULL; | 364 const base::DictionaryValue* entry_dictionary = nullptr; |
| 365 const base::DictionaryValue* specifics_dictionary = NULL; | 365 const base::DictionaryValue* specifics_dictionary = nullptr; |
| 366 | 366 |
| 367 if (!value.GetList(path, &entities_list)) | 367 if (!value.GetList(path, &entities_list)) |
| 368 return false; | 368 return false; |
| 369 | 369 |
| 370 if (!entities_list->GetDictionary(0, &entry_dictionary)) | 370 if (!entities_list->GetDictionary(0, &entry_dictionary)) |
| 371 return false; | 371 return false; |
| 372 | 372 |
| 373 return entry_dictionary->GetDictionary("specifics", &specifics_dictionary); | 373 return entry_dictionary->GetDictionary("specifics", &specifics_dictionary); |
| 374 } | 374 } |
| 375 } // namespace | 375 } // namespace |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 EXPECT_FALSE(ValueHasSpecifics(*(value_without_specifics.get()), | 415 EXPECT_FALSE(ValueHasSpecifics(*(value_without_specifics.get()), |
| 416 "get_updates.entries")); | 416 "get_updates.entries")); |
| 417 } | 417 } |
| 418 | 418 |
| 419 TEST_F(ProtoValueConversionsTest, AttachmentIdProtoToValue) { | 419 TEST_F(ProtoValueConversionsTest, AttachmentIdProtoToValue) { |
| 420 TestSpecificsToValue(AttachmentIdProtoToValue); | 420 TestSpecificsToValue(AttachmentIdProtoToValue); |
| 421 } | 421 } |
| 422 | 422 |
| 423 } // namespace | 423 } // namespace |
| 424 } // namespace syncer | 424 } // namespace syncer |
| OLD | NEW |