Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/javax/accessibility/AccessibilityProvider/basic.sh
41152 views
1
#
2
# Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
#
5
# This code is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License version 2 only, as
7
# published by the Free Software Foundation.
8
#
9
# This code is distributed in the hope that it will be useful, but WITHOUT
10
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
# version 2 for more details (a copy is included in the LICENSE file that
13
# accompanied this code).
14
#
15
# You should have received a copy of the GNU General Public License version
16
# 2 along with this work; if not, write to the Free Software Foundation,
17
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
#
19
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
# or visit www.oracle.com if you need additional information or have any
21
# questions.
22
#
23
# @test
24
# @key headful
25
# @bug 8055160 8216008
26
# @summary Unit test for javax.accessibility.AccessibilitySPI
27
#
28
# @build Load FooProvider BarProvider UnusedProvider
29
# @run shell basic.sh
30
31
# Command-line usage: sh basic.sh /path/to/build
32
33
if [ -z "$TESTJAVA" ]; then
34
if [ $# -lt 1 ]; then exit 1; fi
35
TESTJAVA="$1"
36
TESTSRC=`pwd`
37
TESTCLASSES="`pwd`"
38
fi
39
40
JAVA="$TESTJAVA/bin/java"
41
42
OS=`uname -s`
43
case "$OS" in
44
Darwin | AIX )
45
FS='/'
46
SEP=':' ;;
47
Linux )
48
FS='/'
49
SEP=':' ;;
50
* )
51
FS='\\'
52
SEP='\;' ;;
53
esac
54
55
TESTD=x.test
56
rm -rf $TESTD
57
mkdir -p $TESTD
58
59
mv $TESTCLASSES/FooProvider.class $TESTD
60
mv $TESTCLASSES/BarProvider.class $TESTD
61
mv $TESTCLASSES/UnusedProvider.class $TESTD
62
mkdir -p $TESTD/META-INF/services
63
echo FooProvider >$TESTD/META-INF/services/javax.accessibility.AccessibilityProvider
64
echo BarProvider >>$TESTD/META-INF/services/javax.accessibility.AccessibilityProvider
65
echo UnusedProvider >>$TESTD/META-INF/services/javax.accessibility.AccessibilityProvider
66
67
68
failures=0
69
70
go() {
71
CP="$TESTCLASSES$SEP$TESTD"
72
echo ''
73
sh -xc "$JAVA $SECURITY_MANAGER -Djavax.accessibility.assistive_technologies=$PROVIDER1$COMMA$PROVIDER2 -cp $CP Load $1 $2 $3" 2>&1
74
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
75
}
76
77
# find one provider
78
PROVIDER1="FooProvider"
79
go pass $PROVIDER1
80
81
# start using security manager
82
SECURITY_MANAGER="-Djava.security.manager -Djava.security.policy=$TESTSRC/accessibilityProvider.sp"
83
84
# find one provider (with security manager)
85
go pass $PROVIDER1
86
SECURITY_MANAGER=
87
88
# fail if no provider found
89
PROVIDER1="NoProvider"
90
go fail $PROVIDER1
91
92
# pass if none provider found
93
PROVIDER1=
94
go pass $PROVIDER1
95
96
PROVIDER1=" "
97
go pass $PROVIDER1
98
99
# setup for two providers
100
COMMA=","
101
102
# find two providers, both exist
103
PROVIDER1="FooProvider"
104
PROVIDER2="BarProvider"
105
go pass $PROVIDER1 $PROVIDER2
106
107
# find two providers, where second one doesn't exist
108
PROVIDER1="FooProvider"
109
PROVIDER2="NoProvider"
110
go fail $PROVIDER1 $PROVIDER2
111
112
# find two providers, where first one doesn't exist
113
PROVIDER1="NoProvider"
114
PROVIDER2="BarProvider"
115
go fail $PROVIDER1 $PROVIDER2
116
117
echo ''
118
if [ $failures -gt 0 ];
119
then echo "$failures case(s) failed";
120
else echo "All cases passed"; fi
121
exit $failures
122
123
124