From 5c6874f131abdab8f900bb4e50c9320ae201b2f0 Mon Sep 17 00:00:00 2001 From: Delta456 Date: Wed, 16 Apr 2025 12:56:58 +0530 Subject: [PATCH 1/3] [java][BiDi] implement web extensions --- .../openqa/selenium/bidi/module/BUILD.bazel | 1 + .../selenium/bidi/webextension/BUILD.bazel | 25 ++++++ .../webextension/ExtensionArchivePath.java | 17 +++++ .../webextension/ExtensionBase64Encoded.java | 17 +++++ .../bidi/webextension/ExtensionData.java | 9 +++ .../bidi/webextension/ExtensionPath.java | 17 +++++ .../InstallExtensionParameters.java | 15 ++++ .../UninstallExtensionParameters.java | 14 ++++ .../bidi/webextension/WebExtension.java | 49 ++++++++++++ .../org/openqa/selenium/remote/BUILD.bazel | 1 + .../openqa/selenium/bidi/input/BUILD.bazel | 1 + .../selenium/bidi/webextension/BUILD.bazel | 37 +++++++++ .../bidi/webextension/WebExtensionTest.java | 72 ++++++++++++++++++ .../selenium/bidi/webextension/signed.xpi | Bin 0 -> 7607 bytes .../unpacked-extension/manifest.json | 11 +++ 15 files changed, 286 insertions(+) create mode 100644 java/src/org/openqa/selenium/bidi/webextension/BUILD.bazel create mode 100644 java/src/org/openqa/selenium/bidi/webextension/ExtensionArchivePath.java create mode 100644 java/src/org/openqa/selenium/bidi/webextension/ExtensionBase64Encoded.java create mode 100644 java/src/org/openqa/selenium/bidi/webextension/ExtensionData.java create mode 100644 java/src/org/openqa/selenium/bidi/webextension/ExtensionPath.java create mode 100644 java/src/org/openqa/selenium/bidi/webextension/InstallExtensionParameters.java create mode 100644 java/src/org/openqa/selenium/bidi/webextension/UninstallExtensionParameters.java create mode 100644 java/src/org/openqa/selenium/bidi/webextension/WebExtension.java create mode 100644 java/test/org/openqa/selenium/bidi/webextension/BUILD.bazel create mode 100644 java/test/org/openqa/selenium/bidi/webextension/WebExtensionTest.java create mode 100644 java/test/org/openqa/selenium/bidi/webextension/signed.xpi create mode 100644 java/test/org/openqa/selenium/bidi/webextension/unpacked-extension/manifest.json diff --git a/java/src/org/openqa/selenium/bidi/module/BUILD.bazel b/java/src/org/openqa/selenium/bidi/module/BUILD.bazel index 13bd4b6452418..bb8e51cb62a9d 100644 --- a/java/src/org/openqa/selenium/bidi/module/BUILD.bazel +++ b/java/src/org/openqa/selenium/bidi/module/BUILD.bazel @@ -25,6 +25,7 @@ java_library( "//java/src/org/openqa/selenium/bidi/permissions", "//java/src/org/openqa/selenium/bidi/script", "//java/src/org/openqa/selenium/bidi/storage", + "//java/src/org/openqa/selenium/bidi/webextension", "//java/src/org/openqa/selenium/json", "//java/src/org/openqa/selenium/remote/http", artifact("com.google.auto.service:auto-service-annotations"), diff --git a/java/src/org/openqa/selenium/bidi/webextension/BUILD.bazel b/java/src/org/openqa/selenium/bidi/webextension/BUILD.bazel new file mode 100644 index 0000000000000..cf1199d8fa9fc --- /dev/null +++ b/java/src/org/openqa/selenium/bidi/webextension/BUILD.bazel @@ -0,0 +1,25 @@ +load("@rules_jvm_external//:defs.bzl", "artifact") +load("//java:defs.bzl", "java_library") + +java_library( + name = "webextension", + srcs = glob( + [ + "*.java", + ], + ), + visibility = [ + "//java/src/org/openqa/selenium/bidi:__subpackages__", + "//java/src/org/openqa/selenium/firefox:__subpackages__", + "//java/src/org/openqa/selenium/remote:__pkg__", + "//java/test/org/openqa/selenium/bidi:__subpackages__", + "//java/test/org/openqa/selenium/grid:__subpackages__", + ], + deps = [ + "//java/src/org/openqa/selenium:core", + "//java/src/org/openqa/selenium/bidi", + "//java/src/org/openqa/selenium/json", + "//java/src/org/openqa/selenium/remote/http", + artifact("com.google.auto.service:auto-service-annotations"), + ], +) diff --git a/java/src/org/openqa/selenium/bidi/webextension/ExtensionArchivePath.java b/java/src/org/openqa/selenium/bidi/webextension/ExtensionArchivePath.java new file mode 100644 index 0000000000000..e27d26cdbadeb --- /dev/null +++ b/java/src/org/openqa/selenium/bidi/webextension/ExtensionArchivePath.java @@ -0,0 +1,17 @@ +package org.openqa.selenium.bidi.webextension; + +import java.util.Map; + +public class ExtensionArchivePath extends ExtensionData { + private final String path; + + public ExtensionArchivePath(String path) { + this.path = path; + } + + @Override + public Map toMap() { + String type = "archivePath"; + return Map.of("extensionData", Map.of("type", type, "path", path)); + } +} diff --git a/java/src/org/openqa/selenium/bidi/webextension/ExtensionBase64Encoded.java b/java/src/org/openqa/selenium/bidi/webextension/ExtensionBase64Encoded.java new file mode 100644 index 0000000000000..7a9ff22d6af6d --- /dev/null +++ b/java/src/org/openqa/selenium/bidi/webextension/ExtensionBase64Encoded.java @@ -0,0 +1,17 @@ +package org.openqa.selenium.bidi.webextension; + +import java.util.Map; + +public class ExtensionBase64Encoded extends ExtensionData { + private final String path; + + public ExtensionBase64Encoded(String path) { + this.path = path; + } + + @Override + public Map toMap() { + String type = "base64"; + return Map.of("extensionData", Map.of("type", type, "path", path)); + } +} diff --git a/java/src/org/openqa/selenium/bidi/webextension/ExtensionData.java b/java/src/org/openqa/selenium/bidi/webextension/ExtensionData.java new file mode 100644 index 0000000000000..53b670dec5684 --- /dev/null +++ b/java/src/org/openqa/selenium/bidi/webextension/ExtensionData.java @@ -0,0 +1,9 @@ +package org.openqa.selenium.bidi.webextension; + +import java.util.Map; + +public abstract class ExtensionData { + public abstract Map toMap(); +} + + diff --git a/java/src/org/openqa/selenium/bidi/webextension/ExtensionPath.java b/java/src/org/openqa/selenium/bidi/webextension/ExtensionPath.java new file mode 100644 index 0000000000000..7d6928cb07b24 --- /dev/null +++ b/java/src/org/openqa/selenium/bidi/webextension/ExtensionPath.java @@ -0,0 +1,17 @@ +package org.openqa.selenium.bidi.webextension; + +import java.util.Map; + +public class ExtensionPath extends ExtensionData { + private final String path; + + public ExtensionPath(String path) { + this.path = path; + } + + @Override + public Map toMap() { + String type = "path"; + return Map.of("extensionData", Map.of("type", type, "path", path)); + } +} diff --git a/java/src/org/openqa/selenium/bidi/webextension/InstallExtensionParameters.java b/java/src/org/openqa/selenium/bidi/webextension/InstallExtensionParameters.java new file mode 100644 index 0000000000000..6e6d97d9caae1 --- /dev/null +++ b/java/src/org/openqa/selenium/bidi/webextension/InstallExtensionParameters.java @@ -0,0 +1,15 @@ +package org.openqa.selenium.bidi.webextension; + + +public class InstallExtensionParameters { + + private final ExtensionData extensionData; + + public InstallExtensionParameters(ExtensionData extensionData) { + this.extensionData = extensionData; + } + + public ExtensionData getExtensionData() { + return extensionData; + } +} diff --git a/java/src/org/openqa/selenium/bidi/webextension/UninstallExtensionParameters.java b/java/src/org/openqa/selenium/bidi/webextension/UninstallExtensionParameters.java new file mode 100644 index 0000000000000..5f95eab67089a --- /dev/null +++ b/java/src/org/openqa/selenium/bidi/webextension/UninstallExtensionParameters.java @@ -0,0 +1,14 @@ +package org.openqa.selenium.bidi.webextension; + +import java.util.Map; + +public class UninstallExtensionParameters { + + public final Map extension; + + public UninstallExtensionParameters(Map extension) { + this.extension = extension; + } + + +} diff --git a/java/src/org/openqa/selenium/bidi/webextension/WebExtension.java b/java/src/org/openqa/selenium/bidi/webextension/WebExtension.java new file mode 100644 index 0000000000000..aa31be20dfdd0 --- /dev/null +++ b/java/src/org/openqa/selenium/bidi/webextension/WebExtension.java @@ -0,0 +1,49 @@ +// 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 +// regarding copyright ownership. The SFC licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.openqa.selenium.bidi.webextension; + +import java.util.Map; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.bidi.BiDi; +import org.openqa.selenium.bidi.Command; +import org.openqa.selenium.bidi.HasBiDi; +import org.openqa.selenium.internal.Require; + +public class WebExtension { + private final BiDi bidi; + + public WebExtension(WebDriver driver) { + Require.nonNull("WebDriver", driver); + + if (!(driver instanceof HasBiDi)) { + throw new IllegalArgumentException("WebDriver instance must support BiDi protocol"); + } + + this.bidi = ((HasBiDi) driver).getBiDi(); + } + + public Map Install(InstallExtensionParameters parameters) { + Require.nonNull("Install parameters", parameters); + return bidi.send(new Command<>("webExtension.install", parameters.getExtensionData().toMap(), Map.class)); + } + + public Map Uninstall(UninstallExtensionParameters parameters) { + Require.nonNull("Uninstall parameters", parameters); + return bidi.send(new Command<>("webExtension.uninstall", parameters.extension, Map.class)); + } +} diff --git a/java/src/org/openqa/selenium/remote/BUILD.bazel b/java/src/org/openqa/selenium/remote/BUILD.bazel index 0834343da717f..d5eabf080dcea 100644 --- a/java/src/org/openqa/selenium/remote/BUILD.bazel +++ b/java/src/org/openqa/selenium/remote/BUILD.bazel @@ -34,6 +34,7 @@ java_export( "//java/src/org/openqa/selenium/bidi/permissions", "//java/src/org/openqa/selenium/bidi/script", "//java/src/org/openqa/selenium/bidi/storage", + "//java/src/org/openqa/selenium/bidi/webextension", "//java/src/org/openqa/selenium/devtools", "//java/src/org/openqa/selenium/devtools:augmenter", "//java/src/org/openqa/selenium/os", diff --git a/java/test/org/openqa/selenium/bidi/input/BUILD.bazel b/java/test/org/openqa/selenium/bidi/input/BUILD.bazel index 690d36b9a0de4..b0a129cd85bd6 100644 --- a/java/test/org/openqa/selenium/bidi/input/BUILD.bazel +++ b/java/test/org/openqa/selenium/bidi/input/BUILD.bazel @@ -24,6 +24,7 @@ java_selenium_test_suite( "//java/src/org/openqa/selenium/bidi/network", "//java/src/org/openqa/selenium/bidi/permissions", "//java/src/org/openqa/selenium/bidi/script", + "//java/src/org/openqa/selenium/bidi/webextension", "//java/src/org/openqa/selenium/chrome", "//java/src/org/openqa/selenium/firefox", "//java/src/org/openqa/selenium/json", diff --git a/java/test/org/openqa/selenium/bidi/webextension/BUILD.bazel b/java/test/org/openqa/selenium/bidi/webextension/BUILD.bazel new file mode 100644 index 0000000000000..e9875ce55266b --- /dev/null +++ b/java/test/org/openqa/selenium/bidi/webextension/BUILD.bazel @@ -0,0 +1,37 @@ +load("@rules_jvm_external//:defs.bzl", "artifact") +load("//java:defs.bzl", "JUNIT5_DEPS", "java_selenium_test_suite") + +java_selenium_test_suite( + name = "large-tests", + size = "large", + srcs = glob(["*Test.java"]), + browsers = [ + "firefox", + ], + data = ["signed.xpi"] + glob(["unpacked-extension/**/*"]), + tags = [ + "selenium-remote", + ], + deps = [ + "//java/src/org/openqa/selenium/bidi", + "//java/src/org/openqa/selenium/bidi/browsingcontext", + "//java/src/org/openqa/selenium/bidi/log", + "//java/src/org/openqa/selenium/bidi/module", + "//java/src/org/openqa/selenium/bidi/network", + "//java/src/org/openqa/selenium/bidi/script", + "//java/src/org/openqa/selenium/bidi/webextension", + "//java/src/org/openqa/selenium/firefox", + "//java/src/org/openqa/selenium/grid/security", + "//java/src/org/openqa/selenium/json", + "//java/src/org/openqa/selenium/manager", + "//java/src/org/openqa/selenium/remote", + "//java/src/org/openqa/selenium/support", + "//java/test/org/openqa/selenium/environment", + "//java/test/org/openqa/selenium/testing:annotations", + "//java/test/org/openqa/selenium/testing:test-base", + "//java/test/org/openqa/selenium/testing/drivers", + artifact("com.google.guava:guava"), + artifact("org.junit.jupiter:junit-jupiter-api"), + artifact("org.assertj:assertj-core"), + ] + JUNIT5_DEPS, +) diff --git a/java/test/org/openqa/selenium/bidi/webextension/WebExtensionTest.java b/java/test/org/openqa/selenium/bidi/webextension/WebExtensionTest.java new file mode 100644 index 0000000000000..4a1d6b2704939 --- /dev/null +++ b/java/test/org/openqa/selenium/bidi/webextension/WebExtensionTest.java @@ -0,0 +1,72 @@ +package org.openqa.selenium.bidi.webextension; + +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.firefox.FirefoxOptions; +import org.openqa.selenium.manager.SeleniumManager; +import org.openqa.selenium.testing.JupiterTestBase; + +public class WebExtensionTest extends JupiterTestBase { + + private final Map extensionData = Map.of( + "id", "1FC7D53C-0B0A-49E7-A8C0-47E77496A919@web-platform-tests.org", + "path", getExtensionPath("unpacked-extension"), + "archivePath", getExtensionPath("signed.xpi") + ); + + @BeforeEach + void setUp() { + Logger rootLogger = Logger.getLogger(""); + Arrays.stream(rootLogger.getHandlers()) + .forEach( + handler -> { + handler.setLevel(Level.FINE); + }); + Logger smLogger = Logger.getLogger(SeleniumManager.class.getName()); + smLogger.setLevel(Level.FINE); + FirefoxOptions options = new FirefoxOptions(); + options.setBinary("/Applications/Firefox Nightly.app/Contents/MacOS/firefox"); + options.setCapability("webSocketUrl", true); + driver = new FirefoxDriver(options); + } + + public static String getExtensionPath(String filename) { + String currentDir = Paths.get("").toAbsolutePath().toString(); + return Paths.get(currentDir, "webextension", filename).toString(); + } + + @Test + void installExtensionPath() { + WebExtension extension = new WebExtension(driver); + var exIn = + extension.Install( + new InstallExtensionParameters( + new ExtensionPath( + extensionData.get("path")))); + assert exIn.get("extension") + .equals(extensionData.get("id")); + + extension.Uninstall(new UninstallExtensionParameters(exIn)); + } + + @Test + void installArchiveExtensionPath() { + WebExtension Extension = new WebExtension(driver); + var ex = + Extension.Install( + new InstallExtensionParameters( + new ExtensionArchivePath( + extensionData.get("archivePath")))); + assert ex.get("extension") + .equals(extensionData.get("id")); + + Extension.Uninstall(new UninstallExtensionParameters(ex)); + } + +} diff --git a/java/test/org/openqa/selenium/bidi/webextension/signed.xpi b/java/test/org/openqa/selenium/bidi/webextension/signed.xpi new file mode 100644 index 0000000000000000000000000000000000000000..5d94034364350a31e1bb7b11d27eb26464d49aa0 GIT binary patch literal 7607 zcmaKxbyOVNmd0_{;LyPd?j*QNaF;;iPJ(;mF2NlF!QE+G8VH`?fuM~98V~NlhP!6& zd-vX%H@ntZt4`HAyY{zN{c(QhQ&&PnB7{SGzWy25&kr2T9PO;F+}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F3z;0MJt)%s0()SbfdkT=g`u{=~4W>tZ?DsXkxe` zN#3BQ-NpzMb!KtU(9Pm>Wml@7Gtzr9tE?_}-&vR}IbK&N-V02|TC&prk|Ltgiv9{? z5!2tLL+AkgRaQ^Jm->8bYD~o-IJlAOyU8z;YAIWjo3`D!OsChXOxrtqgsG362*YR( zJaa!kON{qaagE_*LRTQD^$hMUz}x#7tXYbhupty1{Y@)>qNcOQ#1s1xNblADaY@g2Ex^$n~-M;;mmY>go)!VtOZ2tbHfSOmj=#M zKUscKkZa~PI+{t$E8}t+EUVvx)@|_Af2xn)cAPzD)p&hHtl8t1Xd3W-vV+L-L3Zqm z;YN$h;0$?~@|KV}XkbsZsPDjQr$Yx)#K(w(6AtXmom2lIrJS0_^UDB~TbFaNN87rQ zc1Dl%VwKB;AvAXo3c6X)ExFT`Gd`y90{l=cRpa8dJFV2?Gdx*TOG?ojTLgqXBW=DTzbQ?*hL;Sysf7J4hSOE-t9>*VV6TVpeaNC3M zCj*+juPEz#HvjmZT_bfRcmzVYfBS=fwbTCa2mc=bIzaftE&S)wzdBWa_-+4=gXi1- z+kN|Ij=vsi{NZW+J4Ta|0|;Z!La`h80KG=|4W90^*=NGm5={G`G1Gb tb36W3fWyDQ{+|i{+T6dFK#uc&BzT5ubtPn!KR$! Date: Wed, 23 Apr 2025 13:43:32 +0530 Subject: [PATCH 2/3] cleanup --- .../webextension/ExtensionArchivePath.java | 17 ++++ .../webextension/ExtensionBase64Encoded.java | 25 ++++- .../bidi/webextension/ExtensionData.java | 19 +++- .../bidi/webextension/ExtensionPath.java | 17 ++++ .../InstallExtensionParameters.java | 18 +++- .../UninstallExtensionParameters.java | 19 +++- .../bidi/webextension/WebExtension.java | 3 +- .../selenium/bidi/webextension/BUILD.bazel | 2 +- .../bidi/webextension/WebExtensionTest.java | 96 +++++++++--------- .../selenium/bidi/webextension/signed.xpi | Bin 7607 -> 0 bytes .../unpacked-extension/manifest.json | 11 -- 11 files changed, 159 insertions(+), 68 deletions(-) delete mode 100644 java/test/org/openqa/selenium/bidi/webextension/signed.xpi delete mode 100644 java/test/org/openqa/selenium/bidi/webextension/unpacked-extension/manifest.json diff --git a/java/src/org/openqa/selenium/bidi/webextension/ExtensionArchivePath.java b/java/src/org/openqa/selenium/bidi/webextension/ExtensionArchivePath.java index e27d26cdbadeb..465aa08f740b1 100644 --- a/java/src/org/openqa/selenium/bidi/webextension/ExtensionArchivePath.java +++ b/java/src/org/openqa/selenium/bidi/webextension/ExtensionArchivePath.java @@ -1,3 +1,20 @@ +// 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 +// regarding copyright ownership. The SFC licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + package org.openqa.selenium.bidi.webextension; import java.util.Map; diff --git a/java/src/org/openqa/selenium/bidi/webextension/ExtensionBase64Encoded.java b/java/src/org/openqa/selenium/bidi/webextension/ExtensionBase64Encoded.java index 7a9ff22d6af6d..06a7e49dc0d0d 100644 --- a/java/src/org/openqa/selenium/bidi/webextension/ExtensionBase64Encoded.java +++ b/java/src/org/openqa/selenium/bidi/webextension/ExtensionBase64Encoded.java @@ -1,17 +1,34 @@ +// 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 +// regarding copyright ownership. The SFC licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + package org.openqa.selenium.bidi.webextension; import java.util.Map; public class ExtensionBase64Encoded extends ExtensionData { - private final String path; + private final String value; - public ExtensionBase64Encoded(String path) { - this.path = path; + public ExtensionBase64Encoded(String value) { + this.value = value; } @Override public Map toMap() { String type = "base64"; - return Map.of("extensionData", Map.of("type", type, "path", path)); + return Map.of("extensionData", Map.of("type", type, "value", value)); } } diff --git a/java/src/org/openqa/selenium/bidi/webextension/ExtensionData.java b/java/src/org/openqa/selenium/bidi/webextension/ExtensionData.java index 53b670dec5684..61347c5fa5eff 100644 --- a/java/src/org/openqa/selenium/bidi/webextension/ExtensionData.java +++ b/java/src/org/openqa/selenium/bidi/webextension/ExtensionData.java @@ -1,3 +1,20 @@ +// 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 +// regarding copyright ownership. The SFC licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + package org.openqa.selenium.bidi.webextension; import java.util.Map; @@ -5,5 +22,3 @@ public abstract class ExtensionData { public abstract Map toMap(); } - - diff --git a/java/src/org/openqa/selenium/bidi/webextension/ExtensionPath.java b/java/src/org/openqa/selenium/bidi/webextension/ExtensionPath.java index 7d6928cb07b24..1839ab5c3e0d1 100644 --- a/java/src/org/openqa/selenium/bidi/webextension/ExtensionPath.java +++ b/java/src/org/openqa/selenium/bidi/webextension/ExtensionPath.java @@ -1,3 +1,20 @@ +// 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 +// regarding copyright ownership. The SFC licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + package org.openqa.selenium.bidi.webextension; import java.util.Map; diff --git a/java/src/org/openqa/selenium/bidi/webextension/InstallExtensionParameters.java b/java/src/org/openqa/selenium/bidi/webextension/InstallExtensionParameters.java index 6e6d97d9caae1..7c5df23509e86 100644 --- a/java/src/org/openqa/selenium/bidi/webextension/InstallExtensionParameters.java +++ b/java/src/org/openqa/selenium/bidi/webextension/InstallExtensionParameters.java @@ -1,5 +1,21 @@ -package org.openqa.selenium.bidi.webextension; +// 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 +// regarding copyright ownership. The SFC licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.openqa.selenium.bidi.webextension; public class InstallExtensionParameters { diff --git a/java/src/org/openqa/selenium/bidi/webextension/UninstallExtensionParameters.java b/java/src/org/openqa/selenium/bidi/webextension/UninstallExtensionParameters.java index 5f95eab67089a..763997c06bb73 100644 --- a/java/src/org/openqa/selenium/bidi/webextension/UninstallExtensionParameters.java +++ b/java/src/org/openqa/selenium/bidi/webextension/UninstallExtensionParameters.java @@ -1,3 +1,20 @@ +// 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 +// regarding copyright ownership. The SFC licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + package org.openqa.selenium.bidi.webextension; import java.util.Map; @@ -9,6 +26,4 @@ public class UninstallExtensionParameters { public UninstallExtensionParameters(Map extension) { this.extension = extension; } - - } diff --git a/java/src/org/openqa/selenium/bidi/webextension/WebExtension.java b/java/src/org/openqa/selenium/bidi/webextension/WebExtension.java index aa31be20dfdd0..c0e4ce9f062fb 100644 --- a/java/src/org/openqa/selenium/bidi/webextension/WebExtension.java +++ b/java/src/org/openqa/selenium/bidi/webextension/WebExtension.java @@ -39,7 +39,8 @@ public WebExtension(WebDriver driver) { public Map Install(InstallExtensionParameters parameters) { Require.nonNull("Install parameters", parameters); - return bidi.send(new Command<>("webExtension.install", parameters.getExtensionData().toMap(), Map.class)); + return bidi.send( + new Command<>("webExtension.install", parameters.getExtensionData().toMap(), Map.class)); } public Map Uninstall(UninstallExtensionParameters parameters) { diff --git a/java/test/org/openqa/selenium/bidi/webextension/BUILD.bazel b/java/test/org/openqa/selenium/bidi/webextension/BUILD.bazel index e9875ce55266b..ae482e778df94 100644 --- a/java/test/org/openqa/selenium/bidi/webextension/BUILD.bazel +++ b/java/test/org/openqa/selenium/bidi/webextension/BUILD.bazel @@ -8,7 +8,6 @@ java_selenium_test_suite( browsers = [ "firefox", ], - data = ["signed.xpi"] + glob(["unpacked-extension/**/*"]), tags = [ "selenium-remote", ], @@ -26,6 +25,7 @@ java_selenium_test_suite( "//java/src/org/openqa/selenium/manager", "//java/src/org/openqa/selenium/remote", "//java/src/org/openqa/selenium/support", + "//java/test/org/openqa/selenium/build", "//java/test/org/openqa/selenium/environment", "//java/test/org/openqa/selenium/testing:annotations", "//java/test/org/openqa/selenium/testing:test-base", diff --git a/java/test/org/openqa/selenium/bidi/webextension/WebExtensionTest.java b/java/test/org/openqa/selenium/bidi/webextension/WebExtensionTest.java index 4a1d6b2704939..f79dec15c86af 100644 --- a/java/test/org/openqa/selenium/bidi/webextension/WebExtensionTest.java +++ b/java/test/org/openqa/selenium/bidi/webextension/WebExtensionTest.java @@ -1,72 +1,76 @@ +// 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 +// regarding copyright ownership. The SFC licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + package org.openqa.selenium.bidi.webextension; -import java.nio.file.Paths; -import java.util.Arrays; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Base64; import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.openqa.selenium.firefox.FirefoxDriver; -import org.openqa.selenium.firefox.FirefoxOptions; -import org.openqa.selenium.manager.SeleniumManager; +import org.openqa.selenium.build.InProject; import org.openqa.selenium.testing.JupiterTestBase; public class WebExtensionTest extends JupiterTestBase { - private final Map extensionData = Map.of( - "id", "1FC7D53C-0B0A-49E7-A8C0-47E77496A919@web-platform-tests.org", - "path", getExtensionPath("unpacked-extension"), - "archivePath", getExtensionPath("signed.xpi") - ); - - @BeforeEach - void setUp() { - Logger rootLogger = Logger.getLogger(""); - Arrays.stream(rootLogger.getHandlers()) - .forEach( - handler -> { - handler.setLevel(Level.FINE); - }); - Logger smLogger = Logger.getLogger(SeleniumManager.class.getName()); - smLogger.setLevel(Level.FINE); - FirefoxOptions options = new FirefoxOptions(); - options.setBinary("/Applications/Firefox Nightly.app/Contents/MacOS/firefox"); - options.setCapability("webSocketUrl", true); - driver = new FirefoxDriver(options); - } - - public static String getExtensionPath(String filename) { - String currentDir = Paths.get("").toAbsolutePath().toString(); - return Paths.get(currentDir, "webextension", filename).toString(); - } + private final Map extensionData = + Map.of( + "id", "webextensions-selenium-example-v3@example.com", + "path", "common/extensions/webextensions-selenium-example-signed", + "archivePath", "common/extensions/webextensions-selenium-example.xpi"); @Test void installExtensionPath() { + Path path = InProject.locate(extensionData.get("path")); + WebExtension extension = new WebExtension(driver); var exIn = - extension.Install( - new InstallExtensionParameters( - new ExtensionPath( - extensionData.get("path")))); - assert exIn.get("extension") - .equals(extensionData.get("id")); + extension.Install(new InstallExtensionParameters(new ExtensionPath(path.toString()))); + assert exIn.get("extension").equals(extensionData.get("id")); extension.Uninstall(new UninstallExtensionParameters(exIn)); } @Test void installArchiveExtensionPath() { + Path path = InProject.locate(extensionData.get("archivePath")); + WebExtension Extension = new WebExtension(driver); var ex = - Extension.Install( - new InstallExtensionParameters( - new ExtensionArchivePath( - extensionData.get("archivePath")))); - assert ex.get("extension") - .equals(extensionData.get("id")); + Extension.Install( + new InstallExtensionParameters(new ExtensionArchivePath(path.toString()))); + assert ex.get("extension").equals(extensionData.get("id")); Extension.Uninstall(new UninstallExtensionParameters(ex)); } + @Test + void installBase64ExtensionPath() throws IOException { + Path path = InProject.locate(extensionData.get("archivePath")); + + WebExtension Extension = new WebExtension(driver); + var ex = + Extension.Install( + new InstallExtensionParameters( + new ExtensionBase64Encoded( + Base64.getEncoder().encodeToString(Files.readAllBytes(path))))); + assert ex.get("extension").equals(extensionData.get("id")); + + Extension.Uninstall(new UninstallExtensionParameters(ex)); + } } diff --git a/java/test/org/openqa/selenium/bidi/webextension/signed.xpi b/java/test/org/openqa/selenium/bidi/webextension/signed.xpi deleted file mode 100644 index 5d94034364350a31e1bb7b11d27eb26464d49aa0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 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Qy);HG?;;QC5fy*^(LdV+kviv;RK7*Gy zmdt}S!IT7o#(;2)<1NEbu{b;uzWue~&OQ3V?NF+voR@TV=Qc8AH#34fh%|()2X>Q_ z`fncRx;ZC7z@*)`8DFaUexr>F3z;0MJt)%s0()SbfdkT=g`u{=~4W>tZ?DsXkxe` zN#3BQ-NpzMb!KtU(9Pm>Wml@7Gtzr9tE?_}-&vR}IbK&N-V02|TC&prk|Ltgiv9{? z5!2tLL+AkgRaQ^Jm->8bYD~o-IJlAOyU8z;YAIWjo3`D!OsChXOxrtqgsG362*YR( zJaa!kON{qaagE_*LRTQD^$hMUz}x#7tXYbhupty1{Y@)>qNcOQ#1s1xNblADaY@g2Ex^$n~-M;;mmY>go)!VtOZ2tbHfSOmj=#M zKUscKkZa~PI+{t$E8}t+EUVvx)@|_Af2xn)cAPzD)p&hHtl8t1Xd3W-vV+L-L3Zqm z;YN$h;0$?~@|KV}XkbsZsPDjQr$Yx)#K(w(6AtXmom2lIrJS0_^UDB~TbFaNN87rQ zc1Dl%VwKB;AvAXo3c6X)ExFT`Gd`y90{l=cRpa8dJFV2?Gdx*TOG?ojTLgqXBW=DTzbQ?*hL;Sysf7J4hSOE-t9>*VV6TVpeaNC3M zCj*+juPEz#HvjmZT_bfRcmzVYfBS=fwbTCa2mc=bIzaftE&S)wzdBWa_-+4=gXi1- z+kN|Ij=vsi{NZW+J4Ta|0|;Z!La`h80KG=|4W90^*=NGm5={G`G1Gb tb36W3fWyDQ{+|i{+T6dFK#uc&BzT5ubtPn!KR$! Date: Wed, 14 May 2025 16:09:56 +0530 Subject: [PATCH 3/3] fix spotbug --- .../selenium/bidi/webextension/WebExtension.java | 4 ++-- .../selenium/bidi/webextension/WebExtensionTest.java | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/java/src/org/openqa/selenium/bidi/webextension/WebExtension.java b/java/src/org/openqa/selenium/bidi/webextension/WebExtension.java index c0e4ce9f062fb..99e8142e55054 100644 --- a/java/src/org/openqa/selenium/bidi/webextension/WebExtension.java +++ b/java/src/org/openqa/selenium/bidi/webextension/WebExtension.java @@ -37,13 +37,13 @@ public WebExtension(WebDriver driver) { this.bidi = ((HasBiDi) driver).getBiDi(); } - public Map Install(InstallExtensionParameters parameters) { + public Map install(InstallExtensionParameters parameters) { Require.nonNull("Install parameters", parameters); return bidi.send( new Command<>("webExtension.install", parameters.getExtensionData().toMap(), Map.class)); } - public Map Uninstall(UninstallExtensionParameters parameters) { + public Map uninstall(UninstallExtensionParameters parameters) { Require.nonNull("Uninstall parameters", parameters); return bidi.send(new Command<>("webExtension.uninstall", parameters.extension, Map.class)); } diff --git a/java/test/org/openqa/selenium/bidi/webextension/WebExtensionTest.java b/java/test/org/openqa/selenium/bidi/webextension/WebExtensionTest.java index f79dec15c86af..a7ed5c37ed458 100644 --- a/java/test/org/openqa/selenium/bidi/webextension/WebExtensionTest.java +++ b/java/test/org/openqa/selenium/bidi/webextension/WebExtensionTest.java @@ -40,10 +40,10 @@ void installExtensionPath() { WebExtension extension = new WebExtension(driver); var exIn = - extension.Install(new InstallExtensionParameters(new ExtensionPath(path.toString()))); + extension.install(new InstallExtensionParameters(new ExtensionPath(path.toString()))); assert exIn.get("extension").equals(extensionData.get("id")); - extension.Uninstall(new UninstallExtensionParameters(exIn)); + extension.uninstall(new UninstallExtensionParameters(exIn)); } @Test @@ -52,11 +52,11 @@ void installArchiveExtensionPath() { WebExtension Extension = new WebExtension(driver); var ex = - Extension.Install( + Extension.install( new InstallExtensionParameters(new ExtensionArchivePath(path.toString()))); assert ex.get("extension").equals(extensionData.get("id")); - Extension.Uninstall(new UninstallExtensionParameters(ex)); + Extension.uninstall(new UninstallExtensionParameters(ex)); } @Test @@ -65,12 +65,12 @@ void installBase64ExtensionPath() throws IOException { WebExtension Extension = new WebExtension(driver); var ex = - Extension.Install( + Extension.install( new InstallExtensionParameters( new ExtensionBase64Encoded( Base64.getEncoder().encodeToString(Files.readAllBytes(path))))); assert ex.get("extension").equals(extensionData.get("id")); - Extension.Uninstall(new UninstallExtensionParameters(ex)); + Extension.uninstall(new UninstallExtensionParameters(ex)); } }