Home | History | Annotate | Download | only in tests
      1 // Copyright 2014 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 
      6 [JavaPackage="org.chromium.mojo.bindings.test.mojom.mojo"]
      7 module mojo.test;
      8 
      9 struct StructA {
     10   uint64 i;
     11 };
     12 
     13 struct StructB {
     14   StructA struct_a;
     15 };
     16 
     17 struct StructC {
     18   array<uint8> data;
     19 };
     20 
     21 struct StructD {
     22   array<handle<message_pipe>> message_pipes;
     23 };
     24 
     25 struct StructE {
     26   StructD struct_d;
     27   handle<data_pipe_consumer> data_pipe_consumer;
     28 };
     29 
     30 struct StructF {
     31   array<uint8, 3> fixed_size_array;
     32 };
     33 
     34 struct StructG {
     35   int32 i;
     36   [MinVersion=1]
     37   StructA? struct_a;
     38   [MinVersion=3]
     39   string? str;
     40   [MinVersion=3]
     41   bool b;
     42 };
     43 
     44 interface InterfaceA {
     45 };
     46 
     47 enum EnumA {
     48   ENUM_A_0,
     49   ENUM_A_1
     50 };
     51 
     52 [Extensible]
     53 enum EnumB {
     54   ENUM_B_0,
     55   ENUM_B_1,
     56   ENUM_B_2
     57 };
     58 
     59 // This interface is used for testing bounds-checking in the mojom
     60 // binding code. If you add a method please update the files
     61 // ./data/validation/boundscheck_*. If you add a response please update
     62 // ./data/validation/resp_boundscheck_*.
     63 interface BoundsCheckTestInterface {
     64   Method0(uint8 param0) => (uint8 param0);
     65   Method1(uint8 param0);
     66 };
     67 
     68 interface ConformanceTestInterface {
     69   Method0(float param0);
     70   Method1(StructA param0);
     71   Method2(StructB param0, StructA param1);
     72   Method3(array<bool> param0);
     73   Method4(StructC param0, array<uint8> param1);
     74   Method5(StructE param0, handle<data_pipe_producer> param1);
     75   Method6(array<array<uint8>> param0);
     76   Method7(StructF param0, array<array<uint8, 3>?, 2> param1);
     77   Method8(array<array<string>?> param0);
     78   Method9(array<array<handle?>>? param0);
     79   Method10(map<string, uint8> param0);
     80   Method11(StructG param0);
     81   Method12(float param0) => (float param0);
     82   Method13(InterfaceA? param0, uint32 param1, InterfaceA? param2);
     83   Method14(EnumA param0, EnumB param1);
     84   Method15(array<EnumA>? param0, array<EnumB>? param1);
     85   Method16(map<EnumA, EnumA>? param0);
     86   Method17(array<InterfaceA> param0);
     87 };
     88 
     89 struct BasicStruct {
     90   int32 a;
     91 };
     92 
     93 interface IntegrationTestInterface {
     94   Method0(BasicStruct param0) => (array<uint8> param0);
     95 };
     96 
     97 // An enum generates a enum-value validation function, so we want to test it.
     98 // E.g., valid enum values for this enum should be:  -3, 0, 1, 10
     99 enum BasicEnum {
    100   A,
    101   B,
    102   C = A,
    103   D = -3,
    104   E = 0xA
    105 };
    106 
    107 // The enum validation function should be generated within the scope of this
    108 // struct.
    109 struct StructWithEnum {
    110   enum EnumWithin {
    111     A, B, C, D
    112   };
    113 };
    114