protostream_objectsource_test.cc
Go to the documentation of this file.
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
32 
33 #include <memory>
34 #include <sstream>
35 
36 #include <google/protobuf/any.pb.h>
41 #include <google/protobuf/util/internal/testdata/anys.pb.h>
42 #include <google/protobuf/util/internal/testdata/books.pb.h>
43 #include <google/protobuf/util/internal/testdata/field_mask.pb.h>
44 #include <google/protobuf/util/internal/testdata/maps.pb.h>
45 #include <google/protobuf/util/internal/testdata/proto3.pb.h>
46 #include <google/protobuf/util/internal/testdata/struct.pb.h>
47 #include <google/protobuf/util/internal/testdata/timestamp_duration.pb.h>
51 #include <gtest/gtest.h>
53 
54 
55 namespace google {
56 namespace protobuf {
57 namespace util {
58 namespace converter {
59 
60 using io::ArrayInputStream;
61 using io::CodedInputStream;
62 using proto_util_converter::testing::AnyM;
63 using proto_util_converter::testing::AnyOut;
64 using proto_util_converter::testing::Author;
65 using proto_util_converter::testing::BadAuthor;
66 using proto_util_converter::testing::BadNestedBook;
67 using proto_util_converter::testing::Book;
68 using proto_util_converter::testing::Book_Label;
69 using proto_util_converter::testing::Cyclic;
70 using proto_util_converter::testing::FieldMaskTest;
71 using proto_util_converter::testing::MapOut;
72 using proto_util_converter::testing::MapOutWireFormat;
73 using proto_util_converter::testing::NestedBook;
74 using proto_util_converter::testing::NestedFieldMask;
75 using proto_util_converter::testing::PackedPrimitive;
76 using proto_util_converter::testing::Primitive;
77 using proto_util_converter::testing::Proto3Message;
78 using proto_util_converter::testing::StructType;
79 using proto_util_converter::testing::TimestampDuration;
81 using util::Status;
82 
83 
84 namespace {
86  return std::string(kTypeServiceBaseUrl) + "/" + descriptor->full_name();
87 }
88 } // namespace
89 
91  : public ::testing::TestWithParam<testing::TypeInfoSource> {
92  protected:
94  : helper_(GetParam()),
95  mock_(),
96  ow_(&mock_),
103  }
104 
106 
107  void DoTest(const Message& msg, const Descriptor* descriptor) {
108  Status status = ExecuteTest(msg, descriptor);
109  EXPECT_EQ(util::Status(), status);
110  }
111 
113  std::ostringstream oss;
114  msg.SerializePartialToOstream(&oss);
115  std::string proto = oss.str();
116  ArrayInputStream arr_stream(proto.data(), proto.size());
117  CodedInputStream in_stream(&arr_stream);
118 
119  std::unique_ptr<ProtoStreamObjectSource> os(
121  if (use_lower_camel_for_enums_) os->set_use_lower_camel_for_enums(true);
122  if (use_ints_for_enums_) os->set_use_ints_for_enums(true);
124  os->set_preserve_proto_field_names(true);
125  os->set_max_recursion_depth(64);
126  return os->WriteTo(&mock_);
127  }
128 
130  ow_.StartObject("")
131  ->StartList("repFix32")
132  ->RenderUint32("", bit_cast<uint32>(3201))
133  ->RenderUint32("", bit_cast<uint32>(0))
134  ->RenderUint32("", bit_cast<uint32>(3202))
135  ->EndList()
136  ->StartList("repU32")
137  ->RenderUint32("", bit_cast<uint32>(3203))
138  ->RenderUint32("", bit_cast<uint32>(0))
139  ->EndList()
140  ->StartList("repI32")
141  ->RenderInt32("", 0)
142  ->RenderInt32("", 3204)
143  ->RenderInt32("", 3205)
144  ->EndList()
145  ->StartList("repSf32")
146  ->RenderInt32("", 3206)
147  ->RenderInt32("", 0)
148  ->EndList()
149  ->StartList("repS32")
150  ->RenderInt32("", 0)
151  ->RenderInt32("", 3207)
152  ->RenderInt32("", 3208)
153  ->EndList()
154  ->StartList("repFix64")
155  ->RenderUint64("", bit_cast<uint64>(6401LL))
156  ->RenderUint64("", bit_cast<uint64>(0LL))
157  ->EndList()
158  ->StartList("repU64")
159  ->RenderUint64("", bit_cast<uint64>(0LL))
160  ->RenderUint64("", bit_cast<uint64>(6402LL))
161  ->RenderUint64("", bit_cast<uint64>(6403LL))
162  ->EndList()
163  ->StartList("repI64")
164  ->RenderInt64("", 6404L)
165  ->RenderInt64("", 0L)
166  ->EndList()
167  ->StartList("repSf64")
168  ->RenderInt64("", 0L)
169  ->RenderInt64("", 6405L)
170  ->RenderInt64("", 6406L)
171  ->EndList()
172  ->StartList("repS64")
173  ->RenderInt64("", 6407L)
174  ->RenderInt64("", 0L)
175  ->EndList()
176  ->StartList("repFloat")
177  ->RenderFloat("", 0.0f)
178  ->RenderFloat("", 32.1f)
179  ->RenderFloat("", 32.2f)
180  ->EndList()
181  ->StartList("repDouble")
182  ->RenderDouble("", 64.1L)
183  ->RenderDouble("", 0.0L)
184  ->EndList()
185  ->StartList("repBool")
186  ->RenderBool("", true)
187  ->RenderBool("", false)
188  ->EndList()
189  ->EndObject();
190  }
191 
193  Primitive primitive;
194  primitive.add_rep_fix32(3201);
195  primitive.add_rep_fix32(0);
196  primitive.add_rep_fix32(3202);
197  primitive.add_rep_u32(3203);
198  primitive.add_rep_u32(0);
199  primitive.add_rep_i32(0);
200  primitive.add_rep_i32(3204);
201  primitive.add_rep_i32(3205);
202  primitive.add_rep_sf32(3206);
203  primitive.add_rep_sf32(0);
204  primitive.add_rep_s32(0);
205  primitive.add_rep_s32(3207);
206  primitive.add_rep_s32(3208);
207  primitive.add_rep_fix64(6401L);
208  primitive.add_rep_fix64(0L);
209  primitive.add_rep_u64(0L);
210  primitive.add_rep_u64(6402L);
211  primitive.add_rep_u64(6403L);
212  primitive.add_rep_i64(6404L);
213  primitive.add_rep_i64(0L);
214  primitive.add_rep_sf64(0L);
215  primitive.add_rep_sf64(6405L);
216  primitive.add_rep_sf64(6406L);
217  primitive.add_rep_s64(6407L);
218  primitive.add_rep_s64(0L);
219  primitive.add_rep_float(0.0f);
220  primitive.add_rep_float(32.1f);
221  primitive.add_rep_float(32.2f);
222  primitive.add_rep_double(64.1L);
223  primitive.add_rep_double(0.0);
224  primitive.add_rep_bool(true);
225  primitive.add_rep_bool(false);
226 
228  return primitive;
229  }
230 
231  PackedPrimitive PreparePackedPrimitive() {
232  PackedPrimitive primitive;
233  primitive.add_rep_fix32(3201);
234  primitive.add_rep_fix32(0);
235  primitive.add_rep_fix32(3202);
236  primitive.add_rep_u32(3203);
237  primitive.add_rep_u32(0);
238  primitive.add_rep_i32(0);
239  primitive.add_rep_i32(3204);
240  primitive.add_rep_i32(3205);
241  primitive.add_rep_sf32(3206);
242  primitive.add_rep_sf32(0);
243  primitive.add_rep_s32(0);
244  primitive.add_rep_s32(3207);
245  primitive.add_rep_s32(3208);
246  primitive.add_rep_fix64(6401L);
247  primitive.add_rep_fix64(0L);
248  primitive.add_rep_u64(0L);
249  primitive.add_rep_u64(6402L);
250  primitive.add_rep_u64(6403L);
251  primitive.add_rep_i64(6404L);
252  primitive.add_rep_i64(0L);
253  primitive.add_rep_sf64(0L);
254  primitive.add_rep_sf64(6405L);
255  primitive.add_rep_sf64(6406L);
256  primitive.add_rep_s64(6407L);
257  primitive.add_rep_s64(0L);
258  primitive.add_rep_float(0.0f);
259  primitive.add_rep_float(32.1f);
260  primitive.add_rep_float(32.2f);
261  primitive.add_rep_double(64.1L);
262  primitive.add_rep_double(0.0);
263  primitive.add_rep_bool(true);
264  primitive.add_rep_bool(false);
265 
267  return primitive;
268  }
269 
271 
273 
275 
277 
280  }
281 
283 
291 };
292 
293 INSTANTIATE_TEST_SUITE_P(DifferentTypeInfoSourceTest,
295  ::testing::Values(
297 
299  Book empty;
300  ow_.StartObject("")->EndObject();
301  DoTest(empty, Book::descriptor());
302 }
303 
305  Primitive primitive;
306  primitive.set_fix32(3201);
307  primitive.set_u32(3202);
308  primitive.set_i32(3203);
309  primitive.set_sf32(3204);
310  primitive.set_s32(3205);
311  primitive.set_fix64(6401L);
312  primitive.set_u64(6402L);
313  primitive.set_i64(6403L);
314  primitive.set_sf64(6404L);
315  primitive.set_s64(6405L);
316  primitive.set_str("String Value");
317  primitive.set_bytes("Some Bytes");
318  primitive.set_float_(32.1f);
319  primitive.set_double_(64.1L);
320  primitive.set_bool_(true);
321 
322  ow_.StartObject("")
323  ->RenderUint32("fix32", bit_cast<uint32>(3201))
324  ->RenderUint32("u32", bit_cast<uint32>(3202))
325  ->RenderInt32("i32", 3203)
326  ->RenderInt32("sf32", 3204)
327  ->RenderInt32("s32", 3205)
328  ->RenderUint64("fix64", bit_cast<uint64>(6401LL))
329  ->RenderUint64("u64", bit_cast<uint64>(6402LL))
330  ->RenderInt64("i64", 6403L)
331  ->RenderInt64("sf64", 6404L)
332  ->RenderInt64("s64", 6405L)
333  ->RenderString("str", "String Value")
334  ->RenderBytes("bytes", "Some Bytes")
335  ->RenderFloat("float", 32.1f)
336  ->RenderDouble("double", 64.1L)
337  ->RenderBool("bool", true)
338  ->EndObject();
339  DoTest(primitive, Primitive::descriptor());
340 }
341 
342 TEST_P(ProtostreamObjectSourceTest, RepeatingPrimitives) {
343  Primitive primitive = PrepareRepeatedPrimitive();
344  primitive.add_rep_str("String One");
345  primitive.add_rep_str("String Two");
346  primitive.add_rep_bytes("Some Bytes");
347 
348  ow_.StartList("repStr")
349  ->RenderString("", "String One")
350  ->RenderString("", "String Two")
351  ->EndList()
352  ->StartList("repBytes")
353  ->RenderBytes("", "Some Bytes")
354  ->EndList();
355  DoTest(primitive, Primitive::descriptor());
356 }
357 
359  Author author;
360  author.set_id(12345);
361 
362  ow_.StartObject("")->RenderUint64("@id", 12345)->EndObject();
363  DoTest(author, Author::descriptor());
364 }
365 
367  Author* author = new Author();
368  author->set_name("Tolstoy");
369  Book book;
370  book.set_title("My Book");
371  book.set_allocated_author(author);
372 
373  ow_.StartObject("")
374  ->RenderString("title", "My Book")
375  ->StartObject("author")
376  ->RenderString("name", "Tolstoy")
377  ->EndObject()
378  ->EndObject();
379  DoTest(book, Book::descriptor());
380 }
381 
383  Author author;
384  author.set_alive(false);
385  author.set_name("john");
386  author.add_pseudonym("phil");
387  author.add_pseudonym("bob");
388 
389  ow_.StartObject("")
390  ->RenderBool("alive", false)
391  ->RenderString("name", "john")
392  ->StartList("pseudonym")
393  ->RenderString("", "phil")
394  ->RenderString("", "bob")
395  ->EndList()
396  ->EndObject();
397  DoTest(author, Author::descriptor());
398 }
399 
400 TEST_P(ProtostreamObjectSourceTest, PackedRepeatingFields) {
401  DoTest(PreparePackedPrimitive(), PackedPrimitive::descriptor());
402 }
403 
404 TEST_P(ProtostreamObjectSourceTest, NonPackedPackableFieldsActuallyPacked) {
405  // Protostream is packed, but parse with non-packed Primitive.
406  DoTest(PreparePackedPrimitive(), Primitive::descriptor());
407 }
408 
409 TEST_P(ProtostreamObjectSourceTest, PackedPackableFieldNotActuallyPacked) {
410  // Protostream is not packed, but parse with PackedPrimitive.
411  DoTest(PrepareRepeatedPrimitive(), PackedPrimitive::descriptor());
412 }
413 
415  Author author;
416  author.set_alive(false);
417  author.set_name("john");
418  author.set_id(1234L);
419  author.add_pseudonym("phil");
420  author.add_pseudonym("bob");
421 
422  ow_.StartObject("")
423  ->StartList("alive")
424  ->RenderBool("", false)
425  ->EndList()
426  ->StartList("name")
427  ->RenderUint64("", static_cast<uint64>('j'))
428  ->RenderUint64("", static_cast<uint64>('o'))
429  ->RenderUint64("", static_cast<uint64>('h'))
430  ->RenderUint64("", static_cast<uint64>('n'))
431  ->EndList()
432  ->RenderString("pseudonym", "phil")
433  ->RenderString("pseudonym", "bob")
434  ->EndObject();
435  // Protostream created with Author, but parsed with BadAuthor.
436  DoTest(author, BadAuthor::descriptor());
437 }
438 
439 TEST_P(ProtostreamObjectSourceTest, NestedBookToBadNestedBook) {
440  Book* book = new Book();
441  book->set_length(250);
442  book->set_published(2014L);
443  NestedBook nested;
444  nested.set_allocated_book(book);
445 
446  ow_.StartObject("")
447  ->StartList("book")
448  ->RenderUint32("", 24) // tag for field length (3 << 3)
449  ->RenderUint32("", 250)
450  ->RenderUint32("", 32) // tag for field published (4 << 3)
451  ->RenderUint32("", 2014)
452  ->EndList()
453  ->EndObject();
454  // Protostream created with NestedBook, but parsed with BadNestedBook.
456 }
457 
458 TEST_P(ProtostreamObjectSourceTest, BadNestedBookToNestedBook) {
459  BadNestedBook nested;
460  nested.add_book(1);
461  nested.add_book(2);
462  nested.add_book(3);
463  nested.add_book(4);
464  nested.add_book(5);
465  nested.add_book(6);
466  nested.add_book(7);
467 
468  ow_.StartObject("")->StartObject("book")->EndObject()->EndObject();
469  // Protostream created with BadNestedBook, but parsed with NestedBook.
470  DoTest(nested, NestedBook::descriptor());
471 }
472 
474  LongRepeatedListDoesNotBreakIntoMultipleJsonLists) {
475  Book book;
476 
477  int repeat = 10000;
478  for (int i = 0; i < repeat; ++i) {
479  Book_Label* label = book.add_labels();
480  label->set_key(StrCat("i", i));
481  label->set_value(StrCat("v", i));
482  }
483 
484  // Make sure StartList and EndList are called exactly once (see b/18227499 for
485  // problems when this doesn't happen)
486  EXPECT_CALL(mock_, StartList(_)).Times(1);
487  EXPECT_CALL(mock_, EndList()).Times(1);
488 
489  DoTest(book, Book::descriptor());
490 }
491 
492 TEST_P(ProtostreamObjectSourceTest, LowerCamelEnumOutputMacroCase) {
493  Book book;
494  book.set_type(Book::ACTION_AND_ADVENTURE);
495 
496  UseLowerCamelForEnums();
497 
498  ow_.StartObject("")->RenderString("type", "actionAndAdventure")->EndObject();
499  DoTest(book, Book::descriptor());
500 }
501 
502 TEST_P(ProtostreamObjectSourceTest, LowerCamelEnumOutputSnakeCase) {
503  Book book;
504  book.set_type(Book::arts_and_photography);
505 
506  UseLowerCamelForEnums();
507 
508  ow_.StartObject("")->RenderString("type", "artsAndPhotography")->EndObject();
509  DoTest(book, Book::descriptor());
510 }
511 
512 TEST_P(ProtostreamObjectSourceTest, LowerCamelEnumOutputWithNumber) {
513  Book book;
514  book.set_type(Book::I18N_Tech);
515 
516  UseLowerCamelForEnums();
517 
518  ow_.StartObject("")->RenderString("type", "i18nTech")->EndObject();
519  DoTest(book, Book::descriptor());
520 }
521 
522 TEST_P(ProtostreamObjectSourceTest, EnumCaseIsUnchangedByDefault) {
523  Book book;
524  book.set_type(Book::ACTION_AND_ADVENTURE);
525  ow_.StartObject("")
526  ->RenderString("type", "ACTION_AND_ADVENTURE")
527  ->EndObject();
528  DoTest(book, Book::descriptor());
529 }
530 
531 TEST_P(ProtostreamObjectSourceTest, UseIntsForEnumsTest) {
532  Book book;
533  book.set_type(Book::ACTION_AND_ADVENTURE);
534 
535  UseIntsForEnums();
536 
537  ow_.StartObject("")->RenderInt32("type", 3)->EndObject();
538  DoTest(book, Book::descriptor());
539 }
540 
541 TEST_P(ProtostreamObjectSourceTest, UsePreserveProtoFieldNames) {
542  Book book;
543  book.set_snake_field("foo");
544 
545  UsePreserveProtoFieldNames();
546 
547  ow_.StartObject("")->RenderString("snake_field", "foo")->EndObject();
548  DoTest(book, Book::descriptor());
549 }
550 
552  UnknownEnumAreDroppedWhenRenderUnknownEnumValuesIsUnset) {
553  Proto3Message message;
554  message.set_enum_value(static_cast<Proto3Message::NestedEnum>(1234));
555 
556  SetRenderUnknownEnumValues(false);
557 
558  // Unknown enum values are not output.
559  ow_.StartObject("")->EndObject();
561 }
562 
564  UnknownEnumAreOutputWhenRenderUnknownEnumValuesIsSet) {
565  Proto3Message message;
566  message.set_enum_value(static_cast<Proto3Message::NestedEnum>(1234));
567 
568  SetRenderUnknownEnumValues(true);
569 
570  // Unknown enum values are output.
571  ow_.StartObject("")->RenderInt32("enumValue", 1234)->EndObject();
573 }
574 
575 TEST_P(ProtostreamObjectSourceTest, CyclicMessageDepthTest) {
576  Cyclic cyclic;
577  cyclic.set_m_int(123);
578 
579  Book* book = cyclic.mutable_m_book();
580  book->set_title("book title");
581  Cyclic* current = cyclic.mutable_m_cyclic();
582  Author* current_author = cyclic.add_m_author();
583  for (int i = 0; i < 63; ++i) {
584  Author* next = current_author->add_friend_();
585  next->set_id(i);
586  next->set_name(StrCat("author_name_", i));
587  next->set_alive(true);
588  current_author = next;
589  }
590 
591  // Recursive message with depth (65) > max (max is 64).
592  for (int i = 0; i < 64; ++i) {
593  Cyclic* next = current->mutable_m_cyclic();
594  next->set_m_str(StrCat("count_", i));
595  current = next;
596  }
597 
598  Status status = ExecuteTest(cyclic, Cyclic::descriptor());
600 }
601 
603  protected:
606  }
607 };
608 
609 INSTANTIATE_TEST_SUITE_P(DifferentTypeInfoSourceTest,
610  ProtostreamObjectSourceMapsTest,
611  ::testing::Values(
613 
614 // Tests JSON map.
615 //
616 // This is the example expected output.
617 // {
618 // "map1": {
619 // "key1": {
620 // "foo": "foovalue"
621 // },
622 // "key2": {
623 // "foo": "barvalue"
624 // }
625 // },
626 // "map2": {
627 // "nestedself": {
628 // "map1": {
629 // "nested_key1": {
630 // "foo": "nested_foo"
631 // }
632 // },
633 // "bar": "nested_bar_string"
634 // }
635 // },
636 // "map3": {
637 // "111": "one one one"
638 // },
639 // "bar": "top bar"
640 // }
642  MapOut out;
643  (*out.mutable_map1())["key1"].set_foo("foovalue");
644  (*out.mutable_map1())["key2"].set_foo("barvalue");
645 
646  MapOut* nested_value = &(*out.mutable_map2())["nestedself"];
647  (*nested_value->mutable_map1())["nested_key1"].set_foo("nested_foo");
648  nested_value->set_bar("nested_bar_string");
649 
650  (*out.mutable_map3())[111] = "one one one";
651 
652  out.set_bar("top bar");
653 
654  ow_.StartObject("")
655  ->StartObject("map1")
656  ->StartObject("key1")
657  ->RenderString("foo", "foovalue")
658  ->EndObject()
659  ->StartObject("key2")
660  ->RenderString("foo", "barvalue")
661  ->EndObject()
662  ->StartObject("map2")
663  ->StartObject("nestedself")
664  ->StartObject("map1")
665  ->StartObject("nested_key1")
666  ->RenderString("foo", "nested_foo")
667  ->EndObject()
668  ->EndObject()
669  ->RenderString("bar", "nested_bar_string")
670  ->EndObject()
671  ->EndObject()
672  ->StartObject("map3")
673  ->RenderString("111", "one one one")
674  ->EndObject()
675  ->EndObject()
676  ->RenderString("bar", "top bar")
677  ->EndObject();
678 
679  DoTest(out, MapOut::descriptor());
680 }
681 
683  // MapOutWireFormat has the same wire representation with MapOut but uses
684  // repeated message fields to represent map fields so we can intentionally
685  // leave out the key field or the value field of a map entry.
686  MapOutWireFormat out;
687  // Create some map entries without keys. They will be rendered with the
688  // default values ("" for strings, "0" for integers, etc.).
689  // {
690  // "map1": {
691  // "": {
692  // "foo": "foovalue"
693  // }
694  // },
695  // "map2": {
696  // "": {
697  // "map1": {
698  // "nested_key1": {
699  // "foo": "nested_foo"
700  // }
701  // }
702  // }
703  // },
704  // "map3": {
705  // "0": "one one one"
706  // },
707  // "map4": {
708  // "false": "bool"
709  // }
710  // }
711  out.add_map1()->mutable_value()->set_foo("foovalue");
712  MapOut* nested = out.add_map2()->mutable_value();
713  (*nested->mutable_map1())["nested_key1"].set_foo("nested_foo");
714  out.add_map3()->set_value("one one one");
715  out.add_map4()->set_value("bool");
716 
717  ow_.StartObject("")
718  ->StartObject("map1")
719  ->StartObject("")
720  ->RenderString("foo", "foovalue")
721  ->EndObject()
722  ->EndObject()
723  ->StartObject("map2")
724  ->StartObject("")
725  ->StartObject("map1")
726  ->StartObject("nested_key1")
727  ->RenderString("foo", "nested_foo")
728  ->EndObject()
729  ->EndObject()
730  ->EndObject()
731  ->EndObject()
732  ->StartObject("map3")
733  ->RenderString("0", "one one one")
734  ->EndObject()
735  ->StartObject("map4")
736  ->RenderString("false", "bool")
737  ->EndObject()
738  ->EndObject();
739 
740  DoTest(out, MapOut::descriptor());
741 }
742 
744  protected:
748  }
749 };
750 
751 INSTANTIATE_TEST_SUITE_P(DifferentTypeInfoSourceTest,
752  ProtostreamObjectSourceAnysTest,
753  ::testing::Values(
755 
756 // Tests JSON any support.
757 //
758 // This is the example expected output.
759 // {
760 // "any": {
761 // "@type": "type.googleapis.com/google.protobuf.testing.AnyM"
762 // "foo": "foovalue"
763 // }
764 // }
766  AnyOut out;
767  ::google::protobuf::Any* any = out.mutable_any();
768 
769  AnyM m;
770  m.set_foo("foovalue");
771  any->PackFrom(m);
772 
773  ow_.StartObject("")
774  ->StartObject("any")
775  ->RenderString("@type",
776  "type.googleapis.com/proto_util_converter.testing.AnyM")
777  ->RenderString("foo", "foovalue")
778  ->EndObject()
779  ->EndObject();
780 
781  DoTest(out, AnyOut::descriptor());
782 }
783 
784 TEST_P(ProtostreamObjectSourceAnysTest, LowerCamelEnumOutputSnakeCase) {
785  AnyOut out;
786  ::google::protobuf::Any* any = out.mutable_any();
787 
788  Book book;
789  book.set_type(Book::arts_and_photography);
790  any->PackFrom(book);
791 
792  UseLowerCamelForEnums();
793 
794  ow_.StartObject("")
795  ->StartObject("any")
796  ->RenderString("@type",
797  "type.googleapis.com/proto_util_converter.testing.Book")
798  ->RenderString("type", "artsAndPhotography")
799  ->EndObject()
800  ->EndObject();
801 
802  DoTest(out, AnyOut::descriptor());
803 }
804 
806  AnyOut out;
807  ::google::protobuf::Any* any = out.mutable_any();
808 
809  Book book;
810  book.set_type(Book::ACTION_AND_ADVENTURE);
811  any->PackFrom(book);
812 
813  UseIntsForEnums();
814 
815  ow_.StartObject("")
816  ->StartObject("any")
817  ->RenderString("@type",
818  "type.googleapis.com/proto_util_converter.testing.Book")
819  ->RenderInt32("type", 3)
820  ->EndObject()
821  ->EndObject();
822 
823  DoTest(out, AnyOut::descriptor());
824 }
825 
826 TEST_P(ProtostreamObjectSourceAnysTest, UsePreserveProtoFieldNames) {
827  AnyOut out;
828  ::google::protobuf::Any* any = out.mutable_any();
829 
830  Book book;
831  book.set_snake_field("foo");
832  any->PackFrom(book);
833 
834  UsePreserveProtoFieldNames();
835 
836  ow_.StartObject("")
837  ->StartObject("any")
838  ->RenderString("@type",
839  "type.googleapis.com/proto_util_converter.testing.Book")
840  ->RenderString("snake_field", "foo")
841  ->EndObject()
842  ->EndObject();
843 
844  DoTest(out, AnyOut::descriptor());
845 }
846 
848  AnyOut out;
849  ::google::protobuf::Any* any = out.mutable_any();
850  any->set_type_url("type.googleapis.com/google.protobuf.Any");
851 
852  ::google::protobuf::Any nested_any;
853  nested_any.set_type_url(
854  "type.googleapis.com/proto_util_converter.testing.AnyM");
855 
856  AnyM m;
857  m.set_foo("foovalue");
858  nested_any.set_value(m.SerializeAsString());
859 
860  any->set_value(nested_any.SerializeAsString());
861 
862  ow_.StartObject("")
863  ->StartObject("any")
864  ->RenderString("@type", "type.googleapis.com/google.protobuf.Any")
865  ->StartObject("value")
866  ->RenderString("@type",
867  "type.googleapis.com/proto_util_converter.testing.AnyM")
868  ->RenderString("foo", "foovalue")
869  ->EndObject()
870  ->EndObject()
871  ->EndObject();
872 
873  DoTest(out, AnyOut::descriptor());
874 }
875 
877  AnyOut out;
878  ::google::protobuf::Any* any = out.mutable_any();
879  any->set_type_url("type.googleapis.com/google.protobuf.Any");
880 
881  ::google::protobuf::Any nested_any;
882  nested_any.set_type_url("type.googleapis.com/google.protobuf.Any");
883 
884  ::google::protobuf::Any second_nested_any;
885  second_nested_any.set_type_url(
886  "type.googleapis.com/proto_util_converter.testing.AnyM");
887 
888  AnyM m;
889  m.set_foo("foovalue");
890  second_nested_any.set_value(m.SerializeAsString());
891  nested_any.set_value(second_nested_any.SerializeAsString());
892  any->set_value(nested_any.SerializeAsString());
893 
894  ow_.StartObject("")
895  ->StartObject("any")
896  ->RenderString("@type", "type.googleapis.com/google.protobuf.Any")
897  ->StartObject("value")
898  ->RenderString("@type", "type.googleapis.com/google.protobuf.Any")
899  ->StartObject("value")
900  ->RenderString("@type",
901  "type.googleapis.com/proto_util_converter.testing.AnyM")
902  ->RenderString("foo", "foovalue")
903  ->EndObject()
904  ->EndObject()
905  ->EndObject()
906  ->EndObject();
907 
908  DoTest(out, AnyOut::descriptor());
909 }
910 
911 TEST_P(ProtostreamObjectSourceAnysTest, EmptyAnyOutputsEmptyObject) {
912  AnyOut out;
913  out.mutable_any();
914 
915  ow_.StartObject("")->StartObject("any")->EndObject()->EndObject();
916 
917  DoTest(out, AnyOut::descriptor());
918 }
919 
920 TEST_P(ProtostreamObjectSourceAnysTest, EmptyWithTypeAndNoValueOutputsType) {
921  AnyOut out;
922  out.mutable_any()->set_type_url("foo.googleapis.com/my.Type");
923 
924  ow_.StartObject("")
925  ->StartObject("any")
926  ->RenderString("@type", "foo.googleapis.com/my.Type")
927  ->EndObject()
928  ->EndObject();
929 
930  DoTest(out, AnyOut::descriptor());
931 }
932 
934  AnyOut out;
935  ::google::protobuf::Any* any = out.mutable_any();
936 
937  AnyM m;
938  m.set_foo("foovalue");
939  any->set_value(m.SerializeAsString());
940 
941  // We start the "AnyOut" part and then fail when we hit the Any object.
942  ow_.StartObject("");
943 
944  Status status = ExecuteTest(out, AnyOut::descriptor());
946 }
947 
948 TEST_P(ProtostreamObjectSourceAnysTest, UnknownTypeServiceError) {
949  AnyOut out;
950  ::google::protobuf::Any* any = out.mutable_any();
951  any->set_type_url("foo.googleapis.com/my.own.Type");
952 
953  AnyM m;
954  m.set_foo("foovalue");
955  any->set_value(m.SerializeAsString());
956 
957  // We start the "AnyOut" part and then fail when we hit the Any object.
958  ow_.StartObject("");
959 
960  Status status = ExecuteTest(out, AnyOut::descriptor());
962 }
963 
965  AnyOut out;
966  ::google::protobuf::Any* any = out.mutable_any();
967  any->set_type_url("type.googleapis.com/unknown.Type");
968 
969  AnyM m;
970  m.set_foo("foovalue");
971  any->set_value(m.SerializeAsString());
972 
973  // We start the "AnyOut" part and then fail when we hit the Any object.
974  ow_.StartObject("");
975 
976  Status status = ExecuteTest(out, AnyOut::descriptor());
978 }
979 
981  protected:
985  }
986 };
987 
988 INSTANTIATE_TEST_SUITE_P(DifferentTypeInfoSourceTest,
989  ProtostreamObjectSourceStructTest,
990  ::testing::Values(
992 
993 // Tests struct
994 //
995 // "object": {
996 // "k1": 123,
997 // "k2": true
998 // }
1000  StructType out;
1001  google::protobuf::Struct* s = out.mutable_object();
1002  s->mutable_fields()->operator[]("k1").set_number_value(123);
1003  s->mutable_fields()->operator[]("k2").set_bool_value(true);
1004 
1005  ow_.StartObject("")
1006  ->StartObject("object")
1007  ->RenderDouble("k1", 123)
1008  ->RenderBool("k2", true)
1009  ->EndObject()
1010  ->EndObject();
1011 
1013 }
1014 
1015 TEST_P(ProtostreamObjectSourceStructTest, MissingValueSkipsField) {
1016  StructType out;
1017  google::protobuf::Struct* s = out.mutable_object();
1018  s->mutable_fields()->operator[]("k1");
1019 
1020  ow_.StartObject("")->StartObject("object")->EndObject()->EndObject();
1021 
1023 }
1024 
1026  : public ProtostreamObjectSourceTest {
1027  protected:
1031  }
1032 };
1033 
1034 INSTANTIATE_TEST_SUITE_P(DifferentTypeInfoSourceTest,
1035  ProtostreamObjectSourceFieldMaskTest,
1036  ::testing::Values(
1038 
1040  FieldMaskTest out;
1041  out.set_id("1");
1042  out.mutable_single_mask()->add_paths("path1");
1043  out.mutable_single_mask()->add_paths("snake_case_path2");
1044  ::google::protobuf::FieldMask* mask = out.add_repeated_mask();
1045  mask->add_paths("path3");
1046  mask = out.add_repeated_mask();
1047  mask->add_paths("snake_case_path4");
1048  mask->add_paths("path5");
1049  NestedFieldMask* nested = out.add_nested_mask();
1050  nested->set_data("data");
1051  nested->mutable_single_mask()->add_paths("nested.path1");
1052  nested->mutable_single_mask()->add_paths("nested_field.snake_case_path2");
1053  mask = nested->add_repeated_mask();
1054  mask->add_paths("nested_field.path3");
1055  mask->add_paths("nested.snake_case_path4");
1056  mask = nested->add_repeated_mask();
1057  mask->add_paths("nested.path5");
1058  mask = nested->add_repeated_mask();
1059  mask->add_paths(
1060  "snake_case.map_field[\"map_key_should_be_ignored\"].nested_snake_case."
1061  "map_field[\"map_key_sho\\\"uld_be_ignored\"]");
1062 
1063  ow_.StartObject("")
1064  ->RenderString("id", "1")
1065  ->RenderString("singleMask", "path1,snakeCasePath2")
1066  ->StartList("repeatedMask")
1067  ->RenderString("", "path3")
1068  ->RenderString("", "snakeCasePath4,path5")
1069  ->EndList()
1070  ->StartList("nestedMask")
1071  ->StartObject("")
1072  ->RenderString("data", "data")
1073  ->RenderString("singleMask", "nested.path1,nestedField.snakeCasePath2")
1074  ->StartList("repeatedMask")
1075  ->RenderString("", "nestedField.path3,nested.snakeCasePath4")
1076  ->RenderString("", "nested.path5")
1077  ->RenderString("",
1078  "snakeCase.mapField[\"map_key_should_be_ignored\"]."
1079  "nestedSnakeCase.mapField[\"map_key_sho\\\"uld_be_"
1080  "ignored\"]")
1081  ->EndList()
1082  ->EndObject()
1083  ->EndList()
1084  ->EndObject();
1085 
1087 }
1088 
1090  : public ProtostreamObjectSourceTest {
1091  protected:
1094  }
1095 };
1096 
1097 INSTANTIATE_TEST_SUITE_P(DifferentTypeInfoSourceTest,
1098  ProtostreamObjectSourceTimestampTest,
1099  ::testing::Values(
1101 
1102 TEST_P(ProtostreamObjectSourceTimestampTest, InvalidTimestampBelowMinTest) {
1103  TimestampDuration out;
1104  google::protobuf::Timestamp* ts = out.mutable_ts();
1105  // Min allowed seconds - 1
1106  ts->set_seconds(kTimestampMinSeconds - 1);
1107  ow_.StartObject("");
1108 
1109  Status status = ExecuteTest(out, TimestampDuration::descriptor());
1111 }
1112 
1113 TEST_P(ProtostreamObjectSourceTimestampTest, InvalidTimestampAboveMaxTest) {
1114  TimestampDuration out;
1115  google::protobuf::Timestamp* ts = out.mutable_ts();
1116  // Max allowed seconds + 1
1117  ts->set_seconds(kTimestampMaxSeconds + 1);
1118  ow_.StartObject("");
1119 
1120  Status status = ExecuteTest(out, TimestampDuration::descriptor());
1122 }
1123 
1124 TEST_P(ProtostreamObjectSourceTimestampTest, InvalidDurationBelowMinTest) {
1125  TimestampDuration out;
1126  google::protobuf::Duration* dur = out.mutable_dur();
1127  // Min allowed seconds - 1
1128  dur->set_seconds(kDurationMinSeconds - 1);
1129  ow_.StartObject("");
1130 
1131  Status status = ExecuteTest(out, TimestampDuration::descriptor());
1133 }
1134 
1135 TEST_P(ProtostreamObjectSourceTimestampTest, InvalidDurationAboveMaxTest) {
1136  TimestampDuration out;
1137  google::protobuf::Duration* dur = out.mutable_dur();
1138  // Min allowed seconds + 1
1139  dur->set_seconds(kDurationMaxSeconds + 1);
1140  ow_.StartObject("");
1141 
1142  Status status = ExecuteTest(out, TimestampDuration::descriptor());
1144 }
1145 
1146 TEST_P(ProtostreamObjectSourceTimestampTest, TimestampDurationDefaultValue) {
1147  TimestampDuration out;
1148  out.mutable_ts()->set_seconds(0);
1149  out.mutable_dur()->set_seconds(0);
1150 
1151  ow_.StartObject("")
1152  ->RenderString("ts", "1970-01-01T00:00:00Z")
1153  ->RenderString("dur", "0s")
1154  ->EndObject();
1155 
1157 }
1158 
1159 
1160 } // namespace converter
1161 } // namespace util
1162 } // namespace protobuf
1163 } // namespace google
DoTest
void DoTest(const ConformanceRequest &request, ConformanceResponse *response)
Definition: conformance_cpp.cc:125
google::protobuf::value
const Descriptor::ReservedRange value
Definition: src/google/protobuf/descriptor.h:1954
google::protobuf::util::converter::ObjectWriter::StartList
virtual ObjectWriter * StartList(StringPiece name)=0
google::protobuf::util::converter::ProtostreamObjectSourceTest::ExecuteTest
Status ExecuteTest(const Message &msg, const Descriptor *descriptor)
Definition: protostream_objectsource_test.cc:112
google::protobuf::util::Status::code
error::Code code() const
Definition: status.h:93
google::protobuf::util::converter::testing::TypeInfoTestHelper::ResetTypeInfo
void ResetTypeInfo(const std::vector< const Descriptor * > &descriptors)
Definition: type_info_test_helper.cc:54
google::protobuf::util::converter::ProtostreamObjectSourceTest::helper_
testing::TypeInfoTestHelper helper_
Definition: protostream_objectsource_test.cc:282
google::protobuf::StrCat
string StrCat(const AlphaNum &a, const AlphaNum &b)
Definition: strutil.cc:1480
google::protobuf::util::converter::ProtostreamObjectSourceTest::DoTest
void DoTest(const Message &msg, const Descriptor *descriptor)
Definition: protostream_objectsource_test.cc:107
Duration::set_seconds
void set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value)
Definition: duration.pb.h:247
gtest.h
FieldMask::add_paths
std::string * add_paths()
Definition: field_mask.pb.h:277
google::protobuf::util::converter::ProtostreamObjectSourceTest
Definition: protostream_objectsource_test.cc:90
google::protobuf::util::converter::ObjectWriter::RenderUint64
virtual ObjectWriter * RenderUint64(StringPiece name, uint64 value)=0
s
XmlRpcServer s
GetTypeUrl
static string GetTypeUrl(const Descriptor *message)
Definition: conformance_cpp.cc:91
google::protobuf::util::converter::ProtostreamObjectSourceTest::PrepareRepeatedPrimitive
Primitive PrepareRepeatedPrimitive()
Definition: protostream_objectsource_test.cc:192
EXPECT_EQ
#define EXPECT_EQ(val1, val2)
Definition: glog/src/googletest.h:155
label
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:4316
google::protobuf::util::converter::testing::TypeInfoTestHelper
Definition: type_info_test_helper.h:59
google::protobuf::util::converter::ProtostreamObjectSourceTest::PreparePackedPrimitive
PackedPrimitive PreparePackedPrimitive()
Definition: protostream_objectsource_test.cc:231
google::protobuf::util::converter::kTimestampMaxSeconds
const int64 kTimestampMaxSeconds
Definition: constants.h:56
google::protobuf::util::converter::ProtostreamObjectSourceTest::render_unknown_enum_values_
bool render_unknown_enum_values_
Definition: protostream_objectsource_test.cc:290
string
GLsizei const GLchar *const * string
Definition: glcorearb.h:3083
type_info_test_helper.h
FieldMask
struct FieldMask FieldMask
Definition: php/ext/google/protobuf/protobuf.h:640
google::protobuf::util::converter::ExpectingObjectWriter
Definition: expecting_objectwriter.h:91
descriptor
Descriptor * descriptor
Definition: php/ext/google/protobuf/protobuf.h:936
google::protobuf::util::converter::ProtostreamObjectSourceAnysTest
Definition: protostream_objectsource_test.cc:743
google::protobuf::util::converter::kTypeServiceBaseUrl
const char kTypeServiceBaseUrl[]
Definition: constants.h:43
google::protobuf::util::converter::kDurationMaxSeconds
const int64 kDurationMaxSeconds
Definition: constants.h:62
google::protobuf::util::converter::TEST_P
TEST_P(ProtostreamObjectSourceTest, EmptyMessage)
Definition: protostream_objectsource_test.cc:298
google::protobuf::util::converter::testing::USE_TYPE_RESOLVER
@ USE_TYPE_RESOLVER
Definition: type_info_test_helper.h:52
any.pb.h
Descriptor
Definition: ruby/ext/google/protobuf_c/protobuf.h:113
google::protobuf::util::converter::kDurationMinSeconds
const int64 kDurationMinSeconds
Definition: constants.h:59
testing::TestWithParam
Definition: gtest.h:1910
protostream_objectsource.h
expecting_objectwriter.h
google::protobuf::util::converter::ObjectWriter::RenderDouble
virtual ObjectWriter * RenderDouble(StringPiece name, double value)=0
testing::NiceMock
Definition: gmock-nice-strict.h:72
google::protobuf::util::converter::ObjectWriter::RenderBool
virtual ObjectWriter * RenderBool(StringPiece name, bool value)=0
google::protobuf::util::converter::ObjectWriter::RenderInt32
virtual ObjectWriter * RenderInt32(StringPiece name, int32 value)=0
google::protobuf::util::converter::ProtostreamObjectSourceTest::AddTrailingZeros
void AddTrailingZeros()
Definition: protostream_objectsource_test.cc:276
google::protobuf::util::converter::ProtostreamObjectSourceStructTest
Definition: protostream_objectsource_test.cc:980
strutil.h
mask
GLint GLuint mask
Definition: glcorearb.h:2789
coded_stream.h
google::protobuf::util::converter::ProtostreamObjectSourceTimestampTest
Definition: protostream_objectsource_test.cc:1089
Any::set_type_url
void set_type_url(const std::string &value)
Definition: any.pb.h:253
google::protobuf::util::converter::ProtostreamObjectSourceTest::PrepareExpectingObjectWriterForRepeatedPrimitive
void PrepareExpectingObjectWriterForRepeatedPrimitive()
Definition: protostream_objectsource_test.cc:129
gmock_output_test._
_
Definition: gmock_output_test.py:173
google::protobuf::util::converter::ProtostreamObjectSourceTest::ow_
ExpectingObjectWriter ow_
Definition: protostream_objectsource_test.cc:285
google::protobuf::util::converter::ObjectWriter::EndList
virtual ObjectWriter * EndList()=0
google::protobuf::io::ArrayInputStream
Definition: zero_copy_stream_impl_lite.h:65
google::protobuf::uint64
uint64_t uint64
Definition: protobuf/src/google/protobuf/stubs/port.h:156
google::protobuf::util::converter::ProtostreamObjectSourceFieldMaskTest
Definition: protostream_objectsource_test.cc:1025
casts.h
google::protobuf::util::error::INVALID_ARGUMENT
@ INVALID_ARGUMENT
Definition: status.h:50
google::protobuf::util::converter::ProtostreamObjectSourceTest::use_ints_for_enums_
bool use_ints_for_enums_
Definition: protostream_objectsource_test.cc:287
google::protobuf::MessageLite::SerializePartialToOstream
bool SerializePartialToOstream(std::ostream *output) const
Definition: message_lite.cc:437
aditof::Status
Status
Status of any operation that the TOF sdk performs.
Definition: status_definitions.h:48
LL
#define LL(x)
google::protobuf::util::error::INTERNAL
@ INTERNAL
Definition: status.h:61
i
int i
Definition: gmock-matchers_test.cc:764
google::protobuf::util::converter::ProtostreamObjectSourceTest::ProtostreamObjectSourceTest
ProtostreamObjectSourceTest()
Definition: protostream_objectsource_test.cc:93
google::protobuf::util::converter::ProtostreamObjectSourceTimestampTest::ProtostreamObjectSourceTimestampTest
ProtostreamObjectSourceTimestampTest()
Definition: protostream_objectsource_test.cc:1092
google::protobuf::util::converter::ProtostreamObjectSourceTest::mock_
::testing::NiceMock< MockObjectWriter > mock_
Definition: protostream_objectsource_test.cc:284
google::protobuf::util::converter::ExpectingObjectWriter::StartObject
virtual ObjectWriter * StartObject(StringPiece name)
Definition: expecting_objectwriter.h:95
google::protobuf::util::converter::INSTANTIATE_TEST_SUITE_P
INSTANTIATE_TEST_SUITE_P(DifferentTypeInfoSourceTest, ProtostreamObjectSourceTest, ::testing::Values(testing::USE_TYPE_RESOLVER))
zero_copy_stream_impl_lite.h
Any
struct Any Any
Definition: php/ext/google/protobuf/protobuf.h:624
google::protobuf::util::converter::ProtostreamObjectSourceTest::use_preserve_proto_field_names_
bool use_preserve_proto_field_names_
Definition: protostream_objectsource_test.cc:288
google::protobuf::util::converter::ProtostreamObjectSourceTest::UseIntsForEnums
void UseIntsForEnums()
Definition: protostream_objectsource_test.cc:272
google::protobuf::util::converter::ProtostreamObjectSourceTest::~ProtostreamObjectSourceTest
virtual ~ProtostreamObjectSourceTest()
Definition: protostream_objectsource_test.cc:105
google::protobuf::Message
Definition: src/google/protobuf/message.h:205
Duration
struct Duration Duration
Definition: php/ext/google/protobuf/protobuf.h:631
google::protobuf::util::converter::ProtostreamObjectSourceStructTest::ProtostreamObjectSourceStructTest
ProtostreamObjectSourceStructTest()
Definition: protostream_objectsource_test.cc:982
google::protobuf::util::converter::ProtostreamObjectSourceTest::UseLowerCamelForEnums
void UseLowerCamelForEnums()
Definition: protostream_objectsource_test.cc:270
constants.h
google::protobuf::util::converter::ProtostreamObjectSourceTest::add_trailing_zeros_
bool add_trailing_zeros_
Definition: protostream_objectsource_test.cc:289
google::protobuf::io::CodedInputStream
Definition: coded_stream.h:173
google::protobuf::util::converter::kTimestampMinSeconds
const int64 kTimestampMinSeconds
Definition: constants.h:53
m
const upb_json_parsermethod * m
Definition: ruby/ext/google/protobuf_c/upb.h:10501
google::protobuf::util::converter::ProtostreamObjectSourceTest::SetRenderUnknownEnumValues
void SetRenderUnknownEnumValues(bool value)
Definition: protostream_objectsource_test.cc:278
testing::WithParamInterface< testing::TypeInfoSource >::GetParam
static const ParamType & GetParam()
Definition: gtest.h:1882
EXPECT_CALL
#define EXPECT_CALL(obj, call)
google::protobuf::Descriptor
Definition: src/google/protobuf/descriptor.h:231
descriptor.h
google::protobuf::util::Status
Definition: status.h:67
Any::PackFrom
void PackFrom(const ::PROTOBUF_NAMESPACE_ID::Message &message)
Definition: any.pb.cc:89
Struct
struct Struct Struct
Definition: php/ext/google/protobuf/protobuf.h:661
google::protobuf::util::converter::ObjectWriter::RenderUint32
virtual ObjectWriter * RenderUint32(StringPiece name, uint32 value)=0
true
#define true
Definition: cJSON.c:65
next
static size_t next(const upb_table *t, size_t i)
Definition: php/ext/google/protobuf/upb.c:4889
f
GLfloat f
Definition: glcorearb.h:3964
value
GLsizei const GLfloat * value
Definition: glcorearb.h:3093
google::protobuf::util::converter::ProtostreamObjectSourceAnysTest::ProtostreamObjectSourceAnysTest
ProtostreamObjectSourceAnysTest()
Definition: protostream_objectsource_test.cc:745
google::protobuf::util::converter::ProtostreamObjectSourceMapsTest
Definition: protostream_objectsource_test.cc:602
google::protobuf::util::converter::ProtostreamObjectSourceMapsTest::ProtostreamObjectSourceMapsTest
ProtostreamObjectSourceMapsTest()
Definition: protostream_objectsource_test.cc:604
false
#define false
Definition: cJSON.c:70
testing::Values
internal::ValueArray< T... > Values(T... v)
Definition: gtest-param-test.h:340
google::protobuf::Timestamp
google
Definition: data_proto2_to_proto3_util.h:11
message
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: glcorearb.h:2695
google::protobuf::util::converter::ProtostreamObjectSourceFieldMaskTest::ProtostreamObjectSourceFieldMaskTest
ProtostreamObjectSourceFieldMaskTest()
Definition: protostream_objectsource_test.cc:1028
google::protobuf::util::converter::testing::TypeInfoTestHelper::NewProtoSource
ProtoStreamObjectSource * NewProtoSource(io::CodedInputStream *coded_input, const std::string &type_url)
Definition: type_info_test_helper.cc:88
google::protobuf::util::converter::ObjectWriter::RenderFloat
virtual ObjectWriter * RenderFloat(StringPiece name, float value)=0
google::protobuf::util::converter::ObjectWriter::EndObject
virtual ObjectWriter * EndObject()=0
google::protobuf::util::converter::ObjectWriter::RenderInt64
virtual ObjectWriter * RenderInt64(StringPiece name, int64 value)=0
google::protobuf::util::converter::ProtostreamObjectSourceTest::UsePreserveProtoFieldNames
void UsePreserveProtoFieldNames()
Definition: protostream_objectsource_test.cc:274
google::protobuf::util::converter::ProtostreamObjectSourceTest::use_lower_camel_for_enums_
bool use_lower_camel_for_enums_
Definition: protostream_objectsource_test.cc:286


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:58