-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathEDOTestDummy.h
More file actions
170 lines (142 loc) · 6.12 KB
/
EDOTestDummy.h
File metadata and controls
170 lines (142 loc) · 6.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
//
// Copyright 2018 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#import <CoreImage/CoreImage.h>
#import <Foundation/Foundation.h>
#import "Service/Tests/TestsBundle/EDOTestNonNSCodingType.h"
#import "Service/Tests/TestsBundle/EDOTestProtocol.h"
#import "Service/Tests/TestsBundle/EDOTestProtocolInApp.h"
#import "Service/Tests/TestsBundle/EDOTestValueType.h"
// Define the constant port number so both the test and the app process can
// share. This will eventually be automatically assigned.
#define EDOTEST_APP_SERVICE_PORT 1234
@class EDOTestDummy;
@interface EDOTestDummyException : NSException
@end
/** The dummy c-struct to test POD type of parameter. */
typedef struct EDOTestDummyStruct {
int value;
float a, b, c;
double x, y, z;
} EDOTestDummyStruct;
/** The handler block that has primitive type, struct type and object type for testing. */
typedef EDOTestDummy * (^EDOMultiTypesHandler)(EDOTestDummyStruct, int, id, EDOTestDummy *);
/** The dummy class used to test the distant object. */
@interface EDOTestDummy : NSObject <NSFastEnumeration, EDOTestProtocolInApp, NSCopying>
@property int value;
@property void (^block)(void);
@property(readonly, weak) EDOTestDummy *weakDummyInTest;
@property(weak) id weakDelegate;
@property(nonatomic) id<NSCoding> valueObject;
- (instancetype)initWithValue:(int)value;
/// class methods
+ (EDOTestDummy *)classMethodWithNumber:(NSNumber *)value;
/// void return with parameters of different types
- (void)voidWithValuePlusOne;
- (void)voidWithInt:(int)arg1;
- (void)voidWithNumber:(NSNumber *)value1;
- (void)voidWithString:(NSString *)string data:(NSData *)data;
- (void)voidWithClass:(Class)clazz;
- (void)voidWithStruct:(EDOTestDummyStruct)value;
- (void)voidWithId:(id)any;
- (void)voidWithValueOut:(NSNumber **)numberOut;
- (void)voidWithErrorOut:(NSError **)errorOut;
- (void)voidWithOutObject:(EDOTestDummy **)dummyOut;
- (void)voidWithValue:(int)value outSelf:(EDOTestDummy **)dummyOut;
- (void)voidWithProtocol:(Protocol *)protocol;
- (void)voidWithNullCPointer:(void *)cPointer;
- (void)voidWithObjectArray:(NSArray<id> *)array;
/// no parameters with returns of different types
- (int)returnInt;
- (EDOTestDummyStruct)returnStruct;
- (NSNumber *)returnNumber;
- (NSString *)returnString;
- (NSData *)returnData;
- (EDOTestDummy *)returnSelf;
- (instancetype)returnDeepCopy;
- (NSDictionary<NSString *, NSNumber *> *)returnDictionary;
- (NSArray<NSNumber *> *)returnArray;
- (NSArray<NSNumber *> *)returnLargeArray;
- (NSSet<NSNumber *> *)returnSet;
- (Class)returnClass;
- (id)returnIdNil;
- (Protocol *)returnWithProtocolInApp;
- (EDOTestDummy *)returnWeakDummy;
- (EDOTestDummy *)weaklyHeldDummyForMemoryTest;
- (void (^)(void))returnBlock;
// block variants
- (void)voidWithBlock:(void (^)(void))block;
- (void)voidWithBlockAssigned:(void (^)(void))block;
- (void)voidWithBlockAssignedAndInvoked:(void (^)(void))block;
- (EDOTestDummyStruct)returnStructWithBlockStret:(EDOTestDummyStruct (^)(void))block;
- (double)returnWithBlockDouble:(double (^)(void))block;
- (id)returnWithBlockObject:(id (^)(EDOTestDummy *))block;
- (EDOTestDummy *)returnWithBlockOutObject:(void (^)(EDOTestDummy **))block;
- (EDOTestDummy *)returnWithInt:(int)intVar
dummyStruct:(EDOTestDummyStruct)dummyStruct
object:(id)object
blockComplex:(EDOMultiTypesHandler)block;
- (void)invokeBlock;
/** Returns the name of the given @c selector. */
- (NSString *)nameFromSelector:(SEL)selector;
/** Returns the selector from the given @c name. */
- (SEL)selectorFromName:(NSString *)name;
/** Returns the red channel of a CIColor. */
- (CGFloat)colorRed:(CIColor *)color;
/// throw exceptions
- (void)selWithThrow;
/// returns with parameters of different types
- (EDOTestDummyStruct)structWithStruct:(EDOTestDummyStruct)value;
- (EDOTestDummy *)returnIdWithInt:(int)value;
- (Class)classsWithClass:(Class)clz;
- (NSNumber *)returnNumberWithInt:(int)arg value:(NSNumber *)value;
- (BOOL)returnBoolWithError:(NSError **)errorOrNil;
- (NSString *)returnClassNameWithObject:(id)object;
- (NSInteger)returnCountWithArray:(NSArray *)value;
- (NSInteger)returnSumWithArray:(NSArray<NSNumber*> *)value;
- (NSInteger)returnSumWithArrayAndProxyCheck:(NSArray<NSNumber*> *)value;
- (int *)returnIntPointer;
/**
* Gets the class name for the given object reference.
*
* @param objRef The reference to an object.
* @return @c nil if objRef is @c nil; @"" if *objRef is @c nil; otherwise the
* class name of *objRef.
*/
- (NSString *)returnClassNameWithObjectRef:(id *)objRef;
/** Gets the given argument's local address. */
- (UInt64)memoryAddressFromObject:(id)object;
/** Gets the given argument pointee's local address. */
- (UInt64)memoryAddressFromObjectRef:(id *)objRef;
/// helper methods
- (NSException *)exceptionWithReason:(NSString *)reason;
- (NSError *)error;
+ (void)enumerateSelector:(void (^)(SEL selector))block;
@end
/** The extension for AppDelegate. */
@interface EDOTestDummy (AppDelegate)
- (void)invalidateService;
@end
@class EDOTestDummyInTest;
/** Extension for multiplex invocation between the Host and the Client. */
@interface EDOTestDummy (InTest)
- (int)callBackToTest:(EDOTestDummyInTest *)dummy withValue:(int)value;
- (int)selWithOutEDO:(EDOTestDummyInTest **)dummyOut dummy:(EDOTestDummyInTest *)dummyIn;
- (EDOTestDummyInTest *)selWithInOutEDO:(EDOTestDummyInTest **)dummyInOut;
- (void)setDummInTest:(EDOTestDummyInTest *)dummyInTest withDummy:(EDOTestDummyInTest *)dummy;
- (EDOTestDummyInTest *)getRootObject:(UInt16)port;
- (EDOTestDummyInTest *)createEDOWithPort:(UInt16)port;
- (int)returnPlus10AndAsyncExecuteBlock:(EDOTestDummyInTest *)dummyInTest;
@end