Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
6 changes: 3 additions & 3 deletions dotnet/src/webdriver/BiDi/BiDi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,15 @@ public Task<ISubscription> SubscribeAsync<TEventArgs>(EventDescriptor<TEventArgs
return SubscribeAsync([descriptor], handler, cancellationToken);
}

public async Task<ISubscription> SubscribeAsync<TEventArgs>(IEnumerable<EventDescriptor> descriptors, Action<TEventArgs> handler, CancellationToken cancellationToken = default) where TEventArgs : EventArgs
public async Task<ISubscription> SubscribeAsync<TEventArgs>(ImmutableArray<EventDescriptor> descriptors, Action<TEventArgs> handler, CancellationToken cancellationToken = default) where TEventArgs : EventArgs
{
ArgumentNullException.ThrowIfNull(descriptors);
ArgumentNullException.ThrowIfNull(handler);

return await EventDispatcher.SubscribeAsync<TEventArgs>(descriptors, e => { handler(e); return default; }, cancellationToken: cancellationToken).ConfigureAwait(false);
}

public async Task<ISubscription> SubscribeAsync<TEventArgs>(IEnumerable<EventDescriptor> descriptors, Func<TEventArgs, Task> handler, CancellationToken cancellationToken = default) where TEventArgs : EventArgs
public async Task<ISubscription> SubscribeAsync<TEventArgs>(ImmutableArray<EventDescriptor> descriptors, Func<TEventArgs, Task> handler, CancellationToken cancellationToken = default) where TEventArgs : EventArgs
{
ArgumentNullException.ThrowIfNull(descriptors);
ArgumentNullException.ThrowIfNull(handler);
Expand All @@ -124,7 +124,7 @@ public Task<IEventStream<TEventArgs>> StreamAsync<TEventArgs>(EventDescriptor<TE
return StreamAsync<TEventArgs>([descriptor], cancellationToken);
}

public async Task<IEventStream<TEventArgs>> StreamAsync<TEventArgs>(IEnumerable<EventDescriptor> descriptors, CancellationToken cancellationToken = default) where TEventArgs : EventArgs
public async Task<IEventStream<TEventArgs>> StreamAsync<TEventArgs>(ImmutableArray<EventDescriptor> descriptors, CancellationToken cancellationToken = default) where TEventArgs : EventArgs
{
ArgumentNullException.ThrowIfNull(descriptors);

Expand Down
2 changes: 1 addition & 1 deletion dotnet/src/webdriver/BiDi/Browser/GetClientWindows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ namespace OpenQA.Selenium.BiDi.Browser;

public sealed record GetClientWindowsOptions : CommandOptions;

public sealed record GetClientWindowsResult(IReadOnlyList<ClientWindowInfo> ClientWindows) : EmptyResult;
public sealed record GetClientWindowsResult(ImmutableArray<ClientWindowInfo> ClientWindows) : EmptyResult;
2 changes: 1 addition & 1 deletion dotnet/src/webdriver/BiDi/Browser/GetUserContexts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ namespace OpenQA.Selenium.BiDi.Browser;

public record GetUserContextsOptions : CommandOptions;

public sealed record GetUserContextsResult(IReadOnlyList<UserContextInfo> UserContexts) : EmptyResult;
public sealed record GetUserContextsResult(ImmutableArray<UserContextInfo> UserContexts) : EmptyResult;
4 changes: 2 additions & 2 deletions dotnet/src/webdriver/BiDi/Browser/SetDownloadBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

namespace OpenQA.Selenium.BiDi.Browser;

internal sealed record SetDownloadBehaviorParameters([property: JsonIgnore(Condition = JsonIgnoreCondition.Never)] DownloadBehavior? DownloadBehavior, IEnumerable<UserContext>? UserContexts) : Parameters;
internal sealed record SetDownloadBehaviorParameters([property: JsonIgnore(Condition = JsonIgnoreCondition.Never)] DownloadBehavior? DownloadBehavior, ImmutableArray<UserContext>? UserContexts) : Parameters;

[JsonPolymorphic(TypeDiscriminatorPropertyName = "type")]
[JsonDerivedType(typeof(DownloadBehaviorAllowed), "allowed")]
Expand All @@ -37,7 +37,7 @@ public sealed record DownloadBehaviorDenied : DownloadBehavior;

public sealed record SetDownloadBehaviorOptions : CommandOptions
{
public IEnumerable<UserContext>? UserContexts { get; init; }
public ImmutableArray<UserContext>? UserContexts { get; init; }
}

public sealed record SetDownloadBehaviorResult : EmptyResult;
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace OpenQA.Selenium.BiDi.BrowsingContext;

internal sealed class BrowsingContextInputModule(BrowsingContext context, IInputModule inputModule, EventDispatcher dispatcher) : IBrowsingContextInputModule
{
public Task<PerformActionsResult> PerformActionsAsync(IEnumerable<SourceActions> actions, PerformActionsOptions? options = null, CancellationToken cancellationToken = default)
public Task<PerformActionsResult> PerformActionsAsync(ImmutableArray<SourceActions> actions, PerformActionsOptions? options = null, CancellationToken cancellationToken = default)
{
return inputModule.PerformActionsAsync(context, actions, options, cancellationToken);
}
Expand All @@ -33,7 +33,7 @@ public Task<ReleaseActionsResult> ReleaseActionsAsync(ReleaseActionsOptions? opt
return inputModule.ReleaseActionsAsync(context, options, cancellationToken);
}

public Task<SetFilesResult> SetFilesAsync(Script.ISharedReference element, IEnumerable<string> files, SetFilesOptions? options = null, CancellationToken cancellationToken = default)
public Task<SetFilesResult> SetFilesAsync(Script.ISharedReference element, ImmutableArray<string> files, SetFilesOptions? options = null, CancellationToken cancellationToken = default)
{
return inputModule.SetFilesAsync(context, element, files, options, cancellationToken);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace OpenQA.Selenium.BiDi.BrowsingContext;

internal sealed class BrowsingContextNetworkModule(BrowsingContext context, INetworkModule networkModule, EventDispatcher dispatcher) : IBrowsingContextNetworkModule
{
public Task<AddDataCollectorResult> AddDataCollectorAsync(IEnumerable<DataType> dataTypes, int maxEncodedDataSize, ContextAddDataCollectorOptions? options = null, CancellationToken cancellationToken = default)
public Task<AddDataCollectorResult> AddDataCollectorAsync(ImmutableArray<DataType> dataTypes, int maxEncodedDataSize, ContextAddDataCollectorOptions? options = null, CancellationToken cancellationToken = default)
{
return networkModule.AddDataCollectorAsync(dataTypes, maxEncodedDataSize, ContextAddDataCollectorOptions.WithContext(options, context), cancellationToken);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace OpenQA.Selenium.BiDi.BrowsingContext;

public sealed record ContextCreatedEventArgs(
IBiDi BiDi,
IReadOnlyList<Info>? Children,
ImmutableArray<Info>? Children,
Browser.ClientWindow ClientWindow,
BrowsingContext Context,
BrowsingContext? OriginalOpener,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

namespace OpenQA.Selenium.BiDi.BrowsingContext;

public sealed record ContextDestroyedEventArgs(IBiDi BiDi, IReadOnlyList<Info>? Children,
public sealed record ContextDestroyedEventArgs(IBiDi BiDi, ImmutableArray<Info>? Children,
Browser.ClientWindow ClientWindow,
BrowsingContext Context,
BrowsingContext? OriginalOpener,
Expand Down
2 changes: 1 addition & 1 deletion dotnet/src/webdriver/BiDi/BrowsingContext/GetTree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ public sealed record ContextGetTreeOptions : CommandOptions
};
}

public sealed record GetTreeResult(IReadOnlyList<Info> Contexts) : EmptyResult;
public sealed record GetTreeResult(ImmutableArray<Info> Contexts) : EmptyResult;
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace OpenQA.Selenium.BiDi.BrowsingContext;
public interface IBrowsingContextInputModule
{
IEventSource<FileDialogOpenedEventArgs> FileDialogOpened { get; }
Task<PerformActionsResult> PerformActionsAsync(IEnumerable<SourceActions> actions, PerformActionsOptions? options = null, CancellationToken cancellationToken = default);
Task<PerformActionsResult> PerformActionsAsync(ImmutableArray<SourceActions> actions, PerformActionsOptions? options = null, CancellationToken cancellationToken = default);
Task<ReleaseActionsResult> ReleaseActionsAsync(ReleaseActionsOptions? options = null, CancellationToken cancellationToken = default);
Task<SetFilesResult> SetFilesAsync(Script.ISharedReference element, IEnumerable<string> files, SetFilesOptions? options = null, CancellationToken cancellationToken = default);
Task<SetFilesResult> SetFilesAsync(Script.ISharedReference element, ImmutableArray<string> files, SetFilesOptions? options = null, CancellationToken cancellationToken = default);
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace OpenQA.Selenium.BiDi.BrowsingContext;

public interface IBrowsingContextNetworkModule
{
Task<AddDataCollectorResult> AddDataCollectorAsync(IEnumerable<DataType> dataTypes, int maxEncodedDataSize, ContextAddDataCollectorOptions? options = null, CancellationToken cancellationToken = default);
Task<AddDataCollectorResult> AddDataCollectorAsync(ImmutableArray<DataType> dataTypes, int maxEncodedDataSize, ContextAddDataCollectorOptions? options = null, CancellationToken cancellationToken = default);
IEventSource<AuthRequiredEventArgs> AuthRequired { get; }
IEventSource<BeforeRequestSentEventArgs> BeforeRequestSent { get; }
IEventSource<FetchErrorEventArgs> FetchError { get; }
Expand Down
2 changes: 1 addition & 1 deletion dotnet/src/webdriver/BiDi/BrowsingContext/Info.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
namespace OpenQA.Selenium.BiDi.BrowsingContext;

public sealed record Info(
IReadOnlyList<Info>? Children,
ImmutableArray<Info>? Children,
Browser.ClientWindow ClientWindow,
BrowsingContext Context,
BrowsingContext? OriginalOpener,
Expand Down
6 changes: 3 additions & 3 deletions dotnet/src/webdriver/BiDi/BrowsingContext/LocateNodes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@

namespace OpenQA.Selenium.BiDi.BrowsingContext;

internal sealed record LocateNodesParameters(BrowsingContext Context, Locator Locator, long? MaxNodeCount, Script.SerializationOptions? SerializationOptions, IEnumerable<Script.ISharedReference>? StartNodes) : Parameters;
internal sealed record LocateNodesParameters(BrowsingContext Context, Locator Locator, long? MaxNodeCount, Script.SerializationOptions? SerializationOptions, ImmutableArray<Script.ISharedReference>? StartNodes) : Parameters;

public sealed record LocateNodesOptions : CommandOptions
{
public long? MaxNodeCount { get; init; }

public Script.SerializationOptions? SerializationOptions { get; init; }

public IEnumerable<Script.ISharedReference>? StartNodes { get; init; }
public ImmutableArray<Script.ISharedReference>? StartNodes { get; init; }
}

public sealed record LocateNodesResult(IReadOnlyList<Script.NodeRemoteValue> Nodes) : EmptyResult;
public sealed record LocateNodesResult(ImmutableArray<Script.NodeRemoteValue> Nodes) : EmptyResult;
4 changes: 2 additions & 2 deletions dotnet/src/webdriver/BiDi/BrowsingContext/Print.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

namespace OpenQA.Selenium.BiDi.BrowsingContext;

internal sealed record PrintParameters(BrowsingContext Context, bool? Background, PrintMargin? Margin, PrintOrientation? Orientation, PrintPage? Page, IEnumerable<PrintPageRange>? PageRanges, double? Scale, bool? ShrinkToFit) : Parameters;
internal sealed record PrintParameters(BrowsingContext Context, bool? Background, PrintMargin? Margin, PrintOrientation? Orientation, PrintPage? Page, ImmutableArray<PrintPageRange>? PageRanges, double? Scale, bool? ShrinkToFit) : Parameters;

public sealed record PrintOptions : CommandOptions
{
Expand All @@ -34,7 +34,7 @@ public sealed record PrintOptions : CommandOptions

public PrintPage? Page { get; init; }

public IEnumerable<PrintPageRange>? PageRanges { get; init; }
public ImmutableArray<PrintPageRange>? PageRanges { get; init; }

public double? Scale { get; init; }

Expand Down
4 changes: 2 additions & 2 deletions dotnet/src/webdriver/BiDi/BrowsingContext/SetViewport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ internal sealed record SetViewportParameters(
BrowsingContext? Context,
[property: JsonConverter(typeof(OptionalConverter<Viewport?>))] Optional<Viewport?>? Viewport,
[property: JsonConverter(typeof(OptionalConverter<double?>))] Optional<double?>? DevicePixelRatio,
IEnumerable<Browser.UserContext>? UserContexts)
ImmutableArray<Browser.UserContext>? UserContexts)
: Parameters;

public sealed record SetViewportOptions : CommandOptions
Expand All @@ -37,7 +37,7 @@ public sealed record SetViewportOptions : CommandOptions

public Optional<double?>? DevicePixelRatio { get; init; }

public IEnumerable<Browser.UserContext>? UserContexts { get; init; }
public ImmutableArray<Browser.UserContext>? UserContexts { get; init; }
}

public sealed record ContextSetViewportOptions : CommandOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@

namespace OpenQA.Selenium.BiDi.Emulation;

internal sealed record SetForcedColorsModeThemeOverrideParameters([property: JsonIgnore(Condition = JsonIgnoreCondition.Never)] ForcedColorsModeTheme? Theme, IEnumerable<BrowsingContext.BrowsingContext>? Contexts, IEnumerable<Browser.UserContext>? UserContexts) : Parameters;
internal sealed record SetForcedColorsModeThemeOverrideParameters([property: JsonIgnore(Condition = JsonIgnoreCondition.Never)] ForcedColorsModeTheme? Theme, ImmutableArray<BrowsingContext.BrowsingContext>? Contexts, ImmutableArray<Browser.UserContext>? UserContexts) : Parameters;

public sealed record SetForcedColorsModeThemeOverrideOptions : CommandOptions
{
public IEnumerable<BrowsingContext.BrowsingContext>? Contexts { get; init; }
public ImmutableArray<BrowsingContext.BrowsingContext>? Contexts { get; init; }

public IEnumerable<Browser.UserContext>? UserContexts { get; init; }
public ImmutableArray<Browser.UserContext>? UserContexts { get; init; }
}

[JsonConverter(typeof(CamelCaseEnumConverter<ForcedColorsModeTheme>))]
Expand Down
10 changes: 5 additions & 5 deletions dotnet/src/webdriver/BiDi/Emulation/SetGeolocationOverride.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ public sealed record GeolocationPositionErrorOverride : GeolocationOverride;

[JsonDerivedType(typeof(SetGeolocationOverrideCoordinatesParameters))]
[JsonDerivedType(typeof(SetGeolocationOverridePositionErrorParameters))]
internal abstract record SetGeolocationOverrideParameters(IEnumerable<BrowsingContext.BrowsingContext>? Contexts, IEnumerable<Browser.UserContext>? UserContexts) : Parameters;
internal abstract record SetGeolocationOverrideParameters(ImmutableArray<BrowsingContext.BrowsingContext>? Contexts, ImmutableArray<Browser.UserContext>? UserContexts) : Parameters;

internal sealed record SetGeolocationOverrideCoordinatesParameters([property: JsonIgnore(Condition = JsonIgnoreCondition.Never)] GeolocationCoordinates? Coordinates, IEnumerable<BrowsingContext.BrowsingContext>? Contexts, IEnumerable<Browser.UserContext>? UserContexts) : SetGeolocationOverrideParameters(Contexts, UserContexts);
internal sealed record SetGeolocationOverrideCoordinatesParameters([property: JsonIgnore(Condition = JsonIgnoreCondition.Never)] GeolocationCoordinates? Coordinates, ImmutableArray<BrowsingContext.BrowsingContext>? Contexts, ImmutableArray<Browser.UserContext>? UserContexts) : SetGeolocationOverrideParameters(Contexts, UserContexts);

internal sealed record SetGeolocationOverridePositionErrorParameters(GeolocationPositionError Error, IEnumerable<BrowsingContext.BrowsingContext>? Contexts, IEnumerable<Browser.UserContext>? UserContexts) : SetGeolocationOverrideParameters(Contexts, UserContexts);
internal sealed record SetGeolocationOverridePositionErrorParameters(GeolocationPositionError Error, ImmutableArray<BrowsingContext.BrowsingContext>? Contexts, ImmutableArray<Browser.UserContext>? UserContexts) : SetGeolocationOverrideParameters(Contexts, UserContexts);

internal sealed record GeolocationCoordinates(double Latitude, double Longitude, double? Accuracy, double? Altitude, double? AltitudeAccuracy, double? Heading, double? Speed);

Expand All @@ -52,9 +52,9 @@ internal sealed record GeolocationPositionError

public sealed record SetGeolocationOverrideOptions : CommandOptions
{
public IEnumerable<BrowsingContext.BrowsingContext>? Contexts { get; init; }
public ImmutableArray<BrowsingContext.BrowsingContext>? Contexts { get; init; }

public IEnumerable<Browser.UserContext>? UserContexts { get; init; }
public ImmutableArray<Browser.UserContext>? UserContexts { get; init; }
}

public sealed record SetGeolocationOverrideResult : EmptyResult;
6 changes: 3 additions & 3 deletions dotnet/src/webdriver/BiDi/Emulation/SetLocaleOverride.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@

namespace OpenQA.Selenium.BiDi.Emulation;

internal sealed record SetLocaleOverrideParameters([property: JsonIgnore(Condition = JsonIgnoreCondition.Never)] string? Locale, IEnumerable<BrowsingContext.BrowsingContext>? Contexts, IEnumerable<Browser.UserContext>? UserContexts) : Parameters;
internal sealed record SetLocaleOverrideParameters([property: JsonIgnore(Condition = JsonIgnoreCondition.Never)] string? Locale, ImmutableArray<BrowsingContext.BrowsingContext>? Contexts, ImmutableArray<Browser.UserContext>? UserContexts) : Parameters;

public sealed record SetLocaleOverrideOptions : CommandOptions
{
public IEnumerable<BrowsingContext.BrowsingContext>? Contexts { get; init; }
public ImmutableArray<BrowsingContext.BrowsingContext>? Contexts { get; init; }

public IEnumerable<Browser.UserContext>? UserContexts { get; init; }
public ImmutableArray<Browser.UserContext>? UserContexts { get; init; }
}

public sealed record SetLocaleOverrideResult : EmptyResult;
6 changes: 3 additions & 3 deletions dotnet/src/webdriver/BiDi/Emulation/SetNetworkConditions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

namespace OpenQA.Selenium.BiDi.Emulation;

internal sealed record SetNetworkConditionsParameters([property: JsonIgnore(Condition = JsonIgnoreCondition.Never)] NetworkConditions? NetworkConditions, IEnumerable<BrowsingContext.BrowsingContext>? Contexts, IEnumerable<Browser.UserContext>? UserContexts) : Parameters;
internal sealed record SetNetworkConditionsParameters([property: JsonIgnore(Condition = JsonIgnoreCondition.Never)] NetworkConditions? NetworkConditions, ImmutableArray<BrowsingContext.BrowsingContext>? Contexts, ImmutableArray<Browser.UserContext>? UserContexts) : Parameters;

[JsonPolymorphic(TypeDiscriminatorPropertyName = "type")]
[JsonDerivedType(typeof(NetworkConditionsOffline), "offline")]
Expand All @@ -31,9 +31,9 @@ public sealed record NetworkConditionsOffline : NetworkConditions;

public sealed record SetNetworkConditionsOptions : CommandOptions
{
public IEnumerable<BrowsingContext.BrowsingContext>? Contexts { get; init; }
public ImmutableArray<BrowsingContext.BrowsingContext>? Contexts { get; init; }

public IEnumerable<Browser.UserContext>? UserContexts { get; init; }
public ImmutableArray<Browser.UserContext>? UserContexts { get; init; }
}

public sealed record SetNetworkConditionsResult : EmptyResult;
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@

namespace OpenQA.Selenium.BiDi.Emulation;

internal sealed record SetScreenOrientationOverrideParameters([property: JsonIgnore(Condition = JsonIgnoreCondition.Never)] ScreenOrientation? ScreenOrientation, IEnumerable<BrowsingContext.BrowsingContext>? Contexts, IEnumerable<Browser.UserContext>? UserContexts) : Parameters;
internal sealed record SetScreenOrientationOverrideParameters([property: JsonIgnore(Condition = JsonIgnoreCondition.Never)] ScreenOrientation? ScreenOrientation, ImmutableArray<BrowsingContext.BrowsingContext>? Contexts, ImmutableArray<Browser.UserContext>? UserContexts) : Parameters;

public sealed record SetScreenOrientationOverrideOptions : CommandOptions
{
public IEnumerable<BrowsingContext.BrowsingContext>? Contexts { get; init; }
public ImmutableArray<BrowsingContext.BrowsingContext>? Contexts { get; init; }

public IEnumerable<Browser.UserContext>? UserContexts { get; init; }
public ImmutableArray<Browser.UserContext>? UserContexts { get; init; }
}

[JsonConverter(typeof(CamelCaseEnumConverter<ScreenOrientationNatural>))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@

namespace OpenQA.Selenium.BiDi.Emulation;

internal sealed record SetScreenSettingsOverrideParameters([property: JsonIgnore(Condition = JsonIgnoreCondition.Never)] ScreenArea? ScreenArea, IEnumerable<BrowsingContext.BrowsingContext>? Contexts, IEnumerable<Browser.UserContext>? UserContexts) : Parameters;
internal sealed record SetScreenSettingsOverrideParameters([property: JsonIgnore(Condition = JsonIgnoreCondition.Never)] ScreenArea? ScreenArea, ImmutableArray<BrowsingContext.BrowsingContext>? Contexts, ImmutableArray<Browser.UserContext>? UserContexts) : Parameters;

public sealed record SetScreenSettingsOverrideOptions : CommandOptions
{
public IEnumerable<BrowsingContext.BrowsingContext>? Contexts { get; init; }
public ImmutableArray<BrowsingContext.BrowsingContext>? Contexts { get; init; }

public IEnumerable<Browser.UserContext>? UserContexts { get; init; }
public ImmutableArray<Browser.UserContext>? UserContexts { get; init; }
}

public sealed record ScreenArea(long Width, long Height);
Expand Down
Loading
Loading