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

Side by Side Diff: sync/util/protobuf_unittest.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 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 | « sync/util/nigori_unittest.cc ('k') | sync/util/test_unrecoverable_error_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include <string>
6 #include <vector>
7
8 #include "sync/protocol/test.pb.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10
11 namespace {
12
13 TEST(SyncProtobufTest, TestUnknownFields) {
14 // This tests ensures that we retain unknown fields in protocol buffers by
15 // serialising UnknownFieldsTestB, which is a superset of UnknownFieldsTestA,
16 // and checking we get back to the same message after parsing/serialising via
17 // UnknownFieldsTestA.
18 sync_pb::UnknownFieldsTestA a;
19 sync_pb::UnknownFieldsTestB b;
20 sync_pb::UnknownFieldsTestB b2;
21
22 b.set_foo(true);
23 b.set_bar(true);
24 std::string serialized;
25 ASSERT_TRUE(b.SerializeToString(&serialized));
26 ASSERT_TRUE(a.ParseFromString(serialized));
27 ASSERT_TRUE(a.foo());
28 std::string serialized2;
29 ASSERT_TRUE(a.SerializeToString(&serialized2));
30 ASSERT_TRUE(b2.ParseFromString(serialized2));
31 ASSERT_TRUE(b2.foo());
32 ASSERT_TRUE(b2.bar());
33 }
34
35 } // namespace
OLDNEW
« no previous file with comments | « sync/util/nigori_unittest.cc ('k') | sync/util/test_unrecoverable_error_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698