Home | History | Annotate | Download | only in test
      1 /*
      2  * Copyright (C) 2009 Google Inc. All rights reserved.
      3  * Copyright (C) 2010 Apple Inc. All rights reserved.
      4  *
      5  * Redistribution and use in source and binary formstrArg, with or without
      6  * modification, are permitted provided that the following conditions
      7  * are met:
      8  *
      9  * 1.  Redistributions of source code must retain the above copyright
     10  *     notice, this list of conditions and the following disclaimer.
     11  * 2.  Redistributions in binary form must reproduce the above copyright
     12  *     notice, this list of conditions and the following disclaimer in the
     13  *     documentation and/or other materials provided with the distribution.
     14  * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
     15  *     its contributors may be used to endorse or promote products derived
     16  *     from this software without specific prior written permission.
     17  *
     18  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
     19  * EXPRESS OR IMPLIED WARRANTIEstrArg, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     20  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     21  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
     22  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     23  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     24  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
     25  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     27  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     28  */
     29 
     30 // This IDL file is for testing the bindings code generator and for tracking
     31 // changes in its ouput.
     32 module test {
     33     interface TestObj {
     34         // Attributes
     35         readonly attribute long            readOnlyIntAttr;
     36         readonly attribute DOMString       readOnlyStringAttr;
     37         readonly attribute TestObj         readOnlyTestObjAttr;
     38         attribute short                    shortAttr;
     39         attribute unsigned short           unsignedShortAttr;
     40         attribute long                     intAttr;
     41         attribute long long                longLongAttr;
     42         attribute unsigned long long       unsignedLongLongAttr;
     43         attribute DOMString                stringAttr;
     44         attribute TestObj                  testObjAttr;
     45 
     46         JS, V8
     47         // WK_ucfirst, WK_lcfirst exceptional cases.
     48         attribute TestObj                  XMLObjAttr;
     49         attribute boolean                  create;
     50 
     51         // Reflected DOM attributes
     52         attribute [Reflect] DOMString reflectedStringAttr;
     53         attribute [Reflect] long reflectedIntegralAttr;
     54         attribute [Reflect] unsigned long reflectedUnsignedIntegralAttr;
     55         attribute [Reflect] boolean reflectedBooleanAttr;
     56         attribute [Reflect, URL] DOMString reflectedURLAttr;
     57         attribute [Reflect, NonEmpty, URL] DOMString reflectedNonEmptyURLAttr;
     58         attribute [Reflect=customContentStringAttr] DOMString reflectedStringAttr;
     59         attribute [Reflect=customContentIntegralAttr] long reflectedCustomIntegralAttr;
     60         attribute [Reflect=customContentBooleanAttr] boolean reflectedCustomBooleanAttr;
     61         attribute [Reflect=customContentURLAttr, URL] DOMString reflectedCustomURLAttr;
     62         attribute [Reflect=customContentNonEmptyURLAttr, NonEmpty, URL] DOMString reflectedCustomNonEmptyURLAttr;
     63 
     64         // Methods
     65         void    voidMethod();
     66         void    voidMethodWithArgs(in long intArg, in DOMString strArg, in TestObj objArg);
     67         long    intMethod();
     68         long    intMethodWithArgs(in long intArg, in DOMString strArg, in TestObj objArg);
     69         TestObj objMethod();
     70         TestObj objMethodWithArgs(in long intArg, in DOMString strArg, in TestObj objArg);
     71 
     72         [RequiresAllArguments] TestObj methodThatRequiresAllArgs(in DOMString strArg, in TestObj objArg);
     73         [RequiresAllArguments=Raise] TestObj methodThatRequiresAllArgsAndThrows(in DOMString strArg, in TestObj objArg)
     74             raises(DOMException);
     75 
     76         void serializedValue(in SerializedScriptValue serializedArg);
     77         void idbKey(in IDBKey key);
     78         void optionsObject(in OptionsObject oo, in [Optional] OptionsObject ooo);
     79 
     80         // Exceptions
     81         void methodWithException() raises(DOMException);
     82         attribute long attrWithGetterException getter raises(DOMException);
     83         attribute long attrWithSetterException setter raises(DOMException);
     84         attribute DOMString stringAttrWithGetterException getter raises(DOMException);
     85         attribute DOMString stringAttrWithSetterException setter raises(DOMException);
     86 
     87         // 'Custom' extended attribute
     88         attribute [Custom] long            customAttr;
     89         [Custom] void customMethod();
     90         [Custom] void customMethodWithArgs(in long intArg, in DOMString strArg, in TestObj objArg);
     91 
     92         [CustomArgumentHandling] void customArgsAndException(in log intArg)
     93             raises(DOMException);
     94 
     95         void addEventListener(in DOMString type,
     96                               in EventListener listener,
     97                               in boolean useCapture);
     98         void removeEventListener(in DOMString type,
     99                                  in EventListener listener,
    100                                  in boolean useCapture);
    101 
    102         // 'CallWith' extended attribute
    103         [CallWith=DynamicFrame] void withDynamicFrame();
    104         [CallWith=DynamicFrame] void withDynamicFrameAndArg(in long intArg);
    105         [CallWith=DynamicFrame] void withDynamicFrameAndOptionalArg(in long intArg, in [Optional] long optionalArg);
    106         [NeedsUserGestureCheck, CallWith=DynamicFrame] void withDynamicFrameAndUserGesture(in long intArg);
    107         [NeedsUserGestureCheck, CallWith=DynamicFrame] void withDynamicFrameAndUserGestureASAD(in long intArg, in [Optional] long optionalArg);
    108         [CallWith=ScriptState] void withScriptStateVoid();
    109         [CallWith=ScriptState] TestObj withScriptStateObj();
    110         [CallWith=ScriptState] void withScriptStateVoidException()
    111             raises(DOMException);
    112         [CallWith=ScriptState] TestObj withScriptStateObjException()
    113             raises(DOMException);
    114         [CallWith=ScriptExecutionContext] void withScriptExecutionContext();
    115 
    116         // 'Optional' extended attribute
    117         void    methodWithOptionalArg(in [Optional] long opt);
    118         void    methodWithNonOptionalArgAndOptionalArg(in long nonOpt, in [Optional] long opt);
    119         void    methodWithNonOptionalArgAndTwoOptionalArgs(in long nonOpt, in [Optional] long opt1, in long opt2);
    120 
    121 #if defined(TESTING_V8) || defined(TESTING_JS)
    122         // 'Callback' extended attribute
    123         void    methodWithCallbackArg(in [Callback] TestCallback callback);
    124         void    methodWithNonCallbackArgAndCallbackArg(in long nonCallback, in [Callback] TestCallback callback);
    125         void    methodWithCallbackAndOptionalArg(in [Callback, Optional] TestCallback callback);
    126 #endif
    127 
    128         // 'ConvertScriptString' extended attribute
    129         readonly attribute [ConvertScriptString] DOMString scriptStringAttr;
    130 
    131         // 'Conditional' extended attribute
    132         attribute [Conditional=Condition1] long conditionalAttr1;
    133         attribute [Conditional=Condition1&Condition2] long conditionalAttr2;
    134         attribute [Conditional=Condition1|Condition2] long conditionalAttr3;
    135 
    136 #if defined(TESTING_V8) || defined(TESTING_JS)
    137         // Overloads
    138         void    overloadedMethod(in TestObj objArg, in DOMString strArg);
    139         void    overloadedMethod(in TestObj objArg, in [Optional] long intArg);
    140         void    overloadedMethod(in DOMString strArg);
    141         void    overloadedMethod(in long intArg);
    142         void    overloadedMethod(in [Callback] TestCallback callback);
    143 #endif
    144 
    145         // Class methods within JavaScript (like what's used for IDBKeyRange).
    146         [ClassMethod] void classMethod();
    147         [ClassMethod] long classMethodWithOptional(in [Optional] long arg);
    148 
    149 #if defined(TESTING_V8)
    150         // 'EnabledAtRuntime' methods and attributes.
    151         [EnabledAtRuntime] void enabledAtRuntimeMethod1(in int intArg);
    152         [EnabledAtRuntime=FeatureName] void enabledAtRuntimeMethod2(in int intArg);
    153         attribute [EnabledAtRuntime] long enabledAtRuntimeAttr1;
    154         attribute [EnabledAtRuntime=FeatureName] long enabledAtRuntimeAttr2;
    155 #endif
    156 
    157         // ObjectiveC reserved words.
    158         readonly attribute long      description;
    159         attribute long               id;
    160         readonly attribute DOMString hash;
    161 
    162         // Check constants and enums.
    163         const unsigned short CONST_VALUE_0 = 0;
    164         const unsigned short CONST_VALUE_1 = 1;
    165         const unsigned short CONST_VALUE_2 = 2;
    166         const unsigned short CONST_VALUE_4 = 4;
    167         const unsigned short CONST_VALUE_8 = 8;
    168         const short CONST_VALUE_9 = -1;
    169         const DOMString CONST_VALUE_10 = "my constant string";
    170         const unsigned short CONST_VALUE_11 = 0xffffffff;
    171         const unsigned short CONST_VALUE_12 = 0x01;
    172         const unsigned short CONST_VALUE_13 = 0X20;
    173         const unsigned short CONST_VALUE_14 = 0x1abc;
    174     };
    175 }
    176