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

Unified Diff: sync/internal_api/sync_manager_impl_unittest.cc

Issue 1842653006: Update //third_party/protobuf to version 3. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sync/internal_api/DEPS ('k') | sync/internal_api/write_node.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/internal_api/sync_manager_impl_unittest.cc
diff --git a/sync/internal_api/sync_manager_impl_unittest.cc b/sync/internal_api/sync_manager_impl_unittest.cc
index aace4a9e5ee9dfc8cb7541c6040f186ceef7b22c..b5e23ae37c7a1760ac08204b8cffdcd64a12ef28 100644
--- a/sync/internal_api/sync_manager_impl_unittest.cc
+++ b/sync/internal_api/sync_manager_impl_unittest.cc
@@ -76,6 +76,8 @@
#include "sync/util/time.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/protobuf/src/google/protobuf/io/coded_stream.h"
+#include "third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h"
#include "url/gurl.h"
using base::ExpectDictStringValue;
@@ -631,13 +633,25 @@ TEST_F(SyncApiTest, BaseNodeSetSpecificsPreservesUnknownFields) {
sync_pb::EntitySpecifics entity_specifics;
entity_specifics.mutable_bookmark()->set_url("http://www.google.com");
- entity_specifics.mutable_unknown_fields()->AddFixed32(5, 100);
+ std::string unknown_fields;
+ {
+ ::google::protobuf::io::StringOutputStream unknown_fields_stream(
+ &unknown_fields);
+ ::google::protobuf::io::CodedOutputStream output(&unknown_fields_stream);
+ const int tag = 5;
+ const int value = 100;
+ output.WriteTag(tag);
+ output.WriteLittleEndian32(value);
+ }
+ *entity_specifics.mutable_unknown_fields() = unknown_fields;
node.SetEntitySpecifics(entity_specifics);
EXPECT_FALSE(node.GetEntitySpecifics().unknown_fields().empty());
+ EXPECT_EQ(unknown_fields, node.GetEntitySpecifics().unknown_fields());
- entity_specifics.mutable_unknown_fields()->Clear();
+ entity_specifics.mutable_unknown_fields()->clear();
node.SetEntitySpecifics(entity_specifics);
EXPECT_FALSE(node.GetEntitySpecifics().unknown_fields().empty());
+ EXPECT_EQ(unknown_fields, node.GetEntitySpecifics().unknown_fields());
}
TEST_F(SyncApiTest, EmptyTags) {
« no previous file with comments | « sync/internal_api/DEPS ('k') | sync/internal_api/write_node.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698