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

Side by Side Diff: third_party/protobuf/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_custom_options.proto

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Make chrome settings proto generated file a component Created 4 years 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
OLDNEW
1 // Protocol Buffers - Google's data interchange format 1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved. 2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/ 3 // http://code.google.com/p/protobuf/
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are 6 // modification, are permitted provided that the following conditions are
7 // met: 7 // met:
8 // 8 //
9 // * Redistributions of source code must retain the above copyright 9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer. 10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above 11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer 12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the 13 // in the documentation and/or other materials provided with the
(...skipping 11 matching lines...) Expand all
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 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. 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 30
31 // Author: benjy@google.com (Benjy Weinberger) 31 // Author: benjy@google.com (Benjy Weinberger)
32 // Based on original Protocol Buffers design by 32 // Based on original Protocol Buffers design by
33 // Sanjay Ghemawat, Jeff Dean, and others. 33 // Sanjay Ghemawat, Jeff Dean, and others.
34 // 34 //
35 // A proto file used to test the "custom options" feature of google.protobuf. 35 // A proto file used to test the "custom options" feature of proto2.
36 36
37 syntax = "proto2";
38 37
39 // Some generic_services option(s) added automatically. 38 // Some generic_services option(s) added automatically.
40 // See: http://go/proto2-generic-services-default 39 // See: http://go/proto2-generic-services-default
41 option cc_generic_services = true; // auto-added 40 option cc_generic_services = true; // auto-added
42 option java_generic_services = true; // auto-added 41 option java_generic_services = true; // auto-added
43 option py_generic_services = true; 42 option py_generic_services = true;
44 43
45 // A custom file option (defined below). 44 // A custom file option (defined below).
46 option (file_opt1) = 9876543210; 45 option (file_opt1) = 9876543210;
47 46
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 option (double_opt) = -154; 211 option (double_opt) = -154;
213 } 212 }
214 213
215 // Options of complex message types, themselves combined and extended in 214 // Options of complex message types, themselves combined and extended in
216 // various ways. 215 // various ways.
217 216
218 message ComplexOptionType1 { 217 message ComplexOptionType1 {
219 optional int32 foo = 1; 218 optional int32 foo = 1;
220 optional int32 foo2 = 2; 219 optional int32 foo2 = 2;
221 optional int32 foo3 = 3; 220 optional int32 foo3 = 3;
222 repeated int32 foo4 = 4;
223 221
224 extensions 100 to max; 222 extensions 100 to max;
225 } 223 }
226 224
227 message ComplexOptionType2 { 225 message ComplexOptionType2 {
228 optional ComplexOptionType1 bar = 1; 226 optional ComplexOptionType1 bar = 1;
229 optional int32 baz = 2; 227 optional int32 baz = 2;
230 228
231 message ComplexOptionType4 { 229 message ComplexOptionType4 {
232 optional int32 waldo = 1; 230 optional int32 waldo = 1;
233 231
234 extend google.protobuf.MessageOptions { 232 extend google.protobuf.MessageOptions {
235 optional ComplexOptionType4 complex_opt4 = 7633546; 233 optional ComplexOptionType4 complex_opt4 = 7633546;
236 } 234 }
237 } 235 }
238 236
239 optional ComplexOptionType4 fred = 3; 237 optional ComplexOptionType4 fred = 3;
240 repeated ComplexOptionType4 barney = 4;
241 238
242 extensions 100 to max; 239 extensions 100 to max;
243 } 240 }
244 241
245 message ComplexOptionType3 { 242 message ComplexOptionType3 {
246 optional int32 qux = 1; 243 optional int32 qux = 1;
247 244
248 optional group ComplexOptionType5 = 2 { 245 optional group ComplexOptionType5 = 2 {
249 optional int32 plugh = 3; 246 optional int32 plugh = 3;
250 } 247 }
(...skipping 16 matching lines...) Expand all
267 optional group ComplexOpt6 = 7595468 { 264 optional group ComplexOpt6 = 7595468 {
268 optional int32 xyzzy = 7593951; 265 optional int32 xyzzy = 7593951;
269 } 266 }
270 } 267 }
271 268
272 // Note that we try various different ways of naming the same extension. 269 // Note that we try various different ways of naming the same extension.
273 message VariousComplexOptions { 270 message VariousComplexOptions {
274 option (.protobuf_unittest.complex_opt1).foo = 42; 271 option (.protobuf_unittest.complex_opt1).foo = 42;
275 option (protobuf_unittest.complex_opt1).(.protobuf_unittest.quux) = 324; 272 option (protobuf_unittest.complex_opt1).(.protobuf_unittest.quux) = 324;
276 option (.protobuf_unittest.complex_opt1).(protobuf_unittest.corge).qux = 876; 273 option (.protobuf_unittest.complex_opt1).(protobuf_unittest.corge).qux = 876;
277 option (protobuf_unittest.complex_opt1).foo4 = 99;
278 option (protobuf_unittest.complex_opt1).foo4 = 88;
279 option (complex_opt2).baz = 987; 274 option (complex_opt2).baz = 987;
280 option (complex_opt2).(grault) = 654; 275 option (complex_opt2).(grault) = 654;
281 option (complex_opt2).bar.foo = 743; 276 option (complex_opt2).bar.foo = 743;
282 option (complex_opt2).bar.(quux) = 1999; 277 option (complex_opt2).bar.(quux) = 1999;
283 option (complex_opt2).bar.(protobuf_unittest.corge).qux = 2008; 278 option (complex_opt2).bar.(protobuf_unittest.corge).qux = 2008;
284 option (complex_opt2).(garply).foo = 741; 279 option (complex_opt2).(garply).foo = 741;
285 option (complex_opt2).(garply).(.protobuf_unittest.quux) = 1998; 280 option (complex_opt2).(garply).(.protobuf_unittest.quux) = 1998;
286 option (complex_opt2).(protobuf_unittest.garply).(corge).qux = 2121; 281 option (complex_opt2).(protobuf_unittest.garply).(corge).qux = 2121;
287 option (ComplexOptionType2.ComplexOptionType4.complex_opt4).waldo = 1971; 282 option (ComplexOptionType2.ComplexOptionType4.complex_opt4).waldo = 1971;
288 option (complex_opt2).fred.waldo = 321; 283 option (complex_opt2).fred.waldo = 321;
289 option (complex_opt2).barney = { waldo: 101 };
290 option (complex_opt2).barney = { waldo: 212 };
291 option (protobuf_unittest.complex_opt3).qux = 9; 284 option (protobuf_unittest.complex_opt3).qux = 9;
292 option (complex_opt3).complexoptiontype5.plugh = 22; 285 option (complex_opt3).complexoptiontype5.plugh = 22;
293 option (complexopt6).xyzzy = 24; 286 option (complexopt6).xyzzy = 24;
294 } 287 }
295 288
296 // ------------------------------------------------------ 289 // ------------------------------------------------------
297 // Definitions for testing aggregate option parsing. 290 // Definitions for testing aggregate option parsing.
298 // See descriptor_unittest.cc. 291 // See descriptor_unittest.cc.
299 292
300 message AggregateMessageSet { 293 message AggregateMessageSet {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 optional int32 nested_field = 1 [(field_opt1) = 1002]; 378 optional int32 nested_field = 1 [(field_opt1) = 1002];
386 } 379 }
387 enum NestedEnum { 380 enum NestedEnum {
388 option (enum_opt1) = 1003; 381 option (enum_opt1) = 1003;
389 NESTED_ENUM_VALUE = 1 [(enum_value_opt1) = 1004]; 382 NESTED_ENUM_VALUE = 1 [(enum_value_opt1) = 1004];
390 } 383 }
391 extend google.protobuf.FileOptions { 384 extend google.protobuf.FileOptions {
392 optional int32 nested_extension = 7912573 [(field_opt2) = 1005]; 385 optional int32 nested_extension = 7912573 [(field_opt2) = 1005];
393 } 386 }
394 } 387 }
395
396 // Custom message option that has a required enum field.
397 // WARNING: this is strongly discouraged!
398 message OldOptionType {
399 enum TestEnum {
400 OLD_VALUE = 0;
401 }
402 required TestEnum value = 1;
403 }
404
405 // Updated version of the custom option above.
406 message NewOptionType {
407 enum TestEnum {
408 OLD_VALUE = 0;
409 NEW_VALUE = 1;
410 }
411 required TestEnum value = 1;
412 }
413
414 extend google.protobuf.MessageOptions {
415 optional OldOptionType required_enum_opt = 106161807;
416 }
417
418 // Test message using the "required_enum_opt" option defined above.
419 message TestMessageWithRequiredEnumOption {
420 option (required_enum_opt) = { value: OLD_VALUE };
421 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698