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

Side by Side Diff: mojo/public/interfaces/bindings/tests/test_structs.mojom

Issue 605443002: The default value for NullableString should be null (was "") (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added missing types, renamed test functions and struct types Created 6 years, 3 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 | « no previous file | mojo/public/js/bindings/codec_unittests.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 import "mojo/public/interfaces/bindings/tests/rect.mojom" 5 import "mojo/public/interfaces/bindings/tests/rect.mojom"
6 6
7 [JavaPackage="org.chromium.mojo.bindings.test.mojom.test_structs"] 7 [JavaPackage="org.chromium.mojo.bindings.test.mojom.test_structs"]
8 module mojo.test { 8 module mojo.test {
9 9
10 struct NamedRegion { 10 struct NamedRegion {
11 string? name; 11 string? name;
12 Rect[]? rects; 12 Rect[]? rects;
13 }; 13 };
14 14
15 struct RectPair { 15 struct RectPair {
16 Rect? first; 16 Rect? first;
17 Rect? second; 17 Rect? second;
18 }; 18 };
19 19
20 struct EmptyStruct { 20 struct EmptyStruct {
21 }; 21 };
22 22
23 // Used to verify that struct fields which don't specify a deafult are
24 // initialized to: false for bool, 0 for numbers, and null for strings,
25 // handles, and structs. The "?" nullable suffix shouldn't have any
26 // impact on initial field values.
27
28 struct NoDefaultFieldValues {
29 bool f0;
30 int8 f1;
31 uint8 f2;
32 int16 f3;
33 uint16 f4;
34 int32 f5;
35 uint32 f6;
36 int64 f7;
37 uint64 f8;
38 float f9;
39 double f10;
40 string f11;
41 string? f12;
42 handle<message_pipe> f13;
43 handle<data_pipe_consumer> f14;
44 handle<data_pipe_producer> f15;
45 handle<message_pipe>? f16;
46 handle<data_pipe_consumer>? f17;
47 handle<data_pipe_producer>? f18;
48 handle f19;
49 handle? f20;
50 handle<shared_buffer> f21;
51 handle<shared_buffer>? f22;
52 string[] f23;
53 string?[] f24;
54 string[]? f25;
55 string?[]? f26;
56 EmptyStruct f27;
57 EmptyStruct? f28;
58 };
59
60 // Used to verify that struct fields with an explicit default value
61 // are initialized correctly. The "?" nullable suffix shouldn't have any
62 // impact on initial field values.
63
64 struct DefaultFieldValues {
65 const string kFoo = "foo";
66 bool f0 = true;
67 int8 f1 = 100;
68 uint8 f2 = 100;
69 int16 f3 = 100;
70 uint16 f4 = 100;
71 int32 f5 = 100;
72 uint32 f6 = 100;
73 int64 f7 = 100;
74 uint64 f8 = 100;
75 float f9 = 100;
76 float f10 = 100.0;
77 double f11 = 100;
78 double f12 = 100.0;
79 string f13 = kFoo;
80 string? f14 = kFoo;
81 Rect f15 = default;
82 Rect? f16 = default;
83 };
84
23 } 85 }
OLDNEW
« no previous file with comments | « no previous file | mojo/public/js/bindings/codec_unittests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698