Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dotnet] Annotate nullability on firefox and chromium options #15206

Merged
merged 2 commits into from
Feb 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions dotnet/src/webdriver/Chrome/ChromeOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
using System;
using System.Globalization;

#nullable enable

namespace OpenQA.Selenium.Chrome
{
/// <summary>
Expand Down Expand Up @@ -64,19 +66,13 @@ public ChromeOptions() : base()
/// <summary>
/// Gets the vendor prefix to apply to Chromium-specific capability names.
/// </summary>
protected override string VendorPrefix
{
get { return "goog"; }
}
protected override string VendorPrefix => "goog";

/// <summary>
/// Gets the name of the capability used to store Chromium options in
/// an <see cref="ICapabilities"/> object.
/// </summary>
public override string CapabilityName
{
get { return string.Format(CultureInfo.InvariantCulture, "{0}:{1}", this.VendorPrefix, ChromeOptionsCapabilityName); }
}
public override string CapabilityName => string.Format(CultureInfo.InvariantCulture, "{0}:{1}", this.VendorPrefix, ChromeOptionsCapabilityName);

/// <summary>
/// Provides a means to add additional capabilities not yet added as type safe options
Expand All @@ -92,7 +88,7 @@ public override string CapabilityName
/// where <paramref name="optionName"/> has already been added will overwrite the
/// existing value with the new value in <paramref name="optionValue"/>.
/// Calling this method adds capabilities to the Chrome-specific options object passed to
/// webdriver executable (property name 'goog:chromeOptions').</remarks>
/// WebDriver executable (property name 'goog:chromeOptions').</remarks>
public void AddAdditionalChromeOption(string optionName, object optionValue)
{
this.AddAdditionalChromiumOption(optionName, optionValue);
Expand Down
18 changes: 7 additions & 11 deletions dotnet/src/webdriver/Edge/EdgeOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
using System;
using System.Globalization;

#nullable enable

namespace OpenQA.Selenium.Edge
{
/// <summary>
Expand Down Expand Up @@ -60,27 +62,21 @@ public EdgeOptions() : base()
/// <summary>
/// Gets the vendor prefix to apply to Chromium-specific capability names.
/// </summary>
protected override string VendorPrefix
{
get { return "ms"; }
}
protected override string VendorPrefix => "ms";

/// <summary>
/// Gets the name of the capability used to store Chromium options in
/// an <see cref="ICapabilities"/> object.
/// </summary>
public override string CapabilityName
{
get { return string.Format(CultureInfo.InvariantCulture, "{0}:{1}", this.VendorPrefix, EdgeOptionsCapabilityName); }
}
public override string CapabilityName => string.Format(CultureInfo.InvariantCulture, "{0}:{1}", this.VendorPrefix, EdgeOptionsCapabilityName);

/// <summary>
/// Gets or sets whether to create a WebView session used for launching an Edge (Chromium) WebView-based app on desktop.
/// </summary>
public bool UseWebView
{
get { return this.BrowserName == WebViewBrowserNameValue; }
set { this.BrowserName = value ? WebViewBrowserNameValue : DefaultBrowserNameValue; }
get => this.BrowserName == WebViewBrowserNameValue;
set => this.BrowserName = value ? WebViewBrowserNameValue : DefaultBrowserNameValue;
}

/// <summary>
Expand All @@ -97,7 +93,7 @@ public bool UseWebView
/// where <paramref name="optionName"/> has already been added will overwrite the
/// existing value with the new value in <paramref name="optionValue"/>.
/// Calling this method adds capabilities to the Edge-specific options object passed to
/// webdriver executable (property name 'ms:edgeOptions').</remarks>
/// WebDriver executable (property name 'ms:edgeOptions').</remarks>
public void AddAdditionalEdgeOption(string optionName, object optionValue)
{
this.AddAdditionalChromiumOption(optionName, optionValue);
Expand Down
11 changes: 6 additions & 5 deletions dotnet/src/webdriver/Firefox/FirefoxAndroidOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,20 @@
// </copyright>

using OpenQA.Selenium.Internal;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;

#nullable enable

namespace OpenQA.Selenium.Firefox
{
/// <summary>
/// Generates the capabilities for automating Firefox applications on Android
/// </summary>
public class FirefoxAndroidOptions : AndroidOptions
{
private List<string> androidIntentArguments = new List<string>();
private readonly List<string> androidIntentArguments = new List<string>();

/// <summary>
/// Initializes a new instance of the <see cref="FirefoxAndroidOptions"/> class.
Expand All @@ -41,10 +44,7 @@ public FirefoxAndroidOptions(string androidPackage) : base(androidPackage)
/// <summary>
/// Gets a read-only list of the intent arguments set for this set of options.
/// </summary>
public ReadOnlyCollection<string> AndroidIntentArguments
{
get { return this.androidIntentArguments.AsReadOnly(); }
}
public ReadOnlyCollection<string> AndroidIntentArguments => this.androidIntentArguments.AsReadOnly();

/// <summary>
/// Argument to launch the intent with. The given intent arguments are appended to the "am start" command.
Expand All @@ -59,6 +59,7 @@ public void AddIntentArgument(string argument)
/// Arguments to launch the intent with. The given intent arguments are appended to the "am start" command.
/// </summary>
/// <param name="arguments">The arguments to add.</param>
/// <exception cref="ArgumentNullException">If <paramref name="arguments"/> is <see langword="null"/>.</exception>
public void AddIntentArguments(params string[] arguments)
{
this.androidIntentArguments.AddRange(arguments);
Expand Down
2 changes: 2 additions & 0 deletions dotnet/src/webdriver/Firefox/FirefoxCommandContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
// under the License.
// </copyright>

#nullable enable

namespace OpenQA.Selenium.Firefox
{
/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions dotnet/src/webdriver/Firefox/FirefoxDriverLogLevel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
// under the License.
// </copyright>

#nullable enable

namespace OpenQA.Selenium.Firefox
{
/// <summary>
Expand Down
Loading