Skip to content

Commit f255de8

Browse files
committed
Devtools Client - Extract IDevToolsClient interface for testability
Improve xml doc comments
1 parent 4782cba commit f255de8

File tree

253 files changed

+879
-339
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

253 files changed

+879
-339
lines changed

CefSharp.Test/DevTools/DevToolsClientFacts.cs

+23
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,28 @@ public async Task CanGetDevToolsProtocolVersion()
6565
}
6666
}
6767
}
68+
69+
[Fact]
70+
public async Task CanGetDevToolsProtocolGetWindowForTarget()
71+
{
72+
using (var browser = new ChromiumWebBrowser("www.google.com"))
73+
{
74+
await browser.LoadPageAsync();
75+
76+
using (var devToolsClient = browser.GetDevToolsClient())
77+
{
78+
var response = await devToolsClient.Browser.GetWindowForTargetAsync();
79+
var windowId = response.WindowId;
80+
var bounds = response.Bounds;
81+
82+
Assert.NotEqual(0, windowId);
83+
Assert.NotNull(bounds);
84+
Assert.True(bounds.Height > 0);
85+
Assert.True(bounds.Width > 0);
86+
Assert.True(bounds.WindowState.HasValue);
87+
}
88+
}
89+
}
90+
6891
}
6992
}

CefSharp/CefSharp.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@
330330
<Compile Include="DevTools\HeapProfiler\SamplingHeapProfileNode.cs" />
331331
<Compile Include="DevTools\HeapProfiler\SamplingHeapProfileSample.cs" />
332332
<Compile Include="DevTools\HeapProfiler\StopSamplingResponse.cs" />
333+
<Compile Include="DevTools\IDevToolsClient.cs" />
333334
<Compile Include="DevTools\IndexedDB\DatabaseWithObjectStores.cs" />
334335
<Compile Include="DevTools\IndexedDB\DataEntry.cs" />
335336
<Compile Include="DevTools\IndexedDB\GetMetadataResponse.cs" />

CefSharp/DevTools/Accessibility/Accessibility.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ namespace CefSharp.DevTools.Accessibility
1010
/// </summary>
1111
public partial class Accessibility : DevToolsDomainBase
1212
{
13-
public Accessibility(CefSharp.DevTools.DevToolsClient client)
13+
public Accessibility(CefSharp.DevTools.IDevToolsClient client)
1414
{
1515
_client = (client);
1616
}
1717

18-
private CefSharp.DevTools.DevToolsClient _client;
18+
private CefSharp.DevTools.IDevToolsClient _client;
1919
/// <summary>
2020
/// Disables the accessibility domain.
2121
/// </summary>
@@ -28,6 +28,8 @@ public async System.Threading.Tasks.Task<DevToolsMethodResponse> DisableAsync()
2828

2929
/// <summary>
3030
/// Enables the accessibility domain which causes `AXNodeId`s to remain consistent between method calls.
31+
/// This turns on accessibility for the page, which can impact performance until accessibility is disabled.
32+
/// </summary>
3133
public async System.Threading.Tasks.Task<DevToolsMethodResponse> EnableAsync()
3234
{
3335
System.Collections.Generic.Dictionary<string, object> dict = null;

CefSharp/DevTools/Accessibility/Enums/AXPropertyName.cs

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ namespace CefSharp.DevTools.Accessibility
55
{
66
/// <summary>
77
/// Values of AXProperty name:
8+
/// - from 'busy' to 'roledescription': states which apply to every AX node
9+
/// - from 'live' to 'root': attributes which apply to nodes in live regions
10+
/// - from 'autocomplete' to 'valuetext': attributes which apply to widgets
11+
/// - from 'checked' to 'selected': states which apply to widgets
12+
/// - from 'activedescendant' to 'owns' - relationships between elements other than parent/child/sibling.
13+
/// </summary>
814
public enum AXPropertyName
915
{
1016
/// <summary>

CefSharp/DevTools/Accessibility/GetPartialAXTreeResponse.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ internal System.Collections.Generic.IList<CefSharp.DevTools.Accessibility.AXNode
1717
}
1818

1919
/// <summary>
20-
/// The `Accessibility.AXNode` for this DOM node, if it exists, plus its ancestors, siblings and
20+
/// nodes
21+
/// </summary>
2122
public System.Collections.Generic.IList<CefSharp.DevTools.Accessibility.AXNode> Nodes
2223
{
2324
get

CefSharp/DevTools/Animation/Animation.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ namespace CefSharp.DevTools.Animation
1010
/// </summary>
1111
public partial class Animation : DevToolsDomainBase
1212
{
13-
public Animation(CefSharp.DevTools.DevToolsClient client)
13+
public Animation(CefSharp.DevTools.IDevToolsClient client)
1414
{
1515
_client = (client);
1616
}
1717

18-
private CefSharp.DevTools.DevToolsClient _client;
18+
private CefSharp.DevTools.IDevToolsClient _client;
1919
/// <summary>
2020
/// Disables animation domain notifications.
2121
/// </summary>

CefSharp/DevTools/Animation/GetCurrentTimeResponse.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ internal long currentTime
1717
}
1818

1919
/// <summary>
20-
/// Current time of the page.
20+
/// currentTime
2121
/// </summary>
2222
public long CurrentTime
2323
{

CefSharp/DevTools/Animation/GetPlaybackRateResponse.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ internal long playbackRate
1717
}
1818

1919
/// <summary>
20-
/// Playback rate for animations on page.
20+
/// playbackRate
2121
/// </summary>
2222
public long PlaybackRate
2323
{

CefSharp/DevTools/Animation/ResolveAnimationResponse.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ internal CefSharp.DevTools.Runtime.RemoteObject remoteObject
1717
}
1818

1919
/// <summary>
20-
/// Corresponding remote object.
20+
/// remoteObject
2121
/// </summary>
2222
public CefSharp.DevTools.Runtime.RemoteObject RemoteObject
2323
{

CefSharp/DevTools/ApplicationCache/ApplicationCache.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ namespace CefSharp.DevTools.ApplicationCache
1010
/// </summary>
1111
public partial class ApplicationCache : DevToolsDomainBase
1212
{
13-
public ApplicationCache(CefSharp.DevTools.DevToolsClient client)
13+
public ApplicationCache(CefSharp.DevTools.IDevToolsClient client)
1414
{
1515
_client = (client);
1616
}
1717

18-
private CefSharp.DevTools.DevToolsClient _client;
18+
private CefSharp.DevTools.IDevToolsClient _client;
1919
/// <summary>
2020
/// Enables application cache domain notifications.
2121
/// </summary>
@@ -39,6 +39,8 @@ public async System.Threading.Tasks.Task<GetApplicationCacheForFrameResponse> Ge
3939

4040
/// <summary>
4141
/// Returns array of frame identifiers with manifest urls for each frame containing a document
42+
/// associated with some application cache.
43+
/// </summary>
4244
public async System.Threading.Tasks.Task<GetFramesWithManifestsResponse> GetFramesWithManifestsAsync()
4345
{
4446
System.Collections.Generic.Dictionary<string, object> dict = null;

CefSharp/DevTools/ApplicationCache/GetApplicationCacheForFrameResponse.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ internal CefSharp.DevTools.ApplicationCache.ApplicationCache applicationCache
1717
}
1818

1919
/// <summary>
20-
/// Relevant application cache data for the document in given frame.
20+
/// applicationCache
2121
/// </summary>
2222
public CefSharp.DevTools.ApplicationCache.ApplicationCache ApplicationCache
2323
{

CefSharp/DevTools/ApplicationCache/GetFramesWithManifestsResponse.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ internal System.Collections.Generic.IList<CefSharp.DevTools.ApplicationCache.Fra
1717
}
1818

1919
/// <summary>
20-
/// Array of frame identifiers with manifest urls for each frame containing a document
20+
/// frameIds
21+
/// </summary>
2122
public System.Collections.Generic.IList<CefSharp.DevTools.ApplicationCache.FrameWithManifest> FrameIds
2223
{
2324
get

CefSharp/DevTools/ApplicationCache/GetManifestForFrameResponse.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ internal string manifestURL
1717
}
1818

1919
/// <summary>
20-
/// Manifest URL for document in the given frame.
20+
/// manifestURL
2121
/// </summary>
2222
public string ManifestURL
2323
{

CefSharp/DevTools/Audits/Audits.cs

+6-2
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@ namespace CefSharp.DevTools.Audits
1010
/// </summary>
1111
public partial class Audits : DevToolsDomainBase
1212
{
13-
public Audits(CefSharp.DevTools.DevToolsClient client)
13+
public Audits(CefSharp.DevTools.IDevToolsClient client)
1414
{
1515
_client = (client);
1616
}
1717

18-
private CefSharp.DevTools.DevToolsClient _client;
18+
private CefSharp.DevTools.IDevToolsClient _client;
1919
/// <summary>
2020
/// Returns the response body and size if it were re-encoded with the specified settings. Only
21+
/// applies to images.
22+
/// </summary>
2123
public async System.Threading.Tasks.Task<GetEncodedResponseResponse> GetEncodedResponseAsync(string requestId, string encoding, long? quality = null, bool? sizeOnly = null)
2224
{
2325
var dict = new System.Collections.Generic.Dictionary<string, object>();
@@ -49,6 +51,8 @@ public async System.Threading.Tasks.Task<DevToolsMethodResponse> DisableAsync()
4951

5052
/// <summary>
5153
/// Enables issues domain, sends the issues collected so far to the client by means of the
54+
/// `issueAdded` event.
55+
/// </summary>
5256
public async System.Threading.Tasks.Task<DevToolsMethodResponse> EnableAsync()
5357
{
5458
System.Collections.Generic.Dictionary<string, object> dict = null;

CefSharp/DevTools/Audits/Enums/InspectorIssueCode.cs

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ namespace CefSharp.DevTools.Audits
55
{
66
/// <summary>
77
/// A unique identifier for the type of issue. Each type may use one of the
8+
/// optional fields in InspectorIssueDetails to convey more specific
9+
/// information about the kind of issue.
10+
/// </summary>
811
public enum InspectorIssueCode
912
{
1013
/// <summary>

CefSharp/DevTools/Audits/GetEncodedResponseResponse.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ internal string body
1717
}
1818

1919
/// <summary>
20-
/// The encoded body as a base64 string. Omitted if sizeOnly is true.
20+
/// body
2121
/// </summary>
2222
public byte[] Body
2323
{
@@ -35,7 +35,7 @@ internal int originalSize
3535
}
3636

3737
/// <summary>
38-
/// Size before re-encoding.
38+
/// originalSize
3939
/// </summary>
4040
public int OriginalSize
4141
{
@@ -53,7 +53,7 @@ internal int encodedSize
5353
}
5454

5555
/// <summary>
56-
/// Size after re-encoding.
56+
/// encodedSize
5757
/// </summary>
5858
public int EncodedSize
5959
{

CefSharp/DevTools/Audits/InspectorIssueDetails.cs

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ namespace CefSharp.DevTools.Audits
55
{
66
/// <summary>
77
/// This struct holds a list of optional fields with additional information
8+
/// specific to the kind of issue. When adding a new issue code, please also
9+
/// add a new optional field to this type.
10+
/// </summary>
811
public class InspectorIssueDetails : CefSharp.DevTools.DevToolsDomainEntityBase
912
{
1013
/// <summary>

CefSharp/DevTools/Audits/MixedContentIssueDetails.cs

+6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ public class MixedContentIssueDetails : CefSharp.DevTools.DevToolsDomainEntityBa
1010
{
1111
/// <summary>
1212
/// The type of resource causing the mixed content issue (css, js, iframe,
13+
/// form,...). Marked as optional because it is mapped to from
14+
/// blink::mojom::RequestContextType, which will be replaced
15+
/// by network::mojom::RequestDestination
16+
/// </summary>
1317
[System.Runtime.Serialization.DataMemberAttribute(Name = ("resourceType"), IsRequired = (false))]
1418
public CefSharp.DevTools.Audits.MixedContentResourceType? ResourceType
1519
{
@@ -49,6 +53,8 @@ public string MainResourceURL
4953

5054
/// <summary>
5155
/// The mixed content request.
56+
/// Does not always exist (e.g. for unsafe form submission urls).
57+
/// </summary>
5258
[System.Runtime.Serialization.DataMemberAttribute(Name = ("request"), IsRequired = (false))]
5359
public CefSharp.DevTools.Audits.AffectedRequest Request
5460
{

CefSharp/DevTools/Audits/SameSiteCookieIssueDetails.cs

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ namespace CefSharp.DevTools.Audits
55
{
66
/// <summary>
77
/// This information is currently necessary, as the front-end has a difficult
8+
/// time finding a specific cookie. With this, we can convey specific error
9+
/// information without the cookie.
10+
/// </summary>
811
public class SameSiteCookieIssueDetails : CefSharp.DevTools.DevToolsDomainEntityBase
912
{
1013
/// <summary>
@@ -39,6 +42,8 @@ public CefSharp.DevTools.Audits.SameSiteCookieExclusionReason[] CookieExclusionR
3942

4043
/// <summary>
4144
/// Optionally identifies the site-for-cookies and the cookie url, which
45+
/// may be used by the front-end as additional context.
46+
/// </summary>
4247
[System.Runtime.Serialization.DataMemberAttribute(Name = ("operation"), IsRequired = (true))]
4348
public CefSharp.DevTools.Audits.SameSiteCookieOperation Operation
4449
{

CefSharp/DevTools/BackgroundService/BackgroundService.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ namespace CefSharp.DevTools.BackgroundService
1010
/// </summary>
1111
public partial class BackgroundService : DevToolsDomainBase
1212
{
13-
public BackgroundService(CefSharp.DevTools.DevToolsClient client)
13+
public BackgroundService(CefSharp.DevTools.IDevToolsClient client)
1414
{
1515
_client = (client);
1616
}
1717

18-
private CefSharp.DevTools.DevToolsClient _client;
18+
private CefSharp.DevTools.IDevToolsClient _client;
1919
/// <summary>
2020
/// Enables event updates for the service.
2121
/// </summary>

CefSharp/DevTools/BackgroundService/Enums/ServiceName.cs

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ namespace CefSharp.DevTools.BackgroundService
55
{
66
/// <summary>
77
/// The Background Service that will be associated with the commands/events.
8+
/// Every Background Service operates independently, but they share the same
9+
/// API.
10+
/// </summary>
811
public enum ServiceName
912
{
1013
/// <summary>

CefSharp/DevTools/Browser/Browser.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ namespace CefSharp.DevTools.Browser
1010
/// </summary>
1111
public partial class Browser : DevToolsDomainBase
1212
{
13-
public Browser(CefSharp.DevTools.DevToolsClient client)
13+
public Browser(CefSharp.DevTools.IDevToolsClient client)
1414
{
1515
_client = (client);
1616
}
1717

18-
private CefSharp.DevTools.DevToolsClient _client;
18+
private CefSharp.DevTools.IDevToolsClient _client;
1919
/// <summary>
2020
/// Set permission settings for given origin.
2121
/// </summary>
@@ -137,6 +137,8 @@ public async System.Threading.Tasks.Task<GetVersionResponse> GetVersionAsync()
137137

138138
/// <summary>
139139
/// Returns the command line switches for the browser process if, and only if
140+
/// --enable-automation is on the commandline.
141+
/// </summary>
140142
public async System.Threading.Tasks.Task<GetBrowserCommandLineResponse> GetBrowserCommandLineAsync()
141143
{
142144
System.Collections.Generic.Dictionary<string, object> dict = null;

CefSharp/DevTools/Browser/GetBrowserCommandLineResponse.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ internal string[] arguments
1717
}
1818

1919
/// <summary>
20-
/// Commandline parameters
20+
/// arguments
2121
/// </summary>
2222
public string[] Arguments
2323
{

CefSharp/DevTools/Browser/GetHistogramResponse.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ internal CefSharp.DevTools.Browser.Histogram histogram
1717
}
1818

1919
/// <summary>
20-
/// Histogram.
20+
/// histogram
2121
/// </summary>
2222
public CefSharp.DevTools.Browser.Histogram Histogram
2323
{

CefSharp/DevTools/Browser/GetHistogramsResponse.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ internal System.Collections.Generic.IList<CefSharp.DevTools.Browser.Histogram> h
1717
}
1818

1919
/// <summary>
20-
/// Histograms.
20+
/// histograms
2121
/// </summary>
2222
public System.Collections.Generic.IList<CefSharp.DevTools.Browser.Histogram> Histograms
2323
{

0 commit comments

Comments
 (0)