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 module mojo.test;
      6 
      7 import "mojo/public/interfaces/bindings/tests/sample_import.mojom";
      8 
      9 enum AnEnum {
     10   FIRST, SECOND
     11 };
     12 
     13 [Extensible]
     14 enum AnExtensibleEnum {
     15   FIRST, SECOND, THIRD
     16 };
     17 
     18 union PodUnion {
     19   int8   f_int8;
     20   int8   f_int8_other;
     21   uint8  f_uint8;
     22   int16  f_int16;
     23   uint16 f_uint16;
     24   int32  f_int32;
     25   uint32 f_uint32;
     26   int64  f_int64;
     27   uint64 f_uint64;
     28   float  f_float;
     29   double f_double;
     30   bool   f_bool;
     31   AnEnum f_enum;
     32   AnExtensibleEnum f_extensible_enum;
     33 };
     34 
     35 union ObjectUnion {
     36   int8   f_int8;
     37   string f_string;
     38   DummyStruct f_dummy;
     39   DummyStruct? f_nullable;
     40   array<int8> f_array_int8;
     41   map<string, int8> f_map_int8;
     42   PodUnion f_pod_union;
     43   // Test that Clone() is defined after SmallStruct is declared.
     44   array<SmallStruct> f_small_structs;
     45 };
     46 
     47 union HandleUnion {
     48   handle f_handle;
     49   handle<message_pipe> f_message_pipe;
     50   handle<data_pipe_consumer> f_data_pipe_consumer;
     51   handle<data_pipe_producer> f_data_pipe_producer;
     52   handle<shared_buffer> f_shared_buffer;
     53   SmallCache f_small_cache;
     54   SmallCache& f_small_cache_request;
     55 };
     56 
     57 struct WrapperStruct {
     58   ObjectUnion? object_union;
     59   PodUnion? pod_union;
     60   HandleUnion? handle_union;
     61 };
     62 
     63 struct DummyStruct {
     64   int8 f_int8;
     65 };
     66 
     67 struct SmallStruct {
     68   DummyStruct? dummy_struct;
     69   PodUnion? pod_union;
     70   array<PodUnion>? pod_union_array;
     71   array<PodUnion?>? nullable_pod_union_array;
     72   array<DummyStruct>? s_array;
     73   map<string, PodUnion>? pod_union_map;
     74   map<string, PodUnion?>? nullable_pod_union_map;
     75 };
     76 
     77 struct SmallStructNonNullableUnion {
     78   PodUnion pod_union;
     79 };
     80 
     81 struct SmallObjStruct {
     82   ObjectUnion obj_union;
     83   int8 f_int8;
     84 };
     85 
     86 interface SmallCache {
     87   SetIntValue(int64 int_value);
     88   GetIntValue() => (int64 int_value);
     89 };
     90 
     91 interface UnionInterface {
     92   Echo(PodUnion in_val) => (PodUnion out_val);
     93 };
     94 
     95 struct TryNonNullStruct {
     96   DummyStruct? nullable;
     97   DummyStruct non_nullable;
     98 };
     99 
    100 union OldUnion {
    101   int8 f_int8;
    102 };
    103 
    104 union NewUnion {
    105   int8 f_int8;
    106   int16 f_int16;
    107 };
    108 
    109 struct ImportedUnionStruct {
    110   imported.PointOrShape point_or_shape;
    111 };
    112 
    113 union ImportedUnionUnion {
    114   imported.PointOrShape point_or_shape;
    115 };
    116