Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Side by Side Diff: components/sync/protocol/proto_value_conversions_unittest.cc

Issue 2650253002: [Sync] Wrap model type specifics in oneof.
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/sync/protocol/sync.proto » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "components/sync/protocol/proto_value_conversions.h" 5 #include "components/sync/protocol/proto_value_conversions.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 344
345 TEST_F(ProtoValueConversionsTest, ArticleSpecificsToValue) { 345 TEST_F(ProtoValueConversionsTest, ArticleSpecificsToValue) {
346 TestSpecificsToValue(ArticleSpecificsToValue); 346 TestSpecificsToValue(ArticleSpecificsToValue);
347 } 347 }
348 348
349 TEST_F(ProtoValueConversionsTest, WifiCredentialSpecificsToValue) { 349 TEST_F(ProtoValueConversionsTest, WifiCredentialSpecificsToValue) {
350 TestSpecificsToValue(WifiCredentialSpecificsToValue); 350 TestSpecificsToValue(WifiCredentialSpecificsToValue);
351 } 351 }
352 352
353 // TODO(akalin): Figure out how to better test EntitySpecificsToValue. 353 // TODO(akalin): Figure out how to better test EntitySpecificsToValue.
354 354 // TODO(skym): Rework this case. It is no longer valid to set multiple fields.
bartekg 2017/01/24 19:19:39 Maybe there is a way to turn this into a parameter
355 TEST_F(ProtoValueConversionsTest, EntitySpecificsToValue) { 355 /*TEST_F(ProtoValueConversionsTest, EntitySpecificsToValue) {
356 sync_pb::EntitySpecifics specifics; 356 sync_pb::EntitySpecifics specifics;
357 // Touch the extensions to make sure it shows up in the generated 357 // Touch the extensions to make sure it shows up in the generated
358 // value. 358 // value.
359 #define SET_FIELD(key) (void)specifics.mutable_##key() 359 #define SET_FIELD(key) (void)specifics.mutable_##key()
360 360
361 SET_FIELD(app); 361 SET_FIELD(app);
362 SET_FIELD(app_list); 362 SET_FIELD(app_list);
363 SET_FIELD(app_notification); 363 SET_FIELD(app_notification);
364 SET_FIELD(app_setting); 364 SET_FIELD(app_setting);
365 SET_FIELD(arc_package); 365 SET_FIELD(arc_package);
(...skipping 29 matching lines...) Expand all
395 SET_FIELD(autofill_wallet); 395 SET_FIELD(autofill_wallet);
396 SET_FIELD(wallet_metadata); 396 SET_FIELD(wallet_metadata);
397 397
398 #undef SET_FIELD 398 #undef SET_FIELD
399 399
400 std::unique_ptr<base::DictionaryValue> value( 400 std::unique_ptr<base::DictionaryValue> value(
401 EntitySpecificsToValue(specifics)); 401 EntitySpecificsToValue(specifics));
402 EXPECT_EQ(MODEL_TYPE_COUNT - FIRST_REAL_MODEL_TYPE - 402 EXPECT_EQ(MODEL_TYPE_COUNT - FIRST_REAL_MODEL_TYPE -
403 (LAST_PROXY_TYPE - FIRST_PROXY_TYPE + 1), 403 (LAST_PROXY_TYPE - FIRST_PROXY_TYPE + 1),
404 static_cast<int>(value->size())); 404 static_cast<int>(value->size()));
405 } 405 }*/
406 406
407 TEST_F(ProtoValueConversionsTest, UniquePositionToValue) { 407 TEST_F(ProtoValueConversionsTest, UniquePositionToValue) {
408 sync_pb::SyncEntity entity; 408 sync_pb::SyncEntity entity;
409 entity.mutable_unique_position()->set_custom_compressed_v1("test"); 409 entity.mutable_unique_position()->set_custom_compressed_v1("test");
410 410
411 auto value = SyncEntityToValue(entity, false); 411 auto value = SyncEntityToValue(entity, false);
412 std::string unique_position; 412 std::string unique_position;
413 EXPECT_TRUE(value->GetString("unique_position", &unique_position)); 413 EXPECT_TRUE(value->GetString("unique_position", &unique_position));
414 414
415 std::string expected_unique_position = 415 std::string expected_unique_position =
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 EXPECT_FALSE(ValueHasSpecifics(*(value_without_specifics.get()), 488 EXPECT_FALSE(ValueHasSpecifics(*(value_without_specifics.get()),
489 "get_updates.entries")); 489 "get_updates.entries"));
490 } 490 }
491 491
492 TEST_F(ProtoValueConversionsTest, AttachmentIdProtoToValue) { 492 TEST_F(ProtoValueConversionsTest, AttachmentIdProtoToValue) {
493 TestSpecificsToValue(AttachmentIdProtoToValue); 493 TestSpecificsToValue(AttachmentIdProtoToValue);
494 } 494 }
495 495
496 } // namespace 496 } // namespace
497 } // namespace syncer 497 } // namespace syncer
OLDNEW
« no previous file with comments | « no previous file | components/sync/protocol/sync.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698