xref: /aosp_15_r20/art/test/044-proxy/src/Main.java (revision 795d594fd825385562da6b089ea9b2033f3abf5a)
1*795d594fSAndroid Build Coastguard Worker /*
2*795d594fSAndroid Build Coastguard Worker  * Copyright (C) 2008 The Android Open Source Project
3*795d594fSAndroid Build Coastguard Worker  *
4*795d594fSAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
5*795d594fSAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
6*795d594fSAndroid Build Coastguard Worker  * You may obtain a copy of the License at
7*795d594fSAndroid Build Coastguard Worker  *
8*795d594fSAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
9*795d594fSAndroid Build Coastguard Worker  *
10*795d594fSAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
11*795d594fSAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
12*795d594fSAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*795d594fSAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
14*795d594fSAndroid Build Coastguard Worker  * limitations under the License.
15*795d594fSAndroid Build Coastguard Worker  */
16*795d594fSAndroid Build Coastguard Worker 
17*795d594fSAndroid Build Coastguard Worker import java.util.HashMap;
18*795d594fSAndroid Build Coastguard Worker 
19*795d594fSAndroid Build Coastguard Worker /**
20*795d594fSAndroid Build Coastguard Worker  * Test java.lang.reflect.Proxy
21*795d594fSAndroid Build Coastguard Worker  */
22*795d594fSAndroid Build Coastguard Worker public class Main {
main(String[] args)23*795d594fSAndroid Build Coastguard Worker     public static void main(String[] args) {
24*795d594fSAndroid Build Coastguard Worker         ReturnsAndArgPassing.main(null);
25*795d594fSAndroid Build Coastguard Worker         BasicTest.main(null);
26*795d594fSAndroid Build Coastguard Worker         Clash.main(null);
27*795d594fSAndroid Build Coastguard Worker         Clash2.main(null);
28*795d594fSAndroid Build Coastguard Worker         Clash3.main(null);
29*795d594fSAndroid Build Coastguard Worker         Clash4.main(null);
30*795d594fSAndroid Build Coastguard Worker         WrappedThrow.main(null);
31*795d594fSAndroid Build Coastguard Worker         NarrowingTest.main(null);
32*795d594fSAndroid Build Coastguard Worker         FloatSelect.main(null);
33*795d594fSAndroid Build Coastguard Worker         NativeProxy.main(args);
34*795d594fSAndroid Build Coastguard Worker         ConstructorProxy.main();
35*795d594fSAndroid Build Coastguard Worker         OOMEOnDispatch.main(args);
36*795d594fSAndroid Build Coastguard Worker         HotProxy.main(args);
37*795d594fSAndroid Build Coastguard Worker     }
38*795d594fSAndroid Build Coastguard Worker 
39*795d594fSAndroid Build Coastguard Worker     // The following code maps from the actual proxy class names (eg $Proxy2) to their test output
40*795d594fSAndroid Build Coastguard Worker     // names (eg $PROXY_CLASS_NAME1$). This is to avoid the flaky test failures due to potentially
41*795d594fSAndroid Build Coastguard Worker     // undeterministic proxy class naming.
42*795d594fSAndroid Build Coastguard Worker 
registerProxyClassName(String proxyClassName)43*795d594fSAndroid Build Coastguard Worker     public static void registerProxyClassName(String proxyClassName) {
44*795d594fSAndroid Build Coastguard Worker         proxyClassNameMap.put(proxyClassName,
45*795d594fSAndroid Build Coastguard Worker                               "$PROXY_CLASS_NAME" + (uniqueTestProxyClassNum++) + "$");
46*795d594fSAndroid Build Coastguard Worker     }
47*795d594fSAndroid Build Coastguard Worker 
replaceProxyClassNamesForOutput(String str)48*795d594fSAndroid Build Coastguard Worker     public static String replaceProxyClassNamesForOutput(String str) {
49*795d594fSAndroid Build Coastguard Worker         for (String key : proxyClassNameMap.keySet()) {
50*795d594fSAndroid Build Coastguard Worker             str = str.replace(key, proxyClassNameMap.get(key));
51*795d594fSAndroid Build Coastguard Worker         }
52*795d594fSAndroid Build Coastguard Worker         return str;
53*795d594fSAndroid Build Coastguard Worker     }
54*795d594fSAndroid Build Coastguard Worker 
55*795d594fSAndroid Build Coastguard Worker     private static final HashMap<String, String> proxyClassNameMap = new HashMap<String, String>();
56*795d594fSAndroid Build Coastguard Worker 
57*795d594fSAndroid Build Coastguard Worker     private static int uniqueTestProxyClassNum = 0;
58*795d594fSAndroid Build Coastguard Worker 
startJit()59*795d594fSAndroid Build Coastguard Worker     static native void startJit();
stopJit()60*795d594fSAndroid Build Coastguard Worker     static native void stopJit();
waitForCompilation()61*795d594fSAndroid Build Coastguard Worker     static native void waitForCompilation();
62*795d594fSAndroid Build Coastguard Worker }
63