// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import "sample_import.mojom" import "sample_import2.mojom" [JavaPackage="org.chromium.mojo.bindings.test.sample"] module sample { const uint8 kThree = 3; struct Bar { enum Type { TYPE_VERTICAL = 1 << 0, TYPE_HORIZONTAL = (1 << 1) + 0, TYPE_BOTH = TYPE_VERTICAL | TYPE_HORIZONTAL, TYPE_INVALID }; uint8 alpha@0 = (0x100 - 1); uint8 beta@1; uint8 gamma@2; Type type@3 = sample.Bar.TYPE_VERTICAL; }; [RequiredFields=7] struct Foo { const string kFooby = "Fooby"; string name@8 = kFooby; int32 x@0; int32 y@1; bool a@2 = true; bool b@3; bool c@4; Bar bar@5; Bar[] extra_bars@7; uint8[] data@6; handle source@9; handle[] input_streams@10; handle[] output_streams@11; bool[][] array_of_array_of_bools@12; string[][][] multi_array_of_strings@13; }; struct DefaultsTestInner { int32 x@0 = 123; }; struct DefaultsTest { int8 a0@0 = -12; uint8 a1@1 = 12; int16 a2@2 = 1234; uint16 a3@3 = 34567; int32 a4@4 = 123456; // TODO(vtl): crbug.com/375522 uint32 a5@5 /* = 3456789012 */; // TODO(vtl): crbug.com/375522 int64 a6@6 = 111111111111; uint64 a7@7 /* = 9999999999999999999 */; int32 a8@8 = 0x12345; int32 a9@9 = -0x12345; int32 a10@10 = +1234; bool a11@11 = true; bool a12@12 = false; float a13@13 = 123.25; double a14@14 = 1234567890.123; double a15@15 = 1E10; double a16@16 = -1.2E+20; double a17@17 = +1.23E-20; // TODO(vtl): Add tests for default vs null when those are implemented (for // structs, arrays, and strings). sample.DefaultsTestInner a18@18; uint8[] a19@19; string a20@20; }; struct StructWithHoleV1 { int32 v1 = 1; int64 v2 = 2; }; struct StructWithHoleV2 { int32 v1 = 1; int64 v2 = 2; int32 v3 = 3; }; [Client=ServiceClient] interface Service { enum BazOptions { BAZ_REGULAR = 0, BAZ_EXTRA }; const uint8 kFavoriteBaz = 1; Frobinate@0(Foo foo@0, BazOptions baz@1, Port port@2); }; interface ServiceClient { DidFrobinate@0(int32 result@0); }; // This interface is referenced above where it is defined. It also refers to // itself from a method. interface Port { PostMessage@0(string message_text@0, Port port@1); }; }