Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / mojo / public / interfaces / bindings / tests / sample_service.mojom
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
3 // found in the LICENSE file.
4
5 import "sample_import.mojom"
6 import "sample_import2.mojom"
7
8 [JavaPackage="org.chromium.mojo.bindings.test"]
9 module sample {
10
11 struct Bar {
12   enum Type {
13     TYPE_VERTICAL = 1 << 0,
14     TYPE_HORIZONTAL = (1 << 1) + 0,
15     TYPE_BOTH = TYPE_VERTICAL | TYPE_HORIZONTAL,
16     TYPE_INVALID
17   };
18   uint8 alpha = (0x100 - 1) @0;
19   uint8 beta @1;
20   uint8 gamma @2;
21   Type type = sample.Bar.TYPE_VERTICAL @3;
22 };
23
24 [RequiredFields=7]
25 struct Foo {
26   string name = "Fooby" @8;
27   int32 x @0;
28   int32 y @1;
29   bool a = true @2;
30   bool b @3;
31   bool c @4;
32   Bar bar @5;
33   Bar[] extra_bars @7;
34   uint8[] data = [1,2,3] @6;
35   handle<message_pipe> source @9;
36   handle<data_pipe_consumer>[] input_streams @10;
37   handle<data_pipe_producer>[] output_streams @11;
38   bool[][] array_of_array_of_bools @12;
39 };
40
41 struct DefaultsTestInner {
42   int32 age @2;
43   string[] names = ["Jim"] @1;
44   int32 height = 6*12 @3;
45 };
46
47 struct DefaultsTest {
48   sample.DefaultsTestInner[] people = [{32, ["Bob", "Bobby"]}] @1;
49   uint8[] data = [1, 2, 3] @2;
50   imported.Point point = {7, 15} @3;
51   int32[] shape_masks = [1 << imported.SHAPE_RECTANGLE] @4;
52   imported.Thing thing = {imported.SHAPE_CIRCLE, imported.COLOR_BLACK};
53   Bar.Type bar_type = Bar.TYPE_BOTH;
54 };
55
56 [Client=ServiceClient]
57 interface Service {
58   enum BazOptions {
59     BAZ_REGULAR = 0,
60     BAZ_EXTRA
61   };
62   Frobinate@0(Foo foo @0, BazOptions baz @1, Port port @2);
63 };
64
65 interface ServiceClient {
66   DidFrobinate@0(int32 result @0);
67 };
68
69 // This interface is referenced above where it is defined. It also refers to
70 // itself from a method.
71 interface Port {
72   PostMessage@0(string message_text @0, Port port@1);
73 };
74
75 }