| 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 <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 std::unique_ptr<base::DictionaryValue> value = | 53 std::unique_ptr<base::DictionaryValue> value = |
| 54 specifics_to_value(specifics); | 54 specifics_to_value(specifics); |
| 55 // We can't do much but make sure that this doesn't crash. | 55 // We can't do much but make sure that this doesn't crash. |
| 56 } | 56 } |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 TEST_F(ProtoValueConversionsTest, ProtoChangeCheck) { | 59 TEST_F(ProtoValueConversionsTest, ProtoChangeCheck) { |
| 60 // If this number changes, that means we added or removed a data | 60 // If this number changes, that means we added or removed a data |
| 61 // type. Don't forget to add a unit test for {New | 61 // type. Don't forget to add a unit test for {New |
| 62 // type}SpecificsToValue below. | 62 // type}SpecificsToValue below. |
| 63 EXPECT_EQ(37, MODEL_TYPE_COUNT); | 63 EXPECT_EQ(38, MODEL_TYPE_COUNT); |
| 64 | 64 |
| 65 // We'd also like to check if we changed any field in our messages. | 65 // We'd also like to check if we changed any field in our messages. |
| 66 // However, that's hard to do: sizeof could work, but it's | 66 // However, that's hard to do: sizeof could work, but it's |
| 67 // platform-dependent. default_instance().ByteSize() won't change | 67 // platform-dependent. default_instance().ByteSize() won't change |
| 68 // for most changes, since most of our fields are optional. So we | 68 // for most changes, since most of our fields are optional. So we |
| 69 // just settle for comments in the proto files. | 69 // just settle for comments in the proto files. |
| 70 } | 70 } |
| 71 | 71 |
| 72 TEST_F(ProtoValueConversionsTest, EncryptedDataToValue) { | 72 TEST_F(ProtoValueConversionsTest, EncryptedDataToValue) { |
| 73 TestSpecificsToValue(EncryptedDataToValue); | 73 TestSpecificsToValue(EncryptedDataToValue); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 } | 251 } |
| 252 | 252 |
| 253 TEST_F(ProtoValueConversionsTest, PasswordSpecificsToValue) { | 253 TEST_F(ProtoValueConversionsTest, PasswordSpecificsToValue) { |
| 254 TestSpecificsToValue(PasswordSpecificsToValue); | 254 TestSpecificsToValue(PasswordSpecificsToValue); |
| 255 } | 255 } |
| 256 | 256 |
| 257 TEST_F(ProtoValueConversionsTest, PreferenceSpecificsToValue) { | 257 TEST_F(ProtoValueConversionsTest, PreferenceSpecificsToValue) { |
| 258 TestSpecificsToValue(PreferenceSpecificsToValue); | 258 TestSpecificsToValue(PreferenceSpecificsToValue); |
| 259 } | 259 } |
| 260 | 260 |
| 261 TEST_F(ProtoValueConversionsTest, PrinterSpecificsToValue) { |
| 262 TestSpecificsToValue(PrinterSpecificsToValue); |
| 263 } |
| 264 |
| 261 TEST_F(ProtoValueConversionsTest, SearchEngineSpecificsToValue) { | 265 TEST_F(ProtoValueConversionsTest, SearchEngineSpecificsToValue) { |
| 262 TestSpecificsToValue(SearchEngineSpecificsToValue); | 266 TestSpecificsToValue(SearchEngineSpecificsToValue); |
| 263 } | 267 } |
| 264 | 268 |
| 265 TEST_F(ProtoValueConversionsTest, SessionSpecificsToValue) { | 269 TEST_F(ProtoValueConversionsTest, SessionSpecificsToValue) { |
| 266 TestSpecificsToValue(SessionSpecificsToValue); | 270 TestSpecificsToValue(SessionSpecificsToValue); |
| 267 } | 271 } |
| 268 | 272 |
| 269 TEST_F(ProtoValueConversionsTest, SyncedNotificationAppInfoSpecificsToValue) { | 273 TEST_F(ProtoValueConversionsTest, SyncedNotificationAppInfoSpecificsToValue) { |
| 270 TestSpecificsToValue(SyncedNotificationAppInfoSpecificsToValue); | 274 TestSpecificsToValue(SyncedNotificationAppInfoSpecificsToValue); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 SET_FIELD(favicon_image); | 323 SET_FIELD(favicon_image); |
| 320 SET_FIELD(favicon_tracking); | 324 SET_FIELD(favicon_tracking); |
| 321 SET_FIELD(history_delete_directive); | 325 SET_FIELD(history_delete_directive); |
| 322 SET_FIELD(managed_user_setting); | 326 SET_FIELD(managed_user_setting); |
| 323 SET_FIELD(managed_user_shared_setting); | 327 SET_FIELD(managed_user_shared_setting); |
| 324 SET_FIELD(managed_user_whitelist); | 328 SET_FIELD(managed_user_whitelist); |
| 325 SET_FIELD(managed_user); | 329 SET_FIELD(managed_user); |
| 326 SET_FIELD(nigori); | 330 SET_FIELD(nigori); |
| 327 SET_FIELD(password); | 331 SET_FIELD(password); |
| 328 SET_FIELD(preference); | 332 SET_FIELD(preference); |
| 333 SET_FIELD(printer); |
| 329 SET_FIELD(priority_preference); | 334 SET_FIELD(priority_preference); |
| 330 SET_FIELD(search_engine); | 335 SET_FIELD(search_engine); |
| 331 SET_FIELD(session); | 336 SET_FIELD(session); |
| 332 SET_FIELD(synced_notification); | 337 SET_FIELD(synced_notification); |
| 333 SET_FIELD(synced_notification_app_info); | 338 SET_FIELD(synced_notification_app_info); |
| 334 SET_FIELD(theme); | 339 SET_FIELD(theme); |
| 335 SET_FIELD(typed_url); | 340 SET_FIELD(typed_url); |
| 336 SET_FIELD(wifi_credential); | 341 SET_FIELD(wifi_credential); |
| 337 SET_FIELD(autofill_wallet); | 342 SET_FIELD(autofill_wallet); |
| 338 SET_FIELD(wallet_metadata); | 343 SET_FIELD(wallet_metadata); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 EXPECT_FALSE(ValueHasSpecifics(*(value_without_specifics.get()), | 411 EXPECT_FALSE(ValueHasSpecifics(*(value_without_specifics.get()), |
| 407 "get_updates.entries")); | 412 "get_updates.entries")); |
| 408 } | 413 } |
| 409 | 414 |
| 410 TEST_F(ProtoValueConversionsTest, AttachmentIdProtoToValue) { | 415 TEST_F(ProtoValueConversionsTest, AttachmentIdProtoToValue) { |
| 411 TestSpecificsToValue(AttachmentIdProtoToValue); | 416 TestSpecificsToValue(AttachmentIdProtoToValue); |
| 412 } | 417 } |
| 413 | 418 |
| 414 } // namespace | 419 } // namespace |
| 415 } // namespace syncer | 420 } // namespace syncer |
| OLD | NEW |