mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-07 06:03:13 +08:00
@@ -13,7 +13,6 @@ import (
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/httprunner/funplugin/myexec"
|
||||
@@ -95,9 +94,8 @@ func NewAndroidDevice(opts ...option.AndroidDeviceOption) (device *AndroidDevice
|
||||
|
||||
type AndroidDevice struct {
|
||||
*gadb.Device
|
||||
Options *option.AndroidDeviceOptions
|
||||
Logcat *AdbLogcat
|
||||
installMutex sync.Mutex // Mutex to lock installation/uninstallation operations
|
||||
Options *option.AndroidDeviceOptions
|
||||
Logcat *AdbLogcat
|
||||
}
|
||||
|
||||
func (dev *AndroidDevice) Setup() error {
|
||||
@@ -156,10 +154,6 @@ func (dev *AndroidDevice) NewDriver() (driver IDriver, err error) {
|
||||
}
|
||||
|
||||
func (dev *AndroidDevice) Install(apkPath string, opts ...option.InstallOption) error {
|
||||
// Lock the device for installation
|
||||
dev.installMutex.Lock()
|
||||
defer dev.installMutex.Unlock()
|
||||
|
||||
installOpts := option.NewInstallOptions(opts...)
|
||||
brand, err := dev.Device.Brand()
|
||||
if err != nil {
|
||||
@@ -267,10 +261,6 @@ func (dev *AndroidDevice) installCommon(apkPath string, args ...string) error {
|
||||
}
|
||||
|
||||
func (dev *AndroidDevice) Uninstall(packageName string) error {
|
||||
// Lock the device for uninstallation
|
||||
dev.installMutex.Lock()
|
||||
defer dev.installMutex.Unlock()
|
||||
|
||||
_, err := dev.Device.Uninstall(packageName)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/Masterminds/semver"
|
||||
@@ -129,7 +128,6 @@ type IOSDevice struct {
|
||||
listener *forward.ConnListener
|
||||
localPort int
|
||||
}
|
||||
installMutex sync.Mutex // Mutex to lock installation/uninstallation operations
|
||||
}
|
||||
|
||||
type DeviceDetail struct {
|
||||
@@ -267,10 +265,6 @@ func (dev *IOSDevice) NewDriver() (driver IDriver, err error) {
|
||||
}
|
||||
|
||||
func (dev *IOSDevice) Install(appPath string, opts ...option.InstallOption) (err error) {
|
||||
// Lock the device for installation
|
||||
dev.installMutex.Lock()
|
||||
defer dev.installMutex.Unlock()
|
||||
|
||||
installOpts := option.NewInstallOptions(opts...)
|
||||
for i := 0; i <= installOpts.RetryTimes; i++ {
|
||||
var conn *zipconduit.Connection
|
||||
@@ -290,10 +284,6 @@ func (dev *IOSDevice) Install(appPath string, opts ...option.InstallOption) (err
|
||||
}
|
||||
|
||||
func (dev *IOSDevice) Uninstall(bundleId string) error {
|
||||
// Lock the device for uninstallation
|
||||
dev.installMutex.Lock()
|
||||
defer dev.installMutex.Unlock()
|
||||
|
||||
svc, err := installationproxy.New(dev.DeviceEntry)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user