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 // A non-extensible enum with no values is valid, but about as useless as
     60 // you would expect: it will fail validation for all values.
     61 enum EmptyEnum {};
     62 
     63 [Extensible]
     64 enum ExtensibleEmptyEnum {};
     65 
     66 union UnionA {
     67   StructA struct_a;
     68   bool b;
     69 };
     70 
     71 // This interface is used for testing bounds-checking in the mojom
     72 // binding code. If you add a method please update the files
     73 // ./data/validation/boundscheck_*. If you add a response please update
     74 // ./data/validation/resp_boundscheck_*.
     75 interface BoundsCheckTestInterface {
     76   Method0(uint8 param0) => (uint8 param0);
     77   Method1(uint8 param0);
     78 };
     79 
     80 interface ConformanceTestInterface {
     81   Method0(float param0);
     82   Method1(StructA param0);
     83   Method2(StructB param0, StructA param1);
     84   Method3(array<bool> param0);
     85   Method4(StructC param0, array<uint8> param1);
     86   Method5(StructE param0, handle<data_pipe_producer> param1);
     87   Method6(array<array<uint8>> param0);
     88   Method7(StructF param0, array<array<uint8, 3>?, 2> param1);
     89   Method8(array<array<string>?> param0);
     90   Method9(array<array<handle?>>? param0);
     91   Method10(map<string, uint8> param0);
     92   Method11(StructG param0);
     93   Method12(float param0) => (float param0);
     94   Method13(InterfaceA? param0, uint32 param1, InterfaceA? param2);
     95   Method14(EnumA param0, EnumB param1);
     96   Method15(array<EnumA>? param0, array<EnumB>? param1);
     97   Method16(map<EnumA, EnumA>? param0);
     98   Method17(array<InterfaceA> param0);
     99   Method18(UnionA? param0);
    100   Method19(Recursive recursive);
    101   Method20(map<StructB, uint8> param0);
    102   Method21(ExtensibleEmptyEnum param0);
    103   Method22(EmptyEnum param0);
    104 };
    105 
    106 struct BasicStruct {
    107   int32 a;
    108 };
    109 
    110 interface IntegrationTestInterface {
    111   Method0(BasicStruct param0) => (array<uint8> param0);
    112 };
    113 
    114 // An enum generates a enum-value validation function, so we want to test it.
    115 // E.g., valid enum values for this enum should be:  -3, 0, 1, 10
    116 enum BasicEnum {
    117   A,
    118   B,
    119   C = A,
    120   D = -3,
    121   E = 0xA
    122 };
    123 
    124 // The enum validation function should be generated within the scope of this
    125 // struct.
    126 struct StructWithEnum {
    127   enum EnumWithin {
    128     A, B, C, D
    129   };
    130 };
    131 
    132 // This is used to test that deeply recursive structures don't blow the stack.
    133 struct Recursive {
    134   Recursive? recursive;
    135 };
    136