Skip to content

Commit

Permalink
Add url and faviconUrl properties to ChromeDPTarget
Browse files Browse the repository at this point in the history
Resolves:
#305
  • Loading branch information
joffrey-bion committed Oct 8, 2023
1 parent 424b351 commit 60c9c47
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
13 changes: 9 additions & 4 deletions api/chrome-devtools-kotlin.api
Original file line number Diff line number Diff line change
Expand Up @@ -46463,22 +46463,27 @@ public final class org/hildan/chrome/devtools/protocol/ChromeDPClientKt {

public final class org/hildan/chrome/devtools/protocol/ChromeDPTarget {
public static final field Companion Lorg/hildan/chrome/devtools/protocol/ChromeDPTarget$Companion;
public synthetic fun <init> (ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
public synthetic fun <init> (ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Ljava/lang/String;
public final fun component3 ()Ljava/lang/String;
public final fun component4 ()Ljava/lang/String;
public final fun component5 ()Ljava/lang/String;
public final fun component6 ()Ljava/lang/String;
public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lorg/hildan/chrome/devtools/protocol/ChromeDPTarget;
public static synthetic fun copy$default (Lorg/hildan/chrome/devtools/protocol/ChromeDPTarget;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lorg/hildan/chrome/devtools/protocol/ChromeDPTarget;
public final fun component7 ()Ljava/lang/String;
public final fun component8 ()Ljava/lang/String;
public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lorg/hildan/chrome/devtools/protocol/ChromeDPTarget;
public static synthetic fun copy$default (Lorg/hildan/chrome/devtools/protocol/ChromeDPTarget;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lorg/hildan/chrome/devtools/protocol/ChromeDPTarget;
public fun equals (Ljava/lang/Object;)Z
public final fun getDescription ()Ljava/lang/String;
public final fun getDevtoolsFrontendUrl ()Ljava/lang/String;
public final fun getFaviconUrl ()Ljava/lang/String;
public final fun getId ()Ljava/lang/String;
public final fun getTitle ()Ljava/lang/String;
public final fun getType ()Ljava/lang/String;
public final fun getUrl ()Ljava/lang/String;
public final fun getWebSocketDebuggerUrl ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,13 @@ data class ChromeDPTarget(
val title: String,
val type: String,
val description: String,
val url: String,
val devtoolsFrontendUrl: String,
/**
* The web socket URL to use with [HttpClient.chromeWebSocket] to connect via the debugger to this target.
*/
val webSocketDebuggerUrl: String,
val faviconUrl: String? = null,
)

/**
Expand Down
8 changes: 6 additions & 2 deletions src/jvmTest/kotlin/IntegrationTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,15 @@ class IntegrationTests {
assertTrue(version.userAgent.contains("HeadlessChrome"))
assertTrue(version.webSocketDebuggerUrl.startsWith("ws://localhost"))

val protocolJson = chrome.protocolJson()
assertTrue(protocolJson.isNotEmpty(), "the JSON definition of the protocol should not be empty")

val targets = chrome.targets()
assertTrue(targets.isNotEmpty(), "there should be at least the about:blank target")

val protocolJson = chrome.protocolJson()
assertTrue(protocolJson.isNotEmpty(), "the JSON definition of the protocol should not be empty")
val googleTab = chrome.newTab("https://www.google.com")
assertEquals("https://www.google.com", googleTab.url.trimEnd('/'))
chrome.closeTab(googleTab.id)
}
}

Expand Down

0 comments on commit 60c9c47

Please sign in to comment.