-
Notifications
You must be signed in to change notification settings - Fork 69
/
installationproxy_test.go
71 lines (58 loc) · 2.02 KB
/
installationproxy_test.go
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
package giDevice
import (
"testing"
)
var installationProxySrv InstallationProxy
func setupInstallationProxySrv(t *testing.T) {
setupLockdownSrv(t)
var err error
if lockdownSrv, err = dev.lockdownService(); err != nil {
t.Fatal(err)
}
if installationProxySrv, err = lockdownSrv.InstallationProxyService(); err != nil {
t.Fatal(err)
}
}
func Test_installationProxy_Browse(t *testing.T) {
setupInstallationProxySrv(t)
// currentList, err := installationProxySrv.Browse(WithMetaData(true))
// currentList, err := installationProxySrv.Browse(WithReturnAttributes("CFBundleIdentifier", "SequenceNumber", "SequenceNumber"))
// currentList, err := installationProxySrv.Browse(WithApplicationType(ApplicationTypeSystem))
// currentList, err := installationProxySrv.Browse(WithApplicationType(ApplicationTypeSystem), WithReturnAttributes("ApplicationType", "ApplicationType"))
// currentList, err := dev.InstallationProxyBrowse()
currentList, err := installationProxySrv.Browse()
// currentList, err := installationProxySrv.Browse(WithBundleIDs("com.apple.MusicUIService"), WithBundleIDs("com.apple.Home.HomeControlService"))
if err != nil {
t.Fatal(err)
}
t.Log(len(currentList))
for _, cl := range currentList {
app, ok := cl.(map[string]interface{})
if ok {
t.Log(app)
} else {
t.Log(cl)
}
}
}
func Test_installationProxy_Lookup(t *testing.T) {
setupInstallationProxySrv(t)
// lookupResult, err := installationProxySrv.Lookup()
// lookupResult, err := dev.InstallationProxyLookup(
lookupResult, err := installationProxySrv.Lookup(
// WithApplicationType(ApplicationTypeUser),
// WithApplicationType(ApplicationTypeSystem),
// WithReturnAttributes("CFBundleDevelopmentRegion"),
// WithReturnAttributes("CFBundleDisplayName", "CFBundleIdentifier"),
// WithBundleIDs("com.apple.mobilephone"),
WithBundleIDs("com.leixipaopao.WebDriverAgentRunner.xctrunner"),
)
if err != nil {
t.Fatal(err)
}
ret := lookupResult.(map[string]interface{})
t.Log(len(ret))
for k, v := range ret {
t.Log(k, "-->", v)
}
}