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] Change a list of downloadable files to IReadOnlyList #13265

Merged
merged 2 commits into from
Dec 7, 2023
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
4 changes: 2 additions & 2 deletions dotnet/src/webdriver/IHasDownloads.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public interface IHasDownloads
/// <summary>
/// Retrieves the downloadable files.
/// </summary>
/// <returns>A list of file names available for download.</returns>
List<string> GetDownloadableFiles();
/// <returns>A read-only list of file names available for download.</returns>
IReadOnlyList<string> GetDownloadableFiles();

/// <summary>
/// Downloads a file with the specified file name and returns a dictionary containing the downloaded file's data.
Expand Down
6 changes: 3 additions & 3 deletions dotnet/src/webdriver/Remote/RemoteWebDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -471,10 +471,10 @@ public DevToolsSession GetDevToolsSession(int protocolVersion)
}

/// <summary>
/// Retrieves the downloadable files as a map of file names and their corresponding URLs.
/// Retrieves the downloadable files.
/// </summary>
/// <returns>A list containing file names as keys and URLs as values.</returns>
public List<string> GetDownloadableFiles()
/// <returns>A read-only list of file names available for download.</returns>
public IReadOnlyList<string> GetDownloadableFiles()
{
var enableDownloads = this.Capabilities.GetCapability(CapabilityType.EnableDownloads);
if (enableDownloads == null || !(bool) enableDownloads) {
Expand Down
6 changes: 3 additions & 3 deletions dotnet/test/common/DownloadsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void CanListDownloadableFiles()
{
DownloadWithBrowser();

List<string> names = ((RemoteWebDriver) driver).GetDownloadableFiles();
IReadOnlyList<string> names = ((RemoteWebDriver) driver).GetDownloadableFiles();
Assert.That(names, Contains.Item("file_1.txt"));
Assert.That(names, Contains.Item("file_2.jpg"));
}
Expand All @@ -52,7 +52,7 @@ public void CanDownloadFile()
{
DownloadWithBrowser();

List<string> names = ((RemoteWebDriver) driver).GetDownloadableFiles();
IReadOnlyList<string> names = ((RemoteWebDriver) driver).GetDownloadableFiles();
string fileName = names[0];
string targetDirectory = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());

Expand All @@ -72,7 +72,7 @@ public void CanDeleteFiles()

((RemoteWebDriver)driver).DeleteDownloadableFiles();

List<string> names = ((RemoteWebDriver) driver).GetDownloadableFiles();
IReadOnlyList<string> names = ((RemoteWebDriver) driver).GetDownloadableFiles();
Assert.IsEmpty(names, "The names list should be empty.");
}

Expand Down