Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
20 changes: 2 additions & 18 deletions dotnet/src/webdriver/BiDi/Communication/Broker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,14 @@ internal Broker(BiDi bidi, Uri url)
Converters =
{
new BrowsingContextConverter(_bidi),
new BrowserUserContextConverter(bidi),
new BrowserClientWindowConverter(),
new NavigationConverter(),
new BrowserUserContextConverter(_bidi),
new InterceptConverter(_bidi),
new RequestConverter(_bidi),
new ChannelConverter(),
new HandleConverter(_bidi),
new InternalIdConverter(_bidi),
new PreloadScriptConverter(_bidi),
new RealmConverter(_bidi),
new RealmTypeConverter(),
new DateTimeOffsetConverter(),
new PrintPageRangeConverter(),
new InputOriginConverter(),
new SubscriptionConverter(),
new BiDiDateTimeOffsetConverter(),
new JsonStringEnumConverter(JsonNamingPolicy.CamelCase),

// https://github.com/dotnet/runtime/issues/72604
Expand All @@ -90,15 +83,6 @@ internal Broker(BiDi bidi, Uri url)
new Json.Converters.Polymorphic.RemoteValueConverter(),
new Json.Converters.Polymorphic.RealmInfoConverter(),
new Json.Converters.Polymorphic.LogEntryConverter(),
//

// Enumerable
new Json.Converters.Enumerable.GetCookiesResultConverter(),
new Json.Converters.Enumerable.LocateNodesResultConverter(),
new Json.Converters.Enumerable.InputSourceActionsConverter(),
new Json.Converters.Enumerable.GetUserContextsResultConverter(),
new Json.Converters.Enumerable.GetClientWindowsResultConverter(),
new Json.Converters.Enumerable.GetRealmsResultConverter(),
}
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <copyright file="DateTimeOffsetConverter.cs" company="Selenium Committers">
// <copyright file="BiDiDateTimeOffsetConverter.cs" company="Selenium Committers">
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
Expand All @@ -23,7 +23,7 @@

namespace OpenQA.Selenium.BiDi.Communication.Json.Converters;

internal class DateTimeOffsetConverter : JsonConverter<DateTimeOffset>
internal class BiDiDateTimeOffsetConverter : JsonConverter<DateTimeOffset>
{
public override DateTimeOffset Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ public override GetClientWindowsResult Read(ref Utf8JsonReader reader, Type type

public override void Write(Utf8JsonWriter writer, GetClientWindowsResult value, JsonSerializerOptions options)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ public override GetCookiesResult Read(ref Utf8JsonReader reader, Type typeToConv

public override void Write(Utf8JsonWriter writer, GetCookiesResult value, JsonSerializerOptions options)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ public override GetRealmsResult Read(ref Utf8JsonReader reader, Type typeToConve

public override void Write(Utf8JsonWriter writer, GetRealmsResult value, JsonSerializerOptions options)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ public override GetUserContextsResult Read(ref Utf8JsonReader reader, Type typeT

public override void Write(Utf8JsonWriter writer, GetUserContextsResult value, JsonSerializerOptions options)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ internal class InputSourceActionsConverter : JsonConverter<SourceActions>
{
public override SourceActions Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
throw new NotImplementedException();
throw new NotSupportedException();
}

public override void Write(Utf8JsonWriter writer, SourceActions value, JsonSerializerOptions options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ public override LocateNodesResult Read(ref Utf8JsonReader reader, Type typeToCon

public override void Write(Utf8JsonWriter writer, LocateNodesResult value, JsonSerializerOptions options)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ internal class InputOriginConverter : JsonConverter<Origin>
{
public override Origin Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
throw new NotImplementedException();
throw new NotSupportedException();
}

public override void Write(Utf8JsonWriter writer, Origin value, JsonSerializerOptions options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ internal class PrintPageRangeConverter : JsonConverter<PrintPageRange>
{
public override PrintPageRange Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
throw new NotImplementedException();
throw new NotSupportedException();
}

public override void Write(Utf8JsonWriter writer, PrintPageRange value, JsonSerializerOptions options)
Expand Down
4 changes: 4 additions & 0 deletions dotnet/src/webdriver/BiDi/Modules/Browser/ClientWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@
// under the License.
// </copyright>

using OpenQA.Selenium.BiDi.Communication.Json.Converters;
using System.Text.Json.Serialization;

namespace OpenQA.Selenium.BiDi.Modules.Browser;

[JsonConverter(typeof(BrowserClientWindowConverter))]
public record ClientWindow
{
internal ClientWindow(string id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
// </copyright>

using OpenQA.Selenium.BiDi.Communication;
using OpenQA.Selenium.BiDi.Communication.Json.Converters.Enumerable;
using System.Collections;
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace OpenQA.Selenium.BiDi.Modules.Browser;

Expand All @@ -28,6 +30,7 @@ internal class GetClientWindowsCommand()

public record GetClientWindowsOptions : CommandOptions;

[JsonConverter(typeof(GetClientWindowsResultConverter))]
public record GetClientWindowsResult : IReadOnlyList<ClientWindowInfo>
{
private readonly IReadOnlyList<ClientWindowInfo> _clientWindows;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
// </copyright>

using OpenQA.Selenium.BiDi.Communication;
using OpenQA.Selenium.BiDi.Communication.Json.Converters.Enumerable;
using System.Collections;
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace OpenQA.Selenium.BiDi.Modules.Browser;

Expand All @@ -28,6 +30,7 @@ internal class GetUserContextsCommand()

public record GetUserContextsOptions : CommandOptions;

[JsonConverter(typeof(GetUserContextsResultConverter))]
public record GetUserContextsResult : IReadOnlyList<UserContextInfo>
{
private readonly IReadOnlyList<UserContextInfo> _userContexts;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
// </copyright>

using OpenQA.Selenium.BiDi.Communication;
using OpenQA.Selenium.BiDi.Communication.Json.Converters.Enumerable;
using System.Collections;
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace OpenQA.Selenium.BiDi.Modules.BrowsingContext;

Expand All @@ -37,6 +39,7 @@ public record LocateNodesOptions : CommandOptions
public IEnumerable<Script.ISharedReference>? StartNodes { get; set; }
}

[JsonConverter(typeof(LocateNodesResultConverter))]
public record LocateNodesResult : IReadOnlyList<Script.RemoteValue.Node>
{
private readonly IReadOnlyList<Script.RemoteValue.Node> _nodes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
// under the License.
// </copyright>

using OpenQA.Selenium.BiDi.Communication.Json.Converters;
using System.Text.Json.Serialization;

namespace OpenQA.Selenium.BiDi.Modules.BrowsingContext;

[JsonConverter(typeof(NavigationConverter))]
public record Navigation(string Id);
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
// </copyright>

using OpenQA.Selenium.BiDi.Communication;
using OpenQA.Selenium.BiDi.Communication.Json.Converters;
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace OpenQA.Selenium.BiDi.Modules.BrowsingContext;

Expand Down Expand Up @@ -69,6 +71,7 @@ public struct PrintPage
public double? Width { get; set; }
}

[JsonConverter(typeof(PrintPageRangeConverter))]
public readonly record struct PrintPageRange(int? Start, int? End)
{
public static implicit operator PrintPageRange(int index) { return new PrintPageRange(index, index); }
Expand Down
2 changes: 2 additions & 0 deletions dotnet/src/webdriver/BiDi/Modules/Input/Origin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
// under the License.
// </copyright>

using OpenQA.Selenium.BiDi.Communication.Json.Converters;
using System.Text.Json.Serialization;

namespace OpenQA.Selenium.BiDi.Modules.Input;

[JsonConverter(typeof(InputOriginConverter))]
public abstract record Origin
{
public record Viewport() : Origin;
Expand Down
2 changes: 2 additions & 0 deletions dotnet/src/webdriver/BiDi/Modules/Input/SourceActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@
// under the License.
// </copyright>

using OpenQA.Selenium.BiDi.Communication.Json.Converters.Enumerable;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace OpenQA.Selenium.BiDi.Modules.Input;

[JsonConverter(typeof(InputSourceActionsConverter))]
public abstract record SourceActions
{
public string Id { get; } = Guid.NewGuid().ToString();
Expand Down
4 changes: 4 additions & 0 deletions dotnet/src/webdriver/BiDi/Modules/Script/Channel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
// under the License.
// </copyright>

using OpenQA.Selenium.BiDi.Communication.Json.Converters;
using System.Text.Json.Serialization;

namespace OpenQA.Selenium.BiDi.Modules.Script;

[JsonConverter(typeof(ChannelConverter))]
public record Channel(string Id);
3 changes: 3 additions & 0 deletions dotnet/src/webdriver/BiDi/Modules/Script/GetRealmsCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
// </copyright>

using OpenQA.Selenium.BiDi.Communication;
using OpenQA.Selenium.BiDi.Communication.Json.Converters.Enumerable;
using System.Collections;
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace OpenQA.Selenium.BiDi.Modules.Script;

Expand All @@ -35,6 +37,7 @@ public record GetRealmsOptions : CommandOptions
public RealmType? Type { get; set; }
}

[JsonConverter(typeof(GetRealmsResultConverter))]
public record GetRealmsResult : IReadOnlyList<RealmInfo>
{
private readonly IReadOnlyList<RealmInfo> _realms;
Expand Down
4 changes: 4 additions & 0 deletions dotnet/src/webdriver/BiDi/Modules/Script/RealmType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@
// under the License.
// </copyright>

using OpenQA.Selenium.BiDi.Communication.Json.Converters;
using System.Text.Json.Serialization;

namespace OpenQA.Selenium.BiDi.Modules.Script;

[JsonConverter(typeof(RealmTypeConverter))]
public enum RealmType
{
Window,
Expand Down
4 changes: 4 additions & 0 deletions dotnet/src/webdriver/BiDi/Modules/Session/Subscription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@
// under the License.
// </copyright>

using OpenQA.Selenium.BiDi.Communication.Json.Converters;
using System.Text.Json.Serialization;

namespace OpenQA.Selenium.BiDi.Modules.Session;

[JsonConverter(typeof(SubscriptionConverter))]
public sealed class Subscription
{
internal Subscription(string id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
// </copyright>

using OpenQA.Selenium.BiDi.Communication;
using OpenQA.Selenium.BiDi.Communication.Json.Converters.Enumerable;
using System;
using System.Collections;
using System.Collections.Generic;
Expand All @@ -37,6 +38,7 @@ public record GetCookiesOptions : CommandOptions
public PartitionDescriptor? Partition { get; set; }
}

[JsonConverter(typeof(GetCookiesResultConverter))]
public record GetCookiesResult : IReadOnlyList<Network.Cookie>
{
private readonly IReadOnlyList<Network.Cookie> _cookies;
Expand Down
Loading