refactor: NewADBDriver

This commit is contained in:
lilong.129
2025-02-06 21:39:17 +08:00
parent 94d3cb785c
commit f87d37d5c6
12 changed files with 164 additions and 167 deletions

View File

@@ -38,6 +38,12 @@ func NewAndroidDeviceConfig(opts ...AndroidDeviceOption) *AndroidDeviceConfig {
type AndroidDeviceOption func(*AndroidDeviceConfig)
func WithDriverTypeADB() AndroidDeviceOption {
return func(device *AndroidDeviceConfig) {
device.STUB = false
}
}
func WithSerialNumber(serial string) AndroidDeviceOption {
return func(device *AndroidDeviceConfig) {
device.SerialNumber = serial

View File

@@ -7,14 +7,12 @@ type DriverOptions struct {
Plugin funplugin.IPlugin
WithImageService bool
WithResultFolder bool
WithUIAction bool
}
func NewDriverOptions(opts ...DriverOption) *DriverOptions {
driverOptions := &DriverOptions{
WithImageService: true,
WithResultFolder: true,
WithUIAction: true,
}
for _, option := range opts {
option(driverOptions)
@@ -42,12 +40,6 @@ func WithDriverResultFolder(withResultFolder bool) DriverOption {
}
}
func WithUIAction(withUIAction bool) DriverOption {
return func(options *DriverOptions) {
options.WithUIAction = withUIAction
}
}
func WithDriverPlugin(plugin funplugin.IPlugin) DriverOption {
return func(options *DriverOptions) {
options.Plugin = plugin