diff options
author | hansmuller <hansmuller@chromium.org> | 2014-09-24 18:34:59 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-25 01:35:15 +0000 |
commit | ae685fa448164fef86b0b97f519ac2f81cc8b310 (patch) | |
tree | 1e19a92f4a313e56fc5f3c356662ff1003a1c647 /mojo/public/interfaces | |
parent | 068213a3593dd3db30428e89d6948275791ceaa1 (diff) | |
download | chromium_src-ae685fa448164fef86b0b97f519ac2f81cc8b310.zip chromium_src-ae685fa448164fef86b0b97f519ac2f81cc8b310.tar.gz chromium_src-ae685fa448164fef86b0b97f519ac2f81cc8b310.tar.bz2 |
The default value for NullableString should be null (was ""). Mojo struct fields whose type is string? should be initialized to null, not "".
BUG=417039
Review URL: https://codereview.chromium.org/605443002
Cr-Commit-Position: refs/heads/master@{#296612}
Diffstat (limited to 'mojo/public/interfaces')
-rw-r--r-- | mojo/public/interfaces/bindings/tests/test_structs.mojom | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/mojo/public/interfaces/bindings/tests/test_structs.mojom b/mojo/public/interfaces/bindings/tests/test_structs.mojom index 66cd2e9..290f33f 100644 --- a/mojo/public/interfaces/bindings/tests/test_structs.mojom +++ b/mojo/public/interfaces/bindings/tests/test_structs.mojom @@ -20,4 +20,66 @@ struct RectPair { struct EmptyStruct { }; +// Used to verify that struct fields which don't specify a deafult are +// initialized to: false for bool, 0 for numbers, and null for strings, +// handles, and structs. The "?" nullable suffix shouldn't have any +// impact on initial field values. + +struct NoDefaultFieldValues { + bool f0; + int8 f1; + uint8 f2; + int16 f3; + uint16 f4; + int32 f5; + uint32 f6; + int64 f7; + uint64 f8; + float f9; + double f10; + string f11; + string? f12; + handle<message_pipe> f13; + handle<data_pipe_consumer> f14; + handle<data_pipe_producer> f15; + handle<message_pipe>? f16; + handle<data_pipe_consumer>? f17; + handle<data_pipe_producer>? f18; + handle f19; + handle? f20; + handle<shared_buffer> f21; + handle<shared_buffer>? f22; + string[] f23; + string?[] f24; + string[]? f25; + string?[]? f26; + EmptyStruct f27; + EmptyStruct? f28; +}; + +// Used to verify that struct fields with an explicit default value +// are initialized correctly. The "?" nullable suffix shouldn't have any +// impact on initial field values. + +struct DefaultFieldValues { + const string kFoo = "foo"; + bool f0 = true; + int8 f1 = 100; + uint8 f2 = 100; + int16 f3 = 100; + uint16 f4 = 100; + int32 f5 = 100; + uint32 f6 = 100; + int64 f7 = 100; + uint64 f8 = 100; + float f9 = 100; + float f10 = 100.0; + double f11 = 100; + double f12 = 100.0; + string f13 = kFoo; + string? f14 = kFoo; + Rect f15 = default; + Rect? f16 = default; +}; + } |