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