Skip to content

Commit c7f5caa

Browse files
committed
Generate protocol; Add some unit tests
1 parent efa8fd3 commit c7f5caa

File tree

73 files changed

+794
-148
lines changed

Some content is hidden

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

73 files changed

+794
-148
lines changed

cdt-examples/src/main/java/com/github/kklisura/cdt/examples/BlockUrlGIvenPatternExample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
* @author Kenan Klisura
1515
*/
16-
public class BlockUrlGIvenPatternExample {
16+
public class BlockUrlGivenPatternExample {
1717
public static void main(String[] args) throws InterruptedException {
1818
// Create chrome launcher.
1919
final ChromeLauncher launcher = new ChromeLauncher();

cdt-java-client/src/main/java/com/github/kklisura/cdt/protocol/commands/Audits.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import com.github.kklisura.cdt.protocol.support.annotations.Optional;
2525
import com.github.kklisura.cdt.protocol.support.annotations.ParamName;
2626
import com.github.kklisura.cdt.protocol.types.audits.EncodedResponse;
27-
import com.github.kklisura.cdt.protocol.types.audits.Encoding;
27+
import com.github.kklisura.cdt.protocol.types.audits.GetEncodedResponseEncoding;
2828

2929
/** Audits domain allows investigation of page violations and possible improvements. */
3030
@Experimental
@@ -38,7 +38,8 @@ public interface Audits {
3838
* @param encoding The encoding to use.
3939
*/
4040
EncodedResponse getEncodedResponse(
41-
@ParamName("requestId") String requestId, @ParamName("encoding") Encoding encoding);
41+
@ParamName("requestId") String requestId,
42+
@ParamName("encoding") GetEncodedResponseEncoding encoding);
4243

4344
/**
4445
* Returns the response body and size if it were re-encoded with the specified settings. Only
@@ -51,7 +52,7 @@ EncodedResponse getEncodedResponse(
5152
*/
5253
EncodedResponse getEncodedResponse(
5354
@ParamName("requestId") String requestId,
54-
@ParamName("encoding") Encoding encoding,
55+
@ParamName("encoding") GetEncodedResponseEncoding encoding,
5556
@Optional @ParamName("quality") Double quality,
5657
@Optional @ParamName("sizeOnly") Boolean sizeOnly);
5758
}

cdt-java-client/src/main/java/com/github/kklisura/cdt/protocol/commands/Debugger.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@
3333
import com.github.kklisura.cdt.protocol.support.types.EventHandler;
3434
import com.github.kklisura.cdt.protocol.support.types.EventListener;
3535
import com.github.kklisura.cdt.protocol.types.debugger.BreakLocation;
36+
import com.github.kklisura.cdt.protocol.types.debugger.ContinueToLocationTargetCallFrames;
3637
import com.github.kklisura.cdt.protocol.types.debugger.EvaluateOnCallFrame;
3738
import com.github.kklisura.cdt.protocol.types.debugger.Location;
3839
import com.github.kklisura.cdt.protocol.types.debugger.RestartFrame;
3940
import com.github.kklisura.cdt.protocol.types.debugger.ScriptPosition;
4041
import com.github.kklisura.cdt.protocol.types.debugger.SearchMatch;
4142
import com.github.kklisura.cdt.protocol.types.debugger.SetBreakpoint;
4243
import com.github.kklisura.cdt.protocol.types.debugger.SetBreakpointByUrl;
44+
import com.github.kklisura.cdt.protocol.types.debugger.SetPauseOnExceptionsState;
4345
import com.github.kklisura.cdt.protocol.types.debugger.SetScriptSource;
44-
import com.github.kklisura.cdt.protocol.types.debugger.State;
45-
import com.github.kklisura.cdt.protocol.types.debugger.TargetCallFrames;
4646
import com.github.kklisura.cdt.protocol.types.runtime.CallArgument;
4747
import java.util.List;
4848

@@ -174,7 +174,8 @@ List<BreakLocation> getPossibleBreakpoints(
174174
*/
175175
void continueToLocation(
176176
@ParamName("location") Location location,
177-
@Experimental @Optional @ParamName("targetCallFrames") TargetCallFrames targetCallFrames);
177+
@Experimental @Optional @ParamName("targetCallFrames")
178+
ContinueToLocationTargetCallFrames targetCallFrames);
178179

179180
/** Steps over the statement. */
180181
void stepOver();
@@ -269,7 +270,7 @@ SetScriptSource setScriptSource(
269270
*
270271
* @param state Pause on exceptions mode.
271272
*/
272-
void setPauseOnExceptions(@ParamName("state") State state);
273+
void setPauseOnExceptions(@ParamName("state") SetPauseOnExceptionsState state);
273274

274275
/**
275276
* Evaluates expression on a given call frame.

cdt-java-client/src/main/java/com/github/kklisura/cdt/protocol/commands/Emulation.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
import com.github.kklisura.cdt.protocol.support.types.EventHandler;
3131
import com.github.kklisura.cdt.protocol.support.types.EventListener;
3232
import com.github.kklisura.cdt.protocol.types.dom.RGBA;
33-
import com.github.kklisura.cdt.protocol.types.emulation.Configuration;
3433
import com.github.kklisura.cdt.protocol.types.emulation.ScreenOrientation;
34+
import com.github.kklisura.cdt.protocol.types.emulation.SetEmitTouchEventsForMouseConfiguration;
3535
import com.github.kklisura.cdt.protocol.types.emulation.VirtualTimePolicy;
3636

3737
/** This domain emulates different environments for the page. */
@@ -177,7 +177,7 @@ void setTouchEmulationEnabled(
177177
@Experimental
178178
void setEmitTouchEventsForMouse(
179179
@ParamName("enabled") Boolean enabled,
180-
@Optional @ParamName("configuration") Configuration configuration);
180+
@Optional @ParamName("configuration") SetEmitTouchEventsForMouseConfiguration configuration);
181181

182182
/**
183183
* Emulates the given media for CSS media queries.

cdt-java-client/src/main/java/com/github/kklisura/cdt/protocol/commands/Input.java

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,14 @@
2323
import com.github.kklisura.cdt.protocol.support.annotations.Experimental;
2424
import com.github.kklisura.cdt.protocol.support.annotations.Optional;
2525
import com.github.kklisura.cdt.protocol.support.annotations.ParamName;
26-
import com.github.kklisura.cdt.protocol.types.input.Button;
26+
import com.github.kklisura.cdt.protocol.types.input.DispatchKeyEventType;
27+
import com.github.kklisura.cdt.protocol.types.input.DispatchMouseEventButton;
28+
import com.github.kklisura.cdt.protocol.types.input.DispatchMouseEventType;
29+
import com.github.kklisura.cdt.protocol.types.input.DispatchTouchEventType;
30+
import com.github.kklisura.cdt.protocol.types.input.EmulateTouchFromMouseEventButton;
31+
import com.github.kklisura.cdt.protocol.types.input.EmulateTouchFromMouseEventType;
2732
import com.github.kklisura.cdt.protocol.types.input.GestureSourceType;
2833
import com.github.kklisura.cdt.protocol.types.input.TouchPoint;
29-
import com.github.kklisura.cdt.protocol.types.input.Type;
3034
import java.util.List;
3135

3236
public interface Input {
@@ -43,7 +47,7 @@ public interface Input {
4347
*
4448
* @param type Type of the key event.
4549
*/
46-
void dispatchKeyEvent(@ParamName("type") Type type);
50+
void dispatchKeyEvent(@ParamName("type") DispatchKeyEventType type);
4751

4852
/**
4953
* Dispatches a key event to the page.
@@ -67,7 +71,7 @@ public interface Input {
6771
* @param isSystemKey Whether the event was a system key event (default: false).
6872
*/
6973
void dispatchKeyEvent(
70-
@ParamName("type") Type type,
74+
@ParamName("type") DispatchKeyEventType type,
7175
@Optional @ParamName("modifiers") Integer modifiers,
7276
@Optional @ParamName("timestamp") Double timestamp,
7377
@Optional @ParamName("text") String text,
@@ -91,7 +95,9 @@ void dispatchKeyEvent(
9195
* viewport.
9296
*/
9397
void dispatchMouseEvent(
94-
@ParamName("type") Type type, @ParamName("x") Double x, @ParamName("y") Double y);
98+
@ParamName("type") DispatchMouseEventType type,
99+
@ParamName("x") Double x,
100+
@ParamName("y") Double y);
95101

96102
/**
97103
* Dispatches a mouse event to the page.
@@ -110,12 +116,12 @@ void dispatchMouseEvent(
110116
* @param deltaY Y delta in CSS pixels for mouse wheel event (default: 0).
111117
*/
112118
void dispatchMouseEvent(
113-
@ParamName("type") Type type,
119+
@ParamName("type") DispatchMouseEventType type,
114120
@ParamName("x") Double x,
115121
@ParamName("y") Double y,
116122
@Optional @ParamName("modifiers") Integer modifiers,
117123
@Optional @ParamName("timestamp") Double timestamp,
118-
@Optional @ParamName("button") Button button,
124+
@Optional @ParamName("button") DispatchMouseEventButton button,
119125
@Optional @ParamName("clickCount") Integer clickCount,
120126
@Optional @ParamName("deltaX") Double deltaX,
121127
@Optional @ParamName("deltaY") Double deltaY);
@@ -131,7 +137,8 @@ void dispatchMouseEvent(
131137
*/
132138
@Experimental
133139
void dispatchTouchEvent(
134-
@ParamName("type") Type type, @ParamName("touchPoints") List<TouchPoint> touchPoints);
140+
@ParamName("type") DispatchTouchEventType type,
141+
@ParamName("touchPoints") List<TouchPoint> touchPoints);
135142

136143
/**
137144
* Dispatches a touch event to the page.
@@ -147,7 +154,7 @@ void dispatchTouchEvent(
147154
*/
148155
@Experimental
149156
void dispatchTouchEvent(
150-
@ParamName("type") Type type,
157+
@ParamName("type") DispatchTouchEventType type,
151158
@ParamName("touchPoints") List<TouchPoint> touchPoints,
152159
@Optional @ParamName("modifiers") Integer modifiers,
153160
@Optional @ParamName("timestamp") Double timestamp);
@@ -163,11 +170,11 @@ void dispatchTouchEvent(
163170
*/
164171
@Experimental
165172
void emulateTouchFromMouseEvent(
166-
@ParamName("type") Type type,
173+
@ParamName("type") EmulateTouchFromMouseEventType type,
167174
@ParamName("x") Integer x,
168175
@ParamName("y") Integer y,
169176
@ParamName("timestamp") Double timestamp,
170-
@ParamName("button") Button button);
177+
@ParamName("button") EmulateTouchFromMouseEventButton button);
171178

172179
/**
173180
* Emulates touch event from the mouse event parameters.
@@ -185,11 +192,11 @@ void emulateTouchFromMouseEvent(
185192
*/
186193
@Experimental
187194
void emulateTouchFromMouseEvent(
188-
@ParamName("type") Type type,
195+
@ParamName("type") EmulateTouchFromMouseEventType type,
189196
@ParamName("x") Integer x,
190197
@ParamName("y") Integer y,
191198
@ParamName("timestamp") Double timestamp,
192-
@ParamName("button") Button button,
199+
@ParamName("button") EmulateTouchFromMouseEventButton button,
193200
@Optional @ParamName("deltaX") Double deltaX,
194201
@Optional @ParamName("deltaY") Double deltaY,
195202
@Optional @ParamName("modifiers") Integer modifiers,

cdt-java-client/src/main/java/com/github/kklisura/cdt/protocol/commands/Page.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,13 @@
4646
import com.github.kklisura.cdt.protocol.support.types.EventListener;
4747
import com.github.kklisura.cdt.protocol.types.debugger.SearchMatch;
4848
import com.github.kklisura.cdt.protocol.types.page.AppManifest;
49-
import com.github.kklisura.cdt.protocol.types.page.Behavior;
50-
import com.github.kklisura.cdt.protocol.types.page.Format;
49+
import com.github.kklisura.cdt.protocol.types.page.CaptureScreenshotFormat;
5150
import com.github.kklisura.cdt.protocol.types.page.FrameResourceTree;
5251
import com.github.kklisura.cdt.protocol.types.page.LayoutMetrics;
5352
import com.github.kklisura.cdt.protocol.types.page.NavigationHistory;
5453
import com.github.kklisura.cdt.protocol.types.page.ResourceContent;
54+
import com.github.kklisura.cdt.protocol.types.page.SetDownloadBehaviorBehavior;
55+
import com.github.kklisura.cdt.protocol.types.page.StartScreencastFormat;
5556
import com.github.kklisura.cdt.protocol.types.page.TransitionType;
5657
import com.github.kklisura.cdt.protocol.types.page.Viewport;
5758
import java.util.List;
@@ -242,7 +243,7 @@ List<SearchMatch> searchInResource(
242243
@Experimental
243244
@Returns("data")
244245
String captureScreenshot(
245-
@Optional @ParamName("format") Format format,
246+
@Optional @ParamName("format") CaptureScreenshotFormat format,
246247
@Optional @ParamName("quality") Integer quality,
247248
@Experimental @Optional @ParamName("clip") Viewport clip,
248249
@Experimental @Optional @ParamName("fromSurface") Boolean fromSurface);
@@ -301,7 +302,7 @@ String printToPDF(
301302
*/
302303
@Experimental
303304
void startScreencast(
304-
@Optional @ParamName("format") Format format,
305+
@Optional @ParamName("format") StartScreencastFormat format,
305306
@Optional @ParamName("quality") Integer quality,
306307
@Optional @ParamName("maxWidth") Integer maxWidth,
307308
@Optional @ParamName("maxHeight") Integer maxHeight,
@@ -380,7 +381,7 @@ Integer createIsolatedWorld(
380381
* behavior if available (otherwise deny).
381382
*/
382383
@Experimental
383-
void setDownloadBehavior(@ParamName("behavior") Behavior behavior);
384+
void setDownloadBehavior(@ParamName("behavior") SetDownloadBehaviorBehavior behavior);
384385

385386
/**
386387
* Set the behavior when downloading a file.
@@ -392,7 +393,7 @@ Integer createIsolatedWorld(
392393
*/
393394
@Experimental
394395
void setDownloadBehavior(
395-
@ParamName("behavior") Behavior behavior,
396+
@ParamName("behavior") SetDownloadBehaviorBehavior behavior,
396397
@Optional @ParamName("downloadPath") String downloadPath);
397398

398399
@EventName("domContentEventFired")

cdt-java-client/src/main/java/com/github/kklisura/cdt/protocol/commands/Tracing.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
import com.github.kklisura.cdt.protocol.support.types.EventHandler;
3232
import com.github.kklisura.cdt.protocol.support.types.EventListener;
3333
import com.github.kklisura.cdt.protocol.types.tracing.RequestMemoryDump;
34+
import com.github.kklisura.cdt.protocol.types.tracing.StartTransferMode;
3435
import com.github.kklisura.cdt.protocol.types.tracing.TraceConfig;
35-
import com.github.kklisura.cdt.protocol.types.tracing.TransferMode;
3636
import java.util.List;
3737

3838
@Experimental
@@ -56,7 +56,7 @@ void start(
5656
@Deprecated @Optional @ParamName("categories") String categories,
5757
@Deprecated @Optional @ParamName("options") String options,
5858
@Optional @ParamName("bufferUsageReportingInterval") Double bufferUsageReportingInterval,
59-
@Optional @ParamName("transferMode") TransferMode transferMode,
59+
@Optional @ParamName("transferMode") StartTransferMode transferMode,
6060
@Optional @ParamName("traceConfig") TraceConfig traceConfig);
6161

6262
/** Stop trace events collection. */

cdt-java-client/src/main/java/com/github/kklisura/cdt/protocol/events/debugger/Paused.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class Paused {
3131

3232
private List<CallFrame> callFrames;
3333

34-
private Reason reason;
34+
private PausedReason reason;
3535

3636
@Optional private Map<String, Object> data;
3737

@@ -50,12 +50,12 @@ public void setCallFrames(List<CallFrame> callFrames) {
5050
}
5151

5252
/** Pause reason. */
53-
public Reason getReason() {
53+
public PausedReason getReason() {
5454
return reason;
5555
}
5656

5757
/** Pause reason. */
58-
public void setReason(Reason reason) {
58+
public void setReason(PausedReason reason) {
5959
this.reason = reason;
6060
}
6161

cdt-java-client/src/main/java/com/github/kklisura/cdt/protocol/events/debugger/Reason.java renamed to cdt-java-client/src/main/java/com/github/kklisura/cdt/protocol/events/debugger/PausedReason.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import com.fasterxml.jackson.annotation.JsonProperty;
2424

2525
/** Pause reason. */
26-
public enum Reason {
26+
public enum PausedReason {
2727
@JsonProperty("XHR")
2828
XHR,
2929
@JsonProperty("DOM")

cdt-java-client/src/main/java/com/github/kklisura/cdt/protocol/events/page/FrameScheduledNavigation.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class FrameScheduledNavigation {
3030

3131
private Double delay;
3232

33-
@Experimental private Reason reason;
33+
@Experimental private FrameScheduledNavigationReason reason;
3434

3535
@Experimental private String url;
3636

@@ -61,12 +61,12 @@ public void setDelay(Double delay) {
6161
}
6262

6363
/** The reason for the navigation. */
64-
public Reason getReason() {
64+
public FrameScheduledNavigationReason getReason() {
6565
return reason;
6666
}
6767

6868
/** The reason for the navigation. */
69-
public void setReason(Reason reason) {
69+
public void setReason(FrameScheduledNavigationReason reason) {
7070
this.reason = reason;
7171
}
7272

0 commit comments

Comments
 (0)