Skip to content

Commit

Permalink
[dotnet] Linting and suppressing compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jimevans committed Aug 29, 2023
1 parent fa1ee12 commit 1dcbcc2
Show file tree
Hide file tree
Showing 52 changed files with 489 additions and 129 deletions.
3 changes: 1 addition & 2 deletions dotnet/src/webdriver/Chromium/ChromiumAndroidOptions.cs
Expand Up @@ -46,8 +46,7 @@ public bool UseRunningApp
}

/// <summary>
/// Gets or sets the process name of the Activity hosting the app. If not given, it
/// is assumed to be the same as <see cref="AndroidActivity"/>.
/// Gets or sets the process name of the Activity hosting the app.
/// </summary>
public string AndroidProcess
{
Expand Down
18 changes: 12 additions & 6 deletions dotnet/src/webdriver/Chromium/ChromiumDriver.cs
Expand Up @@ -131,6 +131,14 @@ protected ChromiumDriver(ChromiumDriverService service, ChromiumOptions options,
this.optionsCapabilityName = options.CapabilityName;
}

/// <summary>
/// Gets the dictionary of custom Chromium commands registered with the driver.
/// </summary>
protected static IReadOnlyDictionary<string, CommandInfo> ChromiumCustomCommands
{
get { return new ReadOnlyDictionary<string, CommandInfo>(chromiumCustomCommands); }
}

/// <summary>
/// Uses DriverFinder to set Service attributes if necessary when creating the command executor
/// </summary>
Expand All @@ -148,11 +156,6 @@ private static ICommandExecutor GenerateDriverServiceCommandExecutor(DriverServi
return new DriverServiceCommandExecutor(service, commandTimeout);
}

protected static IReadOnlyDictionary<string, CommandInfo> ChromiumCustomCommands
{
get { return new ReadOnlyDictionary<string, CommandInfo>(chromiumCustomCommands); }
}

/// <summary>
/// Gets or sets the <see cref="IFileDetector"/> responsible for detecting
/// sequences of keystrokes representing file paths and names.
Expand Down Expand Up @@ -265,7 +268,6 @@ public object ExecuteCdpCommand(string commandName, Dictionary<string, object> c
/// <summary>
/// Creates a session to communicate with a browser using the Chromium Developer Tools debugging protocol.
/// </summary>
/// <param name="devToolsProtocolVersion">The version of the Chromium Developer Tools protocol to use. Defaults to autodetect the protocol version.</param>
/// <returns>The active session to use to communicate with the Chromium Developer Tools debugging protocol.</returns>
public DevToolsSession GetDevToolsSession()
{
Expand Down Expand Up @@ -435,6 +437,10 @@ public void StopCasting(string deviceName)
this.Execute(StopCastingCommand, parameters);
}

/// <summary>
/// Stops the driver from running
/// </summary>
/// <param name="disposing">if its in the process of disposing</param>
protected override void Dispose(bool disposing)
{
if (disposing)
Expand Down
1 change: 1 addition & 0 deletions dotnet/src/webdriver/Chromium/ChromiumDriverService.cs
Expand Up @@ -45,6 +45,7 @@ public abstract class ChromiumDriverService : DriverService
/// <param name="executablePath">The full path to the ChromeDriver executable.</param>
/// <param name="executableFileName">The file name of the ChromeDriver executable.</param>
/// <param name="port">The port on which the ChromeDriver executable should listen.</param>
/// <param name="downloadUrl">The URL from which the driver executable can be downloaded.</param>
protected ChromiumDriverService(string executablePath, string executableFileName, int port, Uri downloadUrl = null)
: base(executablePath, port, executableFileName)
{
Expand Down
5 changes: 5 additions & 0 deletions dotnet/src/webdriver/Chromium/ChromiumNetworkConditions.cs
Expand Up @@ -97,6 +97,11 @@ public long UploadThroughput
}
}

/// <summary>
/// Creates a ChromiumNetworkConditions object from a dictionary of key-value pairs.
/// </summary>
/// <param name="dictionary">The dictionary to use to create the object.</param>
/// <returns>The ChromiumNetworkConditions object created from the dictionary.</returns>
public static ChromiumNetworkConditions FromDictionary(Dictionary<string, object> dictionary)
{
ChromiumNetworkConditions conditions = new ChromiumNetworkConditions();
Expand Down
2 changes: 1 addition & 1 deletion dotnet/src/webdriver/CommandInfoRepository.cs
Expand Up @@ -64,7 +64,7 @@ public bool IsCommandNameDefined(string commandName)
/// Finds a command name for a given <see cref="CommandInfo"/>.
/// </summary>
/// <param name="commandInfo">The <see cref="CommandInfo"/> object for which to find the command name.</param>
/// <returns>The name of the command defined by the command info, or <see langword=""="null"/> if the command is not defined.</returns>
/// <returns>The name of the command defined by the command info, or <see langword="null"/> if the command is not defined.</returns>
public string FindCommandName(CommandInfo commandInfo)
{
foreach(KeyValuePair<string, CommandInfo> pair in this.commandDictionary)
Expand Down
18 changes: 13 additions & 5 deletions dotnet/src/webdriver/DevTools/DevToolsSession.cs
Expand Up @@ -36,6 +36,10 @@ namespace OpenQA.Selenium.DevTools
///</summary>
public class DevToolsSession : IDevToolsSession
{
/// <summary>
/// A value indicating that the version of the DevTools protocol in use
/// by the browser should be automatically detected.
/// </summary>
public const int AutoDetectDevToolsProtocolVersion = 0;

private readonly string debuggerEndpoint;
Expand Down Expand Up @@ -158,9 +162,9 @@ public async Task<ICommandResponse<TCommand>> SendCommand<TCommand>(TCommand com
/// <summary>
/// Sends the specified command and returns the associated command response.
/// </summary>
/// <typeparam name="TCommand"></typeparam>
/// <typeparam name="TCommandResponse"></typeparam>
/// <typeparam name="TCommand">A command object implementing the <see cref="ICommand"/> interface.</typeparam>
/// <typeparam name="TCommandResponse">A response object implementing the <see cref="ICommandResponse"/> interface.</typeparam>
/// <param name="command">The command to send.</param>
/// <param name="cancellationToken">A CancellationToken object to allow for cancellation of the command.</param>
/// <param name="millisecondsTimeout">The execution timeout of the command in milliseconds.</param>
/// <param name="throwExceptionIfResponseNotReceived"><see langword="true"/> to throw an exception if a response is not received; otherwise, <see langword="false"/>.</param>
Expand Down Expand Up @@ -262,8 +266,8 @@ public async Task<JToken> SendCommand(string commandName, JToken commandParamete
}

/// <summary>
/// Disposes of the DevToolsSession and frees all resources.
///</summary>
/// Releases all resources associated with this <see cref="DevToolsSession"/>.
/// </summary>
public void Dispose()
{
this.Dispose(true);
Expand Down Expand Up @@ -296,7 +300,7 @@ internal async Task StartSession(int requestedProtocolVersion)
/// Asynchronously stops the session.
/// </summary>
/// <param name="manualDetach"><see langword="true"/> to manually detach the session
/// from its attached target; otherswise <see langword="false""/>.</param>
/// from its attached target; otherswise <see langword="false"/>.</param>
/// <returns>A task that represents the asynchronous operation.</returns>
internal async Task StopSession(bool manualDetach)
{
Expand All @@ -314,6 +318,10 @@ internal async Task StopSession(bool manualDetach)
}
}

/// <summary>
/// Releases all resources associated with this <see cref="DevToolsSession"/>.
/// </summary>
/// <param name="disposing"><see langword="true"/> if the Dispose method was explicitly called; otherwise, <see langword="false"/>.</param>
protected void Dispose(bool disposing)
{
if (!this.isDisposed)
Expand Down
4 changes: 2 additions & 2 deletions dotnet/src/webdriver/DevTools/IDevToolsSession.cs
Expand Up @@ -64,9 +64,9 @@ Task<ICommandResponse<TCommand>> SendCommand<TCommand>(TCommand command, Cancell
/// <summary>
/// Sends the specified command and returns the associated command response.
/// </summary>
/// <typeparam name="TCommand"></typeparam>
/// <typeparam name="TCommandResponse"></typeparam>
/// <typeparam name="TCommand">A command object implementing the <see cref="ICommand"/> interface.</typeparam>
/// <typeparam name="TCommandResponse">A response object implementing the <see cref="ICommandResponse"/> interface.</typeparam>
/// <param name="command">The command to send.</param>
/// <param name="cancellationToken">A CancellationToken object to allow for cancellation of the command.</param>
/// <param name="millisecondsTimeout">The execution timeout of the command in milliseconds.</param>
/// <param name="throwExceptionIfResponseNotReceived"><see langword="true"/> to throw an exception if a response is not received; otherwise, <see langword="false"/>.</param>
Expand Down
8 changes: 8 additions & 0 deletions dotnet/src/webdriver/DevTools/Network.cs
Expand Up @@ -197,6 +197,14 @@ protected virtual void OnResponsePaused(ResponsePausedEventArgs e)
}
}

/// <returns>A task that represents the asynchronous operation.</returns>
/// <summary>
/// Am asynchrounous delegate for handling network events.
/// </summary>
/// <typeparam name="TEventArgs">The type of event args the event raises.</typeparam>
/// <param name="sender">The sender of the event.</param>
/// <param name="e">An object containing information about the event.</param>
/// <returns>A task that represents the asynchronous operation.</returns>
public delegate Task AsyncEventHandler<TEventArgs>(object sender, TEventArgs e);
}
}
4 changes: 4 additions & 0 deletions dotnet/src/webdriver/DevTools/v114/V114Domains.cs
Expand Up @@ -28,6 +28,10 @@ public class V114Domains : DevToolsDomains
{
private DevToolsSessionDomains domains;

/// <summary>
/// Initializes a new instance of the V114Domains class.
/// </summary>
/// <param name="session">The DevToolsSession to use with this set of domains.</param>
public V114Domains(DevToolsSession session)
{
this.domains = new DevToolsSessionDomains(session);
Expand Down
8 changes: 8 additions & 0 deletions dotnet/src/webdriver/DevTools/v114/V114Network.cs
Expand Up @@ -64,11 +64,19 @@ public override async Task EnableNetworkCaching()
await network.SetCacheDisabled(new SetCacheDisabledCommandSettings() { CacheDisabled = false });
}

/// <summary>
/// Asynchronously enables the Network domain..
/// </summary>
/// <returns>A task that represents the asynchronous operation.</returns>
public override async Task EnableNetwork()
{
await network.Enable(new Network.EnableCommandSettings());
}

/// <summary>
/// Asynchronously disables the Network domain..
/// </summary>
/// <returns>A task that represents the asynchronous operation.</returns>
public override async Task DisableNetwork()
{
await network.Disable();
Expand Down
3 changes: 1 addition & 2 deletions dotnet/src/webdriver/DevTools/v114/V114Target.cs
Expand Up @@ -97,8 +97,7 @@ public override async Task<string> AttachToTarget(string targetId)
/// </summary>
/// <param name="sessionId">The ID of the session of the target from which to detach.</param>
/// <param name="targetId">The ID of the target from which to detach.</param>
/// <returns>
/// A task representing the asynchronous detach operation.
/// <returns>A task representing the asynchronous detach operation.</returns>
public override async Task DetachFromTarget(string sessionId = null, string targetId = null)
{
await adapter.DetachFromTarget(new DetachFromTargetCommandSettings()
Expand Down
4 changes: 4 additions & 0 deletions dotnet/src/webdriver/DevTools/v115/V115Domains.cs
Expand Up @@ -28,6 +28,10 @@ public class V115Domains : DevToolsDomains
{
private DevToolsSessionDomains domains;

/// <summary>
/// Initializes a new instance of the V115Domains class.
/// </summary>
/// <param name="session">The DevToolsSession to use with this set of domains.</param>
public V115Domains(DevToolsSession session)
{
this.domains = new DevToolsSessionDomains(session);
Expand Down
8 changes: 8 additions & 0 deletions dotnet/src/webdriver/DevTools/v115/V115Network.cs
Expand Up @@ -64,11 +64,19 @@ public override async Task EnableNetworkCaching()
await network.SetCacheDisabled(new SetCacheDisabledCommandSettings() { CacheDisabled = false });
}

/// <summary>
/// Asynchronously enables the Network domain..
/// </summary>
/// <returns>A task that represents the asynchronous operation.</returns>
public override async Task EnableNetwork()
{
await network.Enable(new Network.EnableCommandSettings());
}

/// <summary>
/// Asynchronously disables the Network domain..
/// </summary>
/// <returns>A task that represents the asynchronous operation.</returns>
public override async Task DisableNetwork()
{
await network.Disable();
Expand Down
3 changes: 1 addition & 2 deletions dotnet/src/webdriver/DevTools/v115/V115Target.cs
Expand Up @@ -97,8 +97,7 @@ public override async Task<string> AttachToTarget(string targetId)
/// </summary>
/// <param name="sessionId">The ID of the session of the target from which to detach.</param>
/// <param name="targetId">The ID of the target from which to detach.</param>
/// <returns>
/// A task representing the asynchronous detach operation.
/// <returns>A task representing the asynchronous detach operation.</returns>
public override async Task DetachFromTarget(string sessionId = null, string targetId = null)
{
await adapter.DetachFromTarget(new DetachFromTargetCommandSettings()
Expand Down
4 changes: 4 additions & 0 deletions dotnet/src/webdriver/DevTools/v116/V116Domains.cs
Expand Up @@ -28,6 +28,10 @@ public class V116Domains : DevToolsDomains
{
private DevToolsSessionDomains domains;

/// <summary>
/// Initializes a new instance of the V115Domains class.
/// </summary>
/// <param name="session">The DevToolsSession to use with this set of domains.</param>
public V116Domains(DevToolsSession session)
{
this.domains = new DevToolsSessionDomains(session);
Expand Down
8 changes: 8 additions & 0 deletions dotnet/src/webdriver/DevTools/v116/V116Network.cs
Expand Up @@ -64,11 +64,19 @@ public override async Task EnableNetworkCaching()
await network.SetCacheDisabled(new SetCacheDisabledCommandSettings() { CacheDisabled = false });
}

/// <summary>
/// Asynchronously enables the Network domain..
/// </summary>
/// <returns>A task that represents the asynchronous operation.</returns>
public override async Task EnableNetwork()
{
await network.Enable(new Network.EnableCommandSettings());
}

/// <summary>
/// Asynchronously disables the Network domain..
/// </summary>
/// <returns>A task that represents the asynchronous operation.</returns>
public override async Task DisableNetwork()
{
await network.Disable();
Expand Down
3 changes: 1 addition & 2 deletions dotnet/src/webdriver/DevTools/v116/V116Target.cs
Expand Up @@ -97,8 +97,7 @@ public override async Task<string> AttachToTarget(string targetId)
/// </summary>
/// <param name="sessionId">The ID of the session of the target from which to detach.</param>
/// <param name="targetId">The ID of the target from which to detach.</param>
/// <returns>
/// A task representing the asynchronous detach operation.
/// <returns>A task representing the asynchronous detach operation.</returns>
public override async Task DetachFromTarget(string sessionId = null, string targetId = null)
{
await adapter.DetachFromTarget(new DetachFromTargetCommandSettings()
Expand Down
4 changes: 4 additions & 0 deletions dotnet/src/webdriver/DevTools/v85/V85Domains.cs
Expand Up @@ -28,6 +28,10 @@ public class V85Domains : DevToolsDomains
{
private DevToolsSessionDomains domains;

/// <summary>
/// Initializes a new instance of the V85Domains class.
/// </summary>
/// <param name="session">The DevToolsSession to use with this set of domains.</param>
public V85Domains(DevToolsSession session)
{
this.domains = new DevToolsSessionDomains(session);
Expand Down
2 changes: 1 addition & 1 deletion dotnet/src/webdriver/DevTools/v85/V85JavaScript.cs
Expand Up @@ -32,7 +32,7 @@ public class V85JavaScript : JavaScript
private PageAdapter page;

/// <summary>
/// Initializes a new instance of the <see cref="V86JavaScript"/> class.
/// Initializes a new instance of the <see cref="V85JavaScript"/> class.
/// </summary>
/// <param name="runtime">The DevTools Protocol adapter for the Runtime domain.</param>
/// <param name="page">The DevTools Protocol adapter for the Page domain.</param>
Expand Down
2 changes: 1 addition & 1 deletion dotnet/src/webdriver/DevTools/v85/V85Log.cs
Expand Up @@ -32,7 +32,7 @@ public class V85Log : DevTools.Log
private LogAdapter adapter;

/// <summary>
/// Initializes a new instance of the <see cref="V86Log"/> class.
/// Initializes a new instance of the <see cref="V85Log"/> class.
/// </summary>
/// <param name="adapter">The adapter for the Log domain.</param>
public V85Log(LogAdapter adapter)
Expand Down
8 changes: 8 additions & 0 deletions dotnet/src/webdriver/DevTools/v85/V85Network.cs
Expand Up @@ -64,11 +64,19 @@ public override async Task EnableNetworkCaching()
await network.SetCacheDisabled(new SetCacheDisabledCommandSettings() { CacheDisabled = false });
}

/// <summary>
/// Asynchronously ensables the Network domain..
/// </summary>
/// <returns>A task that represents the asynchronous operation.</returns>
public override async Task EnableNetwork()
{
await network.Enable(new Network.EnableCommandSettings());
}

/// <summary>
/// Asynchronously disables the Network domain..
/// </summary>
/// <returns>A task that represents the asynchronous operation.</returns>
public override async Task DisableNetwork()
{
await network.Disable();
Expand Down
5 changes: 2 additions & 3 deletions dotnet/src/webdriver/DevTools/v85/V85Target.cs
Expand Up @@ -33,7 +33,7 @@ public class V85Target : DevTools.Target
private TargetAdapter adapter;

/// <summary>
/// Initializes a new instance of the <see cref="V86Target"/> class.
/// Initializes a new instance of the <see cref="V85Target"/> class.
/// </summary>
/// <param name="adapter">The adapter for the Target domain.</param>
public V85Target(TargetAdapter adapter)
Expand Down Expand Up @@ -92,8 +92,7 @@ public override async Task<string> AttachToTarget(string targetId)
/// </summary>
/// <param name="sessionId">The ID of the session of the target from which to detach.</param>
/// <param name="targetId">The ID of the target from which to detach.</param>
/// <returns>
/// A task representing the asynchronous detach operation.
/// <returns>A task representing the asynchronous detach operation.</returns>
public override async Task DetachFromTarget(string sessionId = null, string targetId = null)
{
await adapter.DetachFromTarget(new DetachFromTargetCommandSettings()
Expand Down

0 comments on commit 1dcbcc2

Please sign in to comment.