Skip to content

Commit

Permalink
Merge pull request #62 from sinaa/master
Browse files Browse the repository at this point in the history
Update to latest devtools protocol
  • Loading branch information
kklisura authored May 21, 2021
2 parents 7e72e6c + 3b96123 commit 4e1a3ad
Show file tree
Hide file tree
Showing 177 changed files with 7,448 additions and 598 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ For more information on DevTools, see https://chromedevtools.github.io/devtools-

[v2.1.0](https://github.com/kklisura/chrome-devtools-java-client/tree/v2.1.0) tested on Google Chrome Version 76.0.3809.100. Protocol files from [dev-tools-protocol#e1fb93bd76](https://github.com/ChromeDevTools/devtools-protocol/tree/e1fb93bd76f99cdf401b949757c874c579e15434/json)

[v3.0.0](https://github.com/kklisura/chrome-devtools-java-client/tree/vx.x.x) tested on Google Chrome Version 86.0.4240.111. Protocol files from [dev-tools-protocol#fcb68d10bc](https://github.com/ChromeDevTools/devtools-protocol/tree/fcb68d10bc5258ebf96121caf57200069f6e6731/json)
[v3.0.0](https://github.com/kklisura/chrome-devtools-java-client/tree/v3.0.0) tested on Google Chrome Version 86.0.4240.111. Protocol files from [dev-tools-protocol#fcb68d10bc](https://github.com/ChromeDevTools/devtools-protocol/tree/fcb68d10bc5258ebf96121caf57200069f6e6731/json)

[1] https://chromedevtools.github.io/devtools-protocol/.

Expand Down
1,740 changes: 1,639 additions & 101 deletions browser_protocol.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import com.github.kklisura.cdt.protocol.commands.Overlay;
import com.github.kklisura.cdt.protocol.commands.Page;
import com.github.kklisura.cdt.protocol.commands.Performance;
import com.github.kklisura.cdt.protocol.commands.PerformanceTimeline;
import com.github.kklisura.cdt.protocol.commands.Profiler;
import com.github.kklisura.cdt.protocol.commands.Runtime;
import com.github.kklisura.cdt.protocol.commands.Schema;
Expand Down Expand Up @@ -170,6 +171,9 @@ public interface ChromeDevTools {
/** Returns the Performance command. */
Performance getPerformance();

/** Returns the PerformanceTimeline command. */
PerformanceTimeline getPerformanceTimeline();

/** Returns the Security command. */
Security getSecurity();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,34 @@ List<AXNode> getPartialAXTree(
@Optional @ParamName("objectId") String objectId,
@Optional @ParamName("fetchRelatives") Boolean fetchRelatives);

/** Fetches the entire accessibility tree */
/** Fetches the entire accessibility tree for the root Document */
@Experimental
@Returns("nodes")
@ReturnTypeParameter(AXNode.class)
List<AXNode> getFullAXTree();

/**
* Fetches the entire accessibility tree for the root Document
*
* @param max_depth The maximum depth at which descendants of the root node should be retrieved.
* If omitted, the full tree is returned.
*/
@Experimental
@Returns("nodes")
@ReturnTypeParameter(AXNode.class)
List<AXNode> getFullAXTree(@Optional @ParamName("max_depth") Integer max_depth);

/**
* Fetches a particular accessibility node by AXNodeId. Requires `enable()` to have been called
* previously.
*
* @param id
*/
@Experimental
@Returns("nodes")
@ReturnTypeParameter(AXNode.class)
List<AXNode> getChildAXNodes(@ParamName("id") String id);

/**
* Query a DOM node's accessibility subtree for accessible name and role. This command computes
* the name and role for all nodes in the subtree, including those that are ignored for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,20 @@ EncodedResponse getEncodedResponse(
*/
void enable();

/**
* Runs the contrast check for the target page. Found issues are reported using Audits.issueAdded
* event.
*/
void checkContrast();

/**
* Runs the contrast check for the target page. Found issues are reported using Audits.issueAdded
* event.
*
* @param reportAAA Whether to report WCAG AAA level issues. Default is false.
*/
void checkContrast(@Optional @ParamName("reportAAA") Boolean reportAAA);

@EventName("issueAdded")
EventListener onIssueAdded(EventHandler<IssueAdded> eventListener);
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,16 @@
* #L%
*/

import com.github.kklisura.cdt.protocol.events.browser.DownloadProgress;
import com.github.kklisura.cdt.protocol.events.browser.DownloadWillBegin;
import com.github.kklisura.cdt.protocol.support.annotations.EventName;
import com.github.kklisura.cdt.protocol.support.annotations.Experimental;
import com.github.kklisura.cdt.protocol.support.annotations.Optional;
import com.github.kklisura.cdt.protocol.support.annotations.ParamName;
import com.github.kklisura.cdt.protocol.support.annotations.ReturnTypeParameter;
import com.github.kklisura.cdt.protocol.support.annotations.Returns;
import com.github.kklisura.cdt.protocol.support.types.EventHandler;
import com.github.kklisura.cdt.protocol.support.types.EventListener;
import com.github.kklisura.cdt.protocol.types.browser.Bounds;
import com.github.kklisura.cdt.protocol.types.browser.BrowserCommandId;
import com.github.kklisura.cdt.protocol.types.browser.Histogram;
Expand Down Expand Up @@ -118,14 +123,36 @@ void grantPermissions(
* according to their dowmload guids.
* @param browserContextId BrowserContext to set download behavior. When omitted, default browser
* context is used.
* @param downloadPath The default path to save downloaded files to. This is requred if behavior
* @param downloadPath The default path to save downloaded files to. This is required if behavior
* is set to 'allow' or 'allowAndName'.
* @param eventsEnabled Whether to emit download events (defaults to false).
*/
@Experimental
void setDownloadBehavior(
@ParamName("behavior") SetDownloadBehaviorBehavior behavior,
@Optional @ParamName("browserContextId") String browserContextId,
@Optional @ParamName("downloadPath") String downloadPath);
@Optional @ParamName("downloadPath") String downloadPath,
@Optional @ParamName("eventsEnabled") Boolean eventsEnabled);

/**
* Cancel a download if in progress
*
* @param guid Global unique identifier of the download.
*/
@Experimental
void cancelDownload(@ParamName("guid") String guid);

/**
* Cancel a download if in progress
*
* @param guid Global unique identifier of the download.
* @param browserContextId BrowserContext to perform the action in. When omitted, default browser
* context is used.
*/
@Experimental
void cancelDownload(
@ParamName("guid") String guid,
@Optional @ParamName("browserContextId") String browserContextId);

/** Close browser gracefully. */
void close();
Expand Down Expand Up @@ -229,7 +256,7 @@ Histogram getHistogram(
* Set dock tile details, platform-specific.
*
* @param badgeLabel
* @param image Png encoded image.
* @param image Png encoded image. (Encoded as a base64 string when passed over JSON)
*/
@Experimental
void setDockTile(
Expand All @@ -243,4 +270,14 @@ void setDockTile(
*/
@Experimental
void executeBrowserCommand(@ParamName("commandId") BrowserCommandId commandId);

/** Fired when page is about to start a download. */
@EventName("downloadWillBegin")
@Experimental
EventListener onDownloadWillBegin(EventHandler<DownloadWillBegin> eventListener);

/** Fired when download makes progress. Last call has |done| == true. */
@EventName("downloadProgress")
@Experimental
EventListener onDownloadProgress(EventHandler<DownloadProgress> eventListener);
}
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ void setFileInputFiles(
@EventName("childNodeRemoved")
EventListener onChildNodeRemoved(EventHandler<ChildNodeRemoved> eventListener);

/** Called when distrubution is changed. */
/** Called when distribution is changed. */
@EventName("distributedNodesUpdated")
@Experimental
EventListener onDistributedNodesUpdated(EventHandler<DistributedNodesUpdated> eventListener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.github.kklisura.cdt.protocol.support.annotations.ParamName;
import com.github.kklisura.cdt.protocol.support.annotations.ReturnTypeParameter;
import com.github.kklisura.cdt.protocol.support.annotations.Returns;
import com.github.kklisura.cdt.protocol.types.domdebugger.CSPViolationType;
import com.github.kklisura.cdt.protocol.types.domdebugger.DOMBreakpointType;
import com.github.kklisura.cdt.protocol.types.domdebugger.EventListener;
import java.util.List;
Expand Down Expand Up @@ -101,6 +102,14 @@ void removeEventListenerBreakpoint(
*/
void removeXHRBreakpoint(@ParamName("url") String url);

/**
* Sets breakpoint on particular CSP violations.
*
* @param violationTypes CSP Violations to stop upon.
*/
@Experimental
void setBreakOnCSPViolation(@ParamName("violationTypes") List<CSPViolationType> violationTypes);

/**
* Sets breakpoint on particular operation with DOM.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,20 @@ Snapshot getSnapshot(
* @param includePaintOrder Whether to include layout object paint orders into the snapshot.
* @param includeDOMRects Whether to include DOM rectangles (offsetRects, clientRects,
* scrollRects) into the snapshot
* @param includeBlendedBackgroundColors Whether to include blended background colors in the
* snapshot (default: false). Blended background color is achieved by blending background
* colors of all elements that overlap with the current element.
* @param includeTextColorOpacities Whether to include text color opacity in the snapshot
* (default: false). An element might have the opacity property set that affects the text
* color of the element. The final text color opacity is computed based on the opacity of all
* overlapping elements.
*/
CaptureSnapshot captureSnapshot(
@ParamName("computedStyles") List<String> computedStyles,
@Optional @ParamName("includePaintOrder") Boolean includePaintOrder,
@Optional @ParamName("includeDOMRects") Boolean includeDOMRects);
@Optional @ParamName("includeDOMRects") Boolean includeDOMRects,
@Experimental @Optional @ParamName("includeBlendedBackgroundColors")
Boolean includeBlendedBackgroundColors,
@Experimental @Optional @ParamName("includeTextColorOpacities")
Boolean includeTextColorOpacities);
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import com.github.kklisura.cdt.protocol.types.debugger.BreakLocation;
import com.github.kklisura.cdt.protocol.types.debugger.ContinueToLocationTargetCallFrames;
import com.github.kklisura.cdt.protocol.types.debugger.EvaluateOnCallFrame;
import com.github.kklisura.cdt.protocol.types.debugger.ExecuteWasmEvaluator;
import com.github.kklisura.cdt.protocol.types.debugger.Location;
import com.github.kklisura.cdt.protocol.types.debugger.LocationRange;
import com.github.kklisura.cdt.protocol.types.debugger.RestartFrame;
Expand Down Expand Up @@ -135,29 +134,6 @@ EvaluateOnCallFrame evaluateOnCallFrame(
@Optional @ParamName("throwOnSideEffect") Boolean throwOnSideEffect,
@Experimental @Optional @ParamName("timeout") Double timeout);

/**
* Execute a Wasm Evaluator module on a given call frame.
*
* @param callFrameId WebAssembly call frame identifier to evaluate on.
* @param evaluator Code of the evaluator module.
*/
@Experimental
ExecuteWasmEvaluator executeWasmEvaluator(
@ParamName("callFrameId") String callFrameId, @ParamName("evaluator") String evaluator);

/**
* Execute a Wasm Evaluator module on a given call frame.
*
* @param callFrameId WebAssembly call frame identifier to evaluate on.
* @param evaluator Code of the evaluator module.
* @param timeout Terminate execution after timing out (number of milliseconds).
*/
@Experimental
ExecuteWasmEvaluator executeWasmEvaluator(
@ParamName("callFrameId") String callFrameId,
@ParamName("evaluator") String evaluator,
@Experimental @Optional @ParamName("timeout") Double timeout);

/**
* Returns possible locations for breakpoint. scriptId in start and end range locations should be
* the same.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ public interface Emulation {
@Returns("result")
Boolean canEmulate();

/** Clears the overriden device metrics. */
/** Clears the overridden device metrics. */
void clearDeviceMetricsOverride();

/** Clears the overriden Geolocation Position and Error. */
/** Clears the overridden Geolocation Position and Error. */
void clearGeolocationOverride();

/** Requests that page scale factor is reset to initial values. */
Expand Down Expand Up @@ -285,7 +285,7 @@ void setTouchEmulationEnabled(
* can be run before virtual is forced forwards to prevent deadlock.
* @param waitForNavigation If set the virtual time policy change should be deferred until any
* frame starts navigating. Note any previous deferred policy change is superseded.
* @param initialVirtualTime If set, base::Time::Now will be overriden to initially return this
* @param initialVirtualTime If set, base::Time::Now will be overridden to initially return this
* value.
*/
@Experimental
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ void fulfillRequest(
* @param responseHeaders Response headers.
* @param binaryResponseHeaders Alternative way of specifying response headers as a \0-separated
* series of name: value pairs. Prefer the above method unless you need to represent some
* non-UTF8 values that can't be transmitted over the protocol as text.
* @param body A response body.
* non-UTF8 values that can't be transmitted over the protocol as text. (Encoded as a base64
* string when passed over JSON)
* @param body A response body. (Encoded as a base64 string when passed over JSON)
* @param responsePhrase A textual representation of responseCode. If absent, a standard phrase
* matching responseCode is used.
*/
Expand All @@ -113,7 +114,8 @@ void fulfillRequest(
* @param requestId An id the client received in requestPaused event.
* @param url If set, the request url will be modified in a way that's not observable by page.
* @param method If set, the request method is overridden.
* @param postData If set, overrides the post data in the request.
* @param postData If set, overrides the post data in the request. (Encoded as a base64 string
* when passed over JSON)
* @param headers If set, overrides the request headers.
*/
void continueRequest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,19 @@
* #L%
*/

import com.github.kklisura.cdt.protocol.events.input.DragIntercepted;
import com.github.kklisura.cdt.protocol.support.annotations.EventName;
import com.github.kklisura.cdt.protocol.support.annotations.Experimental;
import com.github.kklisura.cdt.protocol.support.annotations.Optional;
import com.github.kklisura.cdt.protocol.support.annotations.ParamName;
import com.github.kklisura.cdt.protocol.support.types.EventHandler;
import com.github.kklisura.cdt.protocol.support.types.EventListener;
import com.github.kklisura.cdt.protocol.types.input.DispatchDragEventType;
import com.github.kklisura.cdt.protocol.types.input.DispatchKeyEventType;
import com.github.kklisura.cdt.protocol.types.input.DispatchMouseEventPointerType;
import com.github.kklisura.cdt.protocol.types.input.DispatchMouseEventType;
import com.github.kklisura.cdt.protocol.types.input.DispatchTouchEventType;
import com.github.kklisura.cdt.protocol.types.input.DragData;
import com.github.kklisura.cdt.protocol.types.input.EmulateTouchFromMouseEventType;
import com.github.kklisura.cdt.protocol.types.input.GestureSourceType;
import com.github.kklisura.cdt.protocol.types.input.MouseButton;
Expand All @@ -35,6 +41,43 @@

public interface Input {

/**
* Dispatches a drag event into the page.
*
* @param type Type of the drag event.
* @param x X coordinate of the event relative to the main frame's viewport in CSS pixels.
* @param y Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0
* refers to the top of the viewport and Y increases as it proceeds towards the bottom of the
* viewport.
* @param data
*/
@Experimental
void dispatchDragEvent(
@ParamName("type") DispatchDragEventType type,
@ParamName("x") Double x,
@ParamName("y") Double y,
@ParamName("data") DragData data);

/**
* Dispatches a drag event into the page.
*
* @param type Type of the drag event.
* @param x X coordinate of the event relative to the main frame's viewport in CSS pixels.
* @param y Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0
* refers to the top of the viewport and Y increases as it proceeds towards the bottom of the
* viewport.
* @param data
* @param modifiers Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4,
* Shift=8 (default: 0).
*/
@Experimental
void dispatchDragEvent(
@ParamName("type") DispatchDragEventType type,
@ParamName("x") Double x,
@ParamName("y") Double y,
@ParamName("data") DragData data,
@Optional @ParamName("modifiers") Integer modifiers);

/**
* Dispatches a key event to the page.
*
Expand Down Expand Up @@ -237,6 +280,15 @@ void emulateTouchFromMouseEvent(
*/
void setIgnoreInputEvents(@ParamName("ignore") Boolean ignore);

/**
* Prevents default drag and drop behavior and instead emits `Input.dragIntercepted` events. Drag
* and drop behavior can be directly controlled via `Input.dispatchDragEvent`.
*
* @param enabled
*/
@Experimental
void setInterceptDrags(@ParamName("enabled") Boolean enabled);

/**
* Synthesizes a pinch gesture over a time period by issuing appropriate touch events.
*
Expand Down Expand Up @@ -338,4 +390,12 @@ void synthesizeTapGesture(
@Optional @ParamName("duration") Integer duration,
@Optional @ParamName("tapCount") Integer tapCount,
@Optional @ParamName("gestureSourceType") GestureSourceType gestureSourceType);

/**
* Emitted only when `Input.setInterceptDrags` is enabled. Use this data with
* `Input.dispatchDragEvent` to restore normal drag and drop behavior.
*/
@EventName("dragIntercepted")
@Experimental
EventListener onDragIntercepted(EventHandler<DragIntercepted> eventListener);
}
Loading

0 comments on commit 4e1a3ad

Please sign in to comment.