public DeviceBridge(string desiredDeviceName, string ipAddress, string localeTag, bool captureCodedUiLogs)
        {
            this.Culture = new CultureInfo(localeTag);

            this.deployer = DeployerFactory.DeployerForPackage(null, desiredDeviceName, false, this.Culture);

            this.GetIpAddress(ipAddress);

            this.captureCodedUiLogs = captureCodedUiLogs;
        }
Ejemplo n.º 2
0
        private void InitializeDeployer()
        {
            var strictMatchDeviceName = Capabilities.BoundDeviceName != null;

            if (strictMatchDeviceName)
            {
                if (Capabilities.BoundDeviceName.StartsWith(
                        this.ActualCapabilities.DeviceName,
                        StringComparison.OrdinalIgnoreCase))
                {
                    this.ActualCapabilities.DeviceName = Capabilities.BoundDeviceName;
                }
                else
                {
                    throw new AutomationException(
                              string.Format(
                                  "Driver was bound to '{0}' at launch with --bound-device-name option, but another device '{1}' was requested by session.",
                                  Capabilities.BoundDeviceName,
                                  this.ActualCapabilities.DeviceName));
                }
            }

            var appFileInfo = new FileInfo(this.ActualCapabilities.App);

            this.Deployer = DeployerFactory.DeployerForPackage(
                appFileInfo,
                this.ActualCapabilities.DeviceName,
                strictMatchDeviceName);

            if (!this.ActualCapabilities.DeviceName.Equals(this.Deployer.DeviceName, StringComparison.OrdinalIgnoreCase))
            {
                Logger.Warn(
                    "Device was found using partail deviceName '{0}',"
                    + " this behavior might be deprecated in favor of specifying strict deviceName or platformVersion (when implemented).",
                    this.ActualCapabilities.DeviceName);
            }
        }