/// <summary> /// Executes a command with this driver . /// </summary> /// <param name="driverCommandToExecute">A <see cref="DriverCommand"/> value representing the command to execute.</param> /// <param name="parameters">A <see cref="Dictionary{K, V}"/> containing the names and values of the parameters of the command.</param> /// <returns>A <see cref="Response"/> containing information about the success or failure of the command and any data returned by the command.</returns> protected override Response Execute(DriverCommand driverCommandToExecute, Dictionary <string, object> parameters) { Response commandResponse = null; try { commandResponse = base.Execute(driverCommandToExecute, parameters); } catch (ArgumentException) { // Exceptions may leave the extension hung, or in an // inconsistent state, so we restart Chrome this.StopClient(); this.StartClient(); } catch (FatalChromeException) { // Exceptions may leave the extension hung, or in an inconsistent state, // so we restart Chrome. There is also a legitimate success condition // where navigating to about:blank does not cause the extension to // write a response back to the driver. this.StopClient(); this.StartClient(); } return(commandResponse); }
public void ProcessesAddDriverCommand() { var mockReport = new Mock <IDriveReport>(); var command = new DriverCommand("Bob"); command.Process(mockReport.Object); mockReport.Verify(r => r.AddDriver(It.Is <string>(name => name == "Bob")), Times.Once); }
public void Dispose() { foreach (IDbDataParameter param in DriverCommand.Parameters) { var paramValue = param.Value as IDisposable; if (paramValue != null) { paramValue.Dispose(); } } DriverCommand.Dispose(); }