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(38, MODEL_TYPE_COUNT); | 63 EXPECT_EQ(39, 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) { | 261 TEST_F(ProtoValueConversionsTest, PrinterSpecificsToValue) { |
262 TestSpecificsToValue(PrinterSpecificsToValue); | 262 TestSpecificsToValue(PrinterSpecificsToValue); |
263 } | 263 } |
264 | 264 |
| 265 TEST_F(ProtoValueConversionsTest, ReadingListSpecificsToValue) { |
| 266 TestSpecificsToValue(ReadingListSpecificsToValue); |
| 267 } |
| 268 |
265 TEST_F(ProtoValueConversionsTest, SearchEngineSpecificsToValue) { | 269 TEST_F(ProtoValueConversionsTest, SearchEngineSpecificsToValue) { |
266 TestSpecificsToValue(SearchEngineSpecificsToValue); | 270 TestSpecificsToValue(SearchEngineSpecificsToValue); |
267 } | 271 } |
268 | 272 |
269 TEST_F(ProtoValueConversionsTest, SessionSpecificsToValue) { | 273 TEST_F(ProtoValueConversionsTest, SessionSpecificsToValue) { |
270 TestSpecificsToValue(SessionSpecificsToValue); | 274 TestSpecificsToValue(SessionSpecificsToValue); |
271 } | 275 } |
272 | 276 |
273 TEST_F(ProtoValueConversionsTest, SyncedNotificationAppInfoSpecificsToValue) { | 277 TEST_F(ProtoValueConversionsTest, SyncedNotificationAppInfoSpecificsToValue) { |
274 TestSpecificsToValue(SyncedNotificationAppInfoSpecificsToValue); | 278 TestSpecificsToValue(SyncedNotificationAppInfoSpecificsToValue); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 SET_FIELD(history_delete_directive); | 329 SET_FIELD(history_delete_directive); |
326 SET_FIELD(managed_user_setting); | 330 SET_FIELD(managed_user_setting); |
327 SET_FIELD(managed_user_shared_setting); | 331 SET_FIELD(managed_user_shared_setting); |
328 SET_FIELD(managed_user_whitelist); | 332 SET_FIELD(managed_user_whitelist); |
329 SET_FIELD(managed_user); | 333 SET_FIELD(managed_user); |
330 SET_FIELD(nigori); | 334 SET_FIELD(nigori); |
331 SET_FIELD(password); | 335 SET_FIELD(password); |
332 SET_FIELD(preference); | 336 SET_FIELD(preference); |
333 SET_FIELD(printer); | 337 SET_FIELD(printer); |
334 SET_FIELD(priority_preference); | 338 SET_FIELD(priority_preference); |
| 339 SET_FIELD(reading_list); |
335 SET_FIELD(search_engine); | 340 SET_FIELD(search_engine); |
336 SET_FIELD(session); | 341 SET_FIELD(session); |
337 SET_FIELD(synced_notification); | 342 SET_FIELD(synced_notification); |
338 SET_FIELD(synced_notification_app_info); | 343 SET_FIELD(synced_notification_app_info); |
339 SET_FIELD(theme); | 344 SET_FIELD(theme); |
340 SET_FIELD(typed_url); | 345 SET_FIELD(typed_url); |
341 SET_FIELD(wifi_credential); | 346 SET_FIELD(wifi_credential); |
342 SET_FIELD(autofill_wallet); | 347 SET_FIELD(autofill_wallet); |
343 SET_FIELD(wallet_metadata); | 348 SET_FIELD(wallet_metadata); |
344 | 349 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 EXPECT_FALSE(ValueHasSpecifics(*(value_without_specifics.get()), | 416 EXPECT_FALSE(ValueHasSpecifics(*(value_without_specifics.get()), |
412 "get_updates.entries")); | 417 "get_updates.entries")); |
413 } | 418 } |
414 | 419 |
415 TEST_F(ProtoValueConversionsTest, AttachmentIdProtoToValue) { | 420 TEST_F(ProtoValueConversionsTest, AttachmentIdProtoToValue) { |
416 TestSpecificsToValue(AttachmentIdProtoToValue); | 421 TestSpecificsToValue(AttachmentIdProtoToValue); |
417 } | 422 } |
418 | 423 |
419 } // namespace | 424 } // namespace |
420 } // namespace syncer | 425 } // namespace syncer |
OLD | NEW |