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

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: update sync unittest and README.chromium 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
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 ee722542a7e5e09c5c9416ad2829311def3e870e..10fb00d76f0293d73e3b631f367b45958397b045 100644
--- a/sync/internal_api/sync_manager_impl_unittest.cc
+++ b/sync/internal_api/sync_manager_impl_unittest.cc
@@ -75,6 +75,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;
@@ -630,13 +632,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) {

Powered by Google App Engine
This is Rietveld 408576698