aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Bochkarev <artem.bochkarev@jetbrains.com>2022-10-01 14:17:27 +0700
committerArtem Bochkarev <artem.bochkarev@jetbrains.com>2022-10-01 14:17:27 +0700
commit12b2b54a922a0e9fb48fab6febf08e0aa256a634 (patch)
tree9ef9115418b8f93a6da3892c8e3e6e50df4f1dee
parent8c11b1633b6ba91f045bc08b307bebf7a44e183d (diff)
downloadJetBrainsRuntime-12b2b54a922a0e9fb48fab6febf08e0aa256a634.tar.gz
JBR-4876 remove test duplicatesjb17-b634
Since next jcef tests were moved into junit suite (inside jcef repository): HandleJSQueryTest JCEFStartupTest LoadPageWithoutUI MouseEventAfterHideAndShowBrowserTest MouseEventScenario MouseEventTest
-rw-r--r--test/jdk/jb/java/jcef/HandleJSQueryTest.java118
-rw-r--r--test/jdk/jb/java/jcef/HandleJSQueryTest3314.sh62
-rw-r--r--test/jdk/jb/java/jcef/JBCefApp.java95
-rw-r--r--test/jdk/jb/java/jcef/JBCefBrowser.java105
-rw-r--r--test/jdk/jb/java/jcef/JCEFStartupTest.java85
-rw-r--r--test/jdk/jb/java/jcef/LoadPageWithoutUI.java126
-rw-r--r--test/jdk/jb/java/jcef/MouseEventAfterHideAndShowBrowserTest.java40
-rw-r--r--test/jdk/jb/java/jcef/MouseEventScenario.java245
-rw-r--r--test/jdk/jb/java/jcef/MouseEventTest.java33
-rw-r--r--test/jdk/jb/java/jcef/dummy.html10
10 files changed, 0 insertions, 919 deletions
diff --git a/test/jdk/jb/java/jcef/HandleJSQueryTest.java b/test/jdk/jb/java/jcef/HandleJSQueryTest.java
deleted file mode 100644
index c6acb31cb47..00000000000
--- a/test/jdk/jb/java/jcef/HandleJSQueryTest.java
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
-
-import org.cef.browser.CefBrowser;
-import org.cef.browser.CefFrame;
-import org.cef.browser.CefMessageRouter;
-import org.cef.handler.CefLoadHandlerAdapter;
-import org.cef.callback.CefQueryCallback;
-import org.cef.handler.CefMessageRouterHandlerAdapter;
-import org.cef.network.CefRequest.TransitionType;
-
-import javax.swing.*;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.lang.reflect.InvocationTargetException;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-/**
- * @test
- * @key headful
- * @summary Regression test for JBR-2430. The test checks that JS Query is handled in 2nd opened browser.
- * @run main/othervm HandleJSQueryTest
- */
-
-public class HandleJSQueryTest {
-
- public static void main(String[] args) throws InvocationTargetException, InterruptedException {
- final CountDownLatch firstLatch = new CountDownLatch(1);
- final CountDownLatch secondLatch = new CountDownLatch(1);
- CefBrowserFrame firstBrowser = new CefBrowserFrame(firstLatch);
- CefBrowserFrame secondBrowser = new CefBrowserFrame(secondLatch);
-
- try {
- SwingUtilities.invokeLater(firstBrowser::initUI);
- firstLatch.await(10, TimeUnit.SECONDS);
-
- SwingUtilities.invokeLater(secondBrowser::initUI);
- secondLatch.await(10, TimeUnit.SECONDS);
-
- if (CefBrowserFrame.callbackCounter < 2) {
- throw new RuntimeException("Test FAILED. JS Query was not handled in 2nd opened browser");
- }
- System.out.println("Test PASSED");
- } finally {
- firstBrowser.getBrowser().dispose();
- secondBrowser.getBrowser().dispose();
- JBCefApp.getInstance().getCefApp().dispose();
- System.out.println("Close all windows");
- SwingUtilities.invokeLater(() -> firstBrowser.dispatchEvent(new WindowEvent(firstBrowser, WindowEvent.WINDOW_CLOSING)));
- SwingUtilities.invokeLater(() -> secondBrowser.dispatchEvent(new WindowEvent(firstBrowser, WindowEvent.WINDOW_CLOSING)));
- }
- }
-}
-
-
-class CefBrowserFrame extends JFrame {
-
- static volatile int callbackCounter;
- static volatile int browserNumber;
-
- private final JBCefBrowser browser = new JBCefBrowser();
-
- private final CountDownLatch latch;
-
- public CefBrowserFrame(final CountDownLatch latch) {
- this.latch=latch;
- }
-
- public void initUI() {
- browserNumber++;
- CefMessageRouter.CefMessageRouterConfig config = new org.cef.browser.CefMessageRouter.CefMessageRouterConfig();
- config.jsQueryFunction = "cef_query_" + browserNumber;
- config.jsCancelFunction = "cef_query_cancel_" + browserNumber;
- CefMessageRouter msgRouter = CefMessageRouter.create(config);
-
- msgRouter.addHandler(new CefMessageRouterHandlerAdapter() {
- @Override
- public boolean onQuery(CefBrowser browser, CefFrame frame, long query_id, String request,
- boolean persistent, CefQueryCallback callback) {
- System.out.println("The query with request " + request + " is handled.");
- callbackCounter++;
- latch.countDown();
- return true;
- }
- }, true);
-
- browser.getCefClient().addMessageRouter(msgRouter);
-
- browser.getCefClient().addLoadHandler(new CefLoadHandlerAdapter() {
- @Override
- public void onLoadStart(CefBrowser browser, CefFrame frame, TransitionType transitionType) {
- System.out.println("onLoadStart: Browser " + browserNumber);
- }
- @Override
- public void onLoadEnd(CefBrowser browser, CefFrame frame, int httpStatusCode) {
- System.out.println("onLoadEnd: Browser " + browserNumber);
- String jsFunc = "cef_query_" + browserNumber;
- String jsQuery = "window." + jsFunc + "({request: '" + jsFunc + "'});";
- browser.executeJavaScript(jsQuery, "", 0);
- }
- });
-
- getContentPane().add(browser.getCefBrowser().getUIComponent());
- setSize(640, 480);
- setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
- addWindowListener(new WindowAdapter() {
- @Override
- public void windowClosed(WindowEvent e) {
- browser.dispose();
- }
- });
- setVisible(true);
- }
-
- public JBCefBrowser getBrowser() {
- return browser;
- }
-} \ No newline at end of file
diff --git a/test/jdk/jb/java/jcef/HandleJSQueryTest3314.sh b/test/jdk/jb/java/jcef/HandleJSQueryTest3314.sh
deleted file mode 100644
index 52f6720268b..00000000000
--- a/test/jdk/jb/java/jcef/HandleJSQueryTest3314.sh
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/bin/bash
-
-#
-# Copyright 2000-2021 JetBrains s.r.o.
-#
-# Licensed 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.
-#
-
-# @test
-# @summary Regression test for JBR-3314
-# It executes the test HandleJSQueryTest.java in a loop till a crash happens or number of iterations
-# exceeds a limit.
-# Number of iterations can be specified via the environment variable RUN_NUMBER, by default it is set to 100.
-# @run shell/timeout=300 HandleJSQueryTest3314.sh
-
-RUNS_NUMBER=${RUN_NUMBER:-50}
-echo "number of iterations: $RUNS_NUMBER"
-
-if [ -z "${TESTSRC}" ]; then
- echo "TESTSRC undefined: set to ."
- TESTSRC=.
-fi
-
-if [ -z "${TESTCLASSES}" ]; then
- echo "TESTCLASSES undefined: set to ."
- TESTCLASSES=.
-fi
-
-if [ -z "${TESTJAVA}" ]; then
- echo "TESTJAVA undefined: testing cancelled"
- exit 1
-fi
-
-curdir=$(pwd)
-cd ${TESTSRC}
-${TESTJAVA}/bin/javac -d ${TESTCLASSES} JBCefApp.java JBCefBrowser.java HandleJSQueryTest.java
-cd $curdir
-
-i=0
-while [ "$i" -le "$RUNS_NUMBER" ]; do
- echo "iteration - $i"
- ${TESTJAVA}/bin/java -cp ${TESTCLASSES} HandleJSQueryTest
- exit_code=$?
- echo "exit_xode=$exit_code"
- if [ $exit_code -ne "0" ]; then
- [[ $exit_code -eq "134" ]] && echo "FAILED: Test crashed" && exit $exit_code
- echo "Test failed because of not a crash. Execution is being conituned"
- fi
- i=$(( i + 1 ))
-done
-echo "PASSED: Test did never crash during $RUNS_NUMBER iterations"
-exit 0
diff --git a/test/jdk/jb/java/jcef/JBCefApp.java b/test/jdk/jb/java/jcef/JBCefApp.java
deleted file mode 100644
index 5e09c8f8521..00000000000
--- a/test/jdk/jb/java/jcef/JBCefApp.java
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
-
-import com.jetbrains.cef.JCefAppConfig;
-import org.cef.CefApp;
-import org.cef.CefClient;
-import org.cef.CefSettings;
-import org.cef.handler.CefAppHandlerAdapter;
-
-import java.awt.*;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.function.Function;
-
-/**
- * @author Anton Tarasov
- */
-public class JBCefApp {
- public static class OS {
- public static final boolean WINDOWS;
- public static final boolean LINUX;
- public static final boolean MAC;
- public static final boolean UNKNOWN;
-
- static {
- String name = System.getProperty("os.name").toLowerCase();
- WINDOWS = name.contains("windows");
- LINUX = name.contains("linux");
- MAC = name.contains("mac") || name.contains("darwin");
- UNKNOWN = !(WINDOWS || LINUX || MAC);
- }
- }
-
- private static JBCefApp INSTANCE;
- private static Function<CefApp.CefAppState, Void> ourCefAppStateHandler;
-
- private final CefApp myCefApp;
-
- private static final AtomicBoolean ourInitialized = new AtomicBoolean(false);
-
- private JBCefApp(JCefAppConfig config) {
- if (!CefApp.startup(new String[]{})) {
- throw new RuntimeException("JCEF startup failed!");
- }
- CefSettings settings = config.getCefSettings();
- settings.windowless_rendering_enabled = false;
- settings.log_severity = CefSettings.LogSeverity.LOGSEVERITY_ERROR;
- CefApp.addAppHandler(new CefAppHandlerAdapter(config.getAppArgs()) {
- @Override
- public void stateHasChanged(CefApp.CefAppState state) {
- if (ourCefAppStateHandler != null) {
- ourCefAppStateHandler.apply(state);
- return;
- }
- super.stateHasChanged(state);
- }
- });
- myCefApp = CefApp.getInstance(settings);
- }
-
- public static JBCefApp getInstance() {
- if (!ourInitialized.getAndSet(true)) {
- JCefAppConfig config = null;
- try {
- config = JCefAppConfig.getInstance();
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- INSTANCE = config != null ? new JBCefApp(config) : null;
- }
- return INSTANCE;
- }
-
- public CefClient createClient() {
- return myCefApp.createClient();
- }
-
- public CefApp getCefApp() {
- return myCefApp;
- }
-
- public static void setCefAppStateHandler(Function<CefApp.CefAppState, Void> stateHandler) {
- if (ourInitialized.get()) {
- throw new IllegalStateException("JBCefApp has already been init'ed");
- }
- ourCefAppStateHandler = stateHandler;
- }
-
- public static double sysScale() {
- try {
- return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().getDefaultTransform().getScaleX();
- } catch (NullPointerException ignore) {}
- return 1.0;
- }
-}
-
diff --git a/test/jdk/jb/java/jcef/JBCefBrowser.java b/test/jdk/jb/java/jcef/JBCefBrowser.java
deleted file mode 100644
index 6b43ff95caa..00000000000
--- a/test/jdk/jb/java/jcef/JBCefBrowser.java
+++ /dev/null
@@ -1,105 +0,0 @@
-import org.cef.CefClient;
-import org.cef.browser.CefBrowser;
-import org.cef.handler.CefLifeSpanHandlerAdapter;
-
-import javax.swing.*;
-import java.awt.Component;
-
-/**
- * @author tav
- */
-public class JBCefBrowser {
- private final CefBrowser myCefBrowser;
- private final CefClient myCefClient;
-
- private volatile boolean myIsCefBrowserCreated;
- private volatile LoadDeferrer myLoadDeferrer;
-
- private static class LoadDeferrer {
- protected final String myHtml;
- protected final String myUrl;
-
- private LoadDeferrer(String html, String url) {
- myHtml = html;
- myUrl = url;
- }
-
- public static LoadDeferrer urlDeferrer(String url) {
- return new LoadDeferrer(null, url);
- }
-
- public static LoadDeferrer htmlDeferrer(String html, String url) {
- return new LoadDeferrer(html, url);
- }
-
- public void load(CefBrowser browser) {
- // JCEF demands async loading.
- SwingUtilities.invokeLater(
- myHtml == null ?
- () -> browser.loadURL(myUrl) :
- () -> loadString(browser, myHtml, myUrl));
- }
- }
-
- public JBCefBrowser() {
- myCefClient = JBCefApp.getInstance().createClient();
- myCefBrowser = myCefClient.createBrowser("about:blank", false, false);
-
- myCefClient.addLifeSpanHandler(new CefLifeSpanHandlerAdapter() {
- @Override
- public void onAfterCreated(CefBrowser browser) {
- myIsCefBrowserCreated = true;
- LoadDeferrer loader = myLoadDeferrer;
- if (loader != null) {
- loader.load(browser);
- myLoadDeferrer = null;
- }
- }
- });
-
- }
-
- public Component getComponent() {
- return myCefBrowser.getUIComponent();
- }
-
- public void loadURL(String url) {
- if (myIsCefBrowserCreated) {
- myCefBrowser.loadURL(url);
- }
- else {
- myLoadDeferrer = LoadDeferrer.urlDeferrer(url);
- }
- }
-
- public void loadHTML(String html, String url) {
- if (myIsCefBrowserCreated) {
- loadString(myCefBrowser, html, url);
- }
- else {
- myLoadDeferrer = LoadDeferrer.htmlDeferrer(html, url);
- }
- }
-
- private static void loadString(CefBrowser cefBrowser, String html, String url) {
- System.out.println("jcef: loadString: " + html);
- throw new UnsupportedOperationException("not yet supported in tests");
- }
-
- public void loadHTML(String html) {
- loadHTML(html, "about:blank");
- }
-
- public CefClient getCefClient() {
- return myCefClient;
- }
-
- public CefBrowser getCefBrowser() {
- return myCefBrowser;
- }
-
- public void dispose() {
- myCefBrowser.close(true);
- myCefClient.dispose();
- }
-}
diff --git a/test/jdk/jb/java/jcef/JCEFStartupTest.java b/test/jdk/jb/java/jcef/JCEFStartupTest.java
deleted file mode 100644
index 31b213b1cc0..00000000000
--- a/test/jdk/jb/java/jcef/JCEFStartupTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
-
-import org.cef.CefApp;
-import org.cef.browser.CefBrowser;
-import org.cef.browser.CefFrame;
-import org.cef.handler.CefLoadHandlerAdapter;
-import org.cef.network.CefRequest;
-
-import javax.swing.*;
-import java.awt.*;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-/**
- * @test
- * @key headful
- * @requires (os.arch == "amd64" | os.arch == "x86_64" | (os.arch == "aarch64" & os.family == "mac"))
- * @summary Tests that JCEF starts and loads empty page with no crash
- * @author Anton Tarasov
- * @run main JCEFStartupTest
- */
-public class JCEFStartupTest {
- static final CountDownLatch LATCH = new CountDownLatch(1);
- static volatile boolean PASSED;
-
- static volatile JBCefBrowser ourBrowser;
-
- JCEFStartupTest() {
- final JFrame frame = new JFrame("JCEF");
-
- JBCefApp.setCefAppStateHandler((state) -> {
- if (state == CefApp.CefAppState.TERMINATED) {
- frame.dispose();
- }
- return null;
- });
-
- ourBrowser = new JBCefBrowser();
- ourBrowser.getCefClient().addLoadHandler(new CefLoadHandlerAdapter() {
- @Override
- public void onLoadStart(CefBrowser cefBrowser, CefFrame cefFrame, CefRequest.TransitionType transitionType) {
- System.out.println("onLoadStart");
- }
- @Override
- public void onLoadEnd(CefBrowser cefBrowser, CefFrame cefFrame, int i) {
- System.out.println("onLoadEnd");
- PASSED = true;
- LATCH.countDown();
- }
- @Override
- public void onLoadError(CefBrowser cefBrowser, CefFrame cefFrame, ErrorCode errorCode, String s, String s1) {
- System.out.println("onLoadError");
- }
- });
-
- frame.add(ourBrowser.getComponent());
-
- frame.setSize(640, 480);
- frame.setLocationRelativeTo(null);
- frame.setVisible(true);
- }
-
- /**
- * Pass "cmd-q" to manually reproduce JBR-2222.
- */
- public static void main(String[] args) {
- EventQueue.invokeLater(JCEFStartupTest::new);
-
- try {
- LATCH.await(5, TimeUnit.SECONDS);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
-
- if (!(args.length > 0 && args[0].equalsIgnoreCase("cmd-q"))) {
- ourBrowser.dispose();
- }
- JBCefApp.getInstance().getCefApp().dispose();
-
- if (!PASSED) {
- throw new RuntimeException("Test FAILED!");
- }
- System.out.println("Test PASSED");
- }
-}
diff --git a/test/jdk/jb/java/jcef/LoadPageWithoutUI.java b/test/jdk/jb/java/jcef/LoadPageWithoutUI.java
deleted file mode 100644
index 47c27fc3bc8..00000000000
--- a/test/jdk/jb/java/jcef/LoadPageWithoutUI.java
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
-
-import org.cef.browser.CefBrowser;
-import org.cef.browser.CefFrame;
-import org.cef.handler.CefLoadHandlerAdapter;
-import org.cef.network.CefRequest;
-
-import javax.swing.*;
-import java.awt.event.*;
-import java.lang.reflect.InvocationTargetException;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-/**
- * @test
- * @key headful
- * @requires (os.arch == "amd64" | os.arch == "x86_64" | (os.arch == "aarch64" & os.family == "mac"))
- * @summary Regression test for JBR-2259. The test checks that website is loaded with and without showing Browser UI.
- * @run main LoadPageWithoutUI
- */
-
-
-/**
- * Description:
- * The test detects callbacks of CefLoadHandler in the following cases:
- * 1. Before showing UI (before frame.setVisible(true) is called)
- * 2. With UI (after frame.setVisible(true) was called)
- * 3. After disable showing UI (after frame.setVisible(false) was called)
- */
-
-public class LoadPageWithoutUI {
- private static final String DUMMY = "file://" + System.getProperty("test.src") + "/dummy.html";
- private static final String BLANK = "about:blank";
-
- private CountDownLatch latch;
- private JBCefBrowser browser = new JBCefBrowser();
- private JFrame frame = new JFrame("JCEF");
-
- private volatile boolean loadHandlerUsed;
-
- public void initUI() {
- browser.getCefClient().addLoadHandler(new CefLoadHandlerAdapter() {
- @Override
- public void onLoadingStateChange(CefBrowser browser, boolean isLoading, boolean canGoBack, boolean canGoForward) {
- System.out.println("onLoadingStateChange " + browser.getURL());
- loadHandlerUsed = true;
- }
-
- @Override
- public void onLoadStart(CefBrowser browser, CefFrame frame, CefRequest.TransitionType transitionType) {
- System.out.println("onLoadStart " + browser.getURL());
- loadHandlerUsed = true;
- }
-
- @Override
- public void onLoadEnd(CefBrowser browser, CefFrame frame, int httpStatusCode) {
- System.out.println("onLoadEnd " + browser.getURL());
- loadHandlerUsed = true;
- latch.countDown();
- }
-
- @Override
- public void onLoadError(CefBrowser browser, CefFrame frame, ErrorCode errorCode, String errorText, String failedUrl) {
- System.out.println("onLoadError " + browser.getURL());
- loadHandlerUsed = true;
- }
- });
- frame.getContentPane().add(browser.getComponent());
- frame.setSize(640, 480);
- frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
- frame.addWindowListener(new WindowAdapter() {
- @Override
- public void windowClosed(WindowEvent e) {
- browser.dispose();
- }
- });
- }
-
- public static void main(String[] args) throws InvocationTargetException, InterruptedException {
- LoadPageWithoutUI test = new LoadPageWithoutUI();
- try {
- test.latch = new CountDownLatch(1);
- SwingUtilities.invokeLater(test::initUI);
- test.latch.await(5, TimeUnit.SECONDS);
-
- test.browser.getCefBrowser().createImmediately();
-
- System.out.println("Loading URL " + BLANK + " before enabling browser UI...");
- test.latch = new CountDownLatch(1);
- test.browser.loadURL(BLANK);
- test.latch.await(5, TimeUnit.SECONDS);
- if (!test.loadHandlerUsed) {
- throw new RuntimeException(BLANK + " is not loaded without browser UI");
- }
- test.loadHandlerUsed = false;
- System.out.println(BLANK + " is loaded");
-
- System.out.println("Loading URL " + DUMMY + " after enabling browser UI...");
- SwingUtilities.invokeAndWait(() -> test.frame.setVisible(true));
- test.latch = new CountDownLatch(1);
- test.browser.loadURL(DUMMY);
- test.latch.await(5, TimeUnit.SECONDS);
- if (!test.loadHandlerUsed) {
- throw new RuntimeException(DUMMY + " is not loaded with browser UI");
- }
- test.loadHandlerUsed = false;
- System.out.println(DUMMY + " is loaded");
-
- System.out.println("Loading URL " + BLANK + " after disabling browser UI...");
- SwingUtilities.invokeAndWait(() -> test.frame.setVisible(false));
- test.latch = new CountDownLatch(1);
- test.browser.loadURL(BLANK);
- test.latch.await(5, TimeUnit.SECONDS);
- if (!test.loadHandlerUsed) {
- throw new RuntimeException(DUMMY + " is not loaded after disabling browser UI");
- }
- test.loadHandlerUsed = false;
- System.out.println(BLANK + " is loaded");
-
- } finally {
- test.browser.dispose();
- JBCefApp.getInstance().getCefApp().dispose();
- SwingUtilities.invokeAndWait(() -> test.frame.dispose());
- }
- }
-} \ No newline at end of file
diff --git a/test/jdk/jb/java/jcef/MouseEventAfterHideAndShowBrowserTest.java b/test/jdk/jb/java/jcef/MouseEventAfterHideAndShowBrowserTest.java
deleted file mode 100644
index 125016d2456..00000000000
--- a/test/jdk/jb/java/jcef/MouseEventAfterHideAndShowBrowserTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
-
-import java.awt.*;
-import java.lang.reflect.InvocationTargetException;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-/**
- * @test
- * @key headful
- * @requires (os.arch == "amd64" | os.arch == "x86_64" | (os.arch == "aarch64" & os.family == "mac"))
- * @summary Regression test for JBR-2412. The test checks that mouse actions are handled on jcef browser after hide and show it.
- * @run main/othervm MouseEventAfterHideAndShowBrowserTest
- */
-
-public class MouseEventAfterHideAndShowBrowserTest {
-
- public static void main(String[] args) throws InvocationTargetException, InterruptedException {
-
- MouseEventScenario scenario = new MouseEventScenario();
- try {
-
- scenario.initUI();
- scenario.mouseMove(scenario.getBrowserFrame().getFrameCenter());
-
- MouseEventScenario.latch = new CountDownLatch(1);
- scenario.getBrowserFrame().hideAndShowBrowser();
- MouseEventScenario.latch.await(2, TimeUnit.SECONDS);
-
- //mouseEntered and mouseExited events work unstable. These actions are not tested.
- scenario.doMouseActions();
-
- System.out.println("Test PASSED");
- } catch (AWTException e) {
- e.printStackTrace();
- } finally {
- scenario.disposeBrowserFrame();
- }
- }
-} \ No newline at end of file
diff --git a/test/jdk/jb/java/jcef/MouseEventScenario.java b/test/jdk/jb/java/jcef/MouseEventScenario.java
deleted file mode 100644
index f359265819e..00000000000
--- a/test/jdk/jb/java/jcef/MouseEventScenario.java
+++ /dev/null
@@ -1,245 +0,0 @@
-// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
-
-import javax.swing.*;
-import java.awt.*;
-import java.awt.event.*;
-import java.lang.reflect.InvocationTargetException;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-
-public class MouseEventScenario {
- public static CountDownLatch latch;
-
- static TestStage testStage;
-
- private static final int WIDTH = 400;
- private static final int HEIGHT = 400;
- private Robot robot;
- private CefBrowserFrame browserFrame = new CefBrowserFrame(WIDTH, HEIGHT);
-
- public void initUI() throws AWTException, InvocationTargetException, InterruptedException {
- robot = new Robot();
- SwingUtilities.invokeAndWait(browserFrame::initUI);
- robot.waitForIdle();
- }
-
-
- public void doMouseActions() throws InterruptedException {
- Point frameCenter = browserFrame.getFrameCenter();
-
- mouseMove(frameCenter);
-
- //mouseEntered and mouseExited events work unstable. These actions are not tested.
-
- testStage = TestStage.MOUSE_PRESSED;
- System.out.println("Stage: " + testStage.name());
- latch = new CountDownLatch(1);
- robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
- latch.await(2, TimeUnit.SECONDS);
- checkActionHandler();
-
- testStage = TestStage.MOUSE_DRAGGED;
- System.out.println("Stage: " + testStage.name());
- latch = new CountDownLatch(1);
- // Empiric observation: robot.mouseMove with small shifts (1-3 pixels) doesn't produce real moves
- // So we must use quite large shifts
- robot.mouseMove(frameCenter.x + browserFrame.getWidth()/4, frameCenter.y);
- latch.await(2, TimeUnit.SECONDS);
- checkActionHandler();
-
- testStage = TestStage.MOUSE_RELEASED;
- System.out.println("Stage: " + testStage.name());
- latch = new CountDownLatch(1);
- robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
- latch.await(2, TimeUnit.SECONDS);
- checkActionHandler();
-
- testStage = TestStage.MOUSE_CLICKED;
- System.out.println("Stage: " + testStage.name());
- latch = new CountDownLatch(1);
- robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
- robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
- latch.await(2, TimeUnit.SECONDS);
- checkActionHandler();
-
- testStage = TestStage.MOUSE_MOVED;
- System.out.println("Stage: " + testStage.name());
- latch = new CountDownLatch(1);
- robot.mouseMove(frameCenter.x + 2, frameCenter.y);
- latch.await(2, TimeUnit.SECONDS);
- checkActionHandler();
-
- testStage = TestStage.MOUSE_WHEEL_MOVED;
- latch = new CountDownLatch(1);
- robot.mouseWheel(1);
- latch.await(2, TimeUnit.SECONDS);
- checkActionHandler();
-
- }
-
- public void mouseMove(Point p) throws InterruptedException {
- testStage = TestStage.MOUSE_MOVED;
- latch = new CountDownLatch(1);
- robot.mouseMove(p.x, p.y);
- latch.await(2, TimeUnit.SECONDS);
- browserFrame.resetMouseActionPerformedFlag();
- }
-
- public void disposeBrowserFrame() throws InvocationTargetException, InterruptedException {
- getBrowserFrame().getBrowser().dispose();
- JBCefApp.getInstance().getCefApp().dispose();
- SwingUtilities.invokeAndWait(getBrowserFrame()::dispose);
- }
-
- private void checkActionHandler() {
- if(!browserFrame.isMouseActionPerformed()) {
- throw new RuntimeException("ERROR: " + testStage.name() + " action was not handled.");
- }
- browserFrame.resetMouseActionPerformedFlag();
- }
-
- public CefBrowserFrame getBrowserFrame() {
- return browserFrame;
- }
-
-}
-
-enum TestStage {
- MOUSE_ENTERED,
- MOUSE_EXITED,
- MOUSE_MOVED,
- MOUSE_DRAGGED,
- MOUSE_CLICKED,
- MOUSE_PRESSED,
- MOUSE_RELEASED,
- MOUSE_WHEEL_MOVED
-}
-
-class CefBrowserFrame extends JFrame {
- private final JBCefBrowser browser = new JBCefBrowser();
- private final int width, height;
- private volatile boolean mouseActionPerformed = false;
-
- private MouseAdapter mouseAdapter = new MouseAdapter() {
- @Override
- public void mouseDragged(MouseEvent e) {
- if(MouseEventScenario.testStage == TestStage.MOUSE_DRAGGED) {
- System.out.println("mouseDragged");
- mouseActionPerformed = true;
- MouseEventScenario.latch.countDown();
- }
- }
-
- @Override
- public void mouseMoved(MouseEvent e) {
- if(MouseEventScenario.testStage == TestStage.MOUSE_MOVED) {
- System.out.println("mouseMoved");
- mouseActionPerformed = true;
- MouseEventScenario.latch.countDown();
- }
- }
-
- @Override
- public void mouseWheelMoved(MouseWheelEvent e) {
- if(MouseEventScenario.testStage == TestStage.MOUSE_WHEEL_MOVED) {
- System.out.println("mouseWheelMoved");
- mouseActionPerformed = true;
- MouseEventScenario.latch.countDown();
- }
- }
-
- @Override
- public void mouseClicked(MouseEvent e) {
- if(MouseEventScenario.testStage == TestStage.MOUSE_CLICKED) {
- System.out.println("mouseClicked");
- mouseActionPerformed = true;
- MouseEventScenario.latch.countDown();
- }
- }
-
- @Override
- public void mousePressed(MouseEvent e) {
- if(MouseEventScenario.testStage == TestStage.MOUSE_PRESSED) {
- System.out.println("mousePressed");
- mouseActionPerformed = true;
- MouseEventScenario.latch.countDown();
- }
- }
-
- @Override
- public void mouseReleased(MouseEvent e) {
- if(MouseEventScenario.testStage == TestStage.MOUSE_RELEASED) {
- System.out.println("mouseReleased");
- mouseActionPerformed = true;
- MouseEventScenario.latch.countDown();
- }
- }
-
- @Override
- public void mouseEntered(MouseEvent e) {
- if(MouseEventScenario.testStage == TestStage.MOUSE_ENTERED) {
- System.out.println("mouseEntered");
- mouseActionPerformed = true;
- MouseEventScenario.latch.countDown();
- }
- }
-
- @Override
- public void mouseExited(MouseEvent e) {
- if(MouseEventScenario.testStage == TestStage.MOUSE_EXITED) {
- System.out.println("mouseExited");
- mouseActionPerformed = true;
- MouseEventScenario.latch.countDown();
- }
- }
- };
-
- public CefBrowserFrame(int width, int height) {
- this.width = width;
- this.height = height;
- }
-
- public void initUI() {
- browser.getComponent().addMouseMotionListener(mouseAdapter);
- browser.getComponent().addMouseListener(mouseAdapter);
- browser.getComponent().addMouseWheelListener(mouseAdapter);
- setResizable(false);
- getContentPane().add(browser.getCefBrowser().getUIComponent());
- setSize(width, height);
- setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
- addWindowListener(new WindowAdapter() {
- @Override
- public void windowClosed(WindowEvent e) {
- browser.dispose();
- }
- });
- setVisible(true);
- }
-
- public void hideAndShowBrowser() {
- Container parent = browser.getComponent().getParent();
- parent.remove(browser.getComponent());
- SwingUtilities.invokeLater(() -> {
- parent.add(browser.getComponent());
- MouseEventScenario.latch.countDown();
- });
- }
-
- public JBCefBrowser getBrowser() {
- return browser;
- }
-
- public void resetMouseActionPerformedFlag() {
- mouseActionPerformed = false;
- }
-
- public boolean isMouseActionPerformed() {
- return mouseActionPerformed;
- }
-
- public Point getFrameCenter() {
- return new Point(getLocationOnScreen().x + getWidth() / 2,
- getLocationOnScreen().y + getHeight() / 2);
- }
-} \ No newline at end of file
diff --git a/test/jdk/jb/java/jcef/MouseEventTest.java b/test/jdk/jb/java/jcef/MouseEventTest.java
deleted file mode 100644
index b4bc4ff2fa3..00000000000
--- a/test/jdk/jb/java/jcef/MouseEventTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
-
-import java.awt.*;
-import java.lang.reflect.InvocationTargetException;
-
-/**
- * @test
- * @key headful
- * @requires (os.arch == "amd64" | os.arch == "x86_64" | (os.arch == "aarch64" & os.family == "mac"))
- * @summary Regression test for JBR-2639. The test checks that mouse actions are handled on jcef browser.
- * @run main/othervm MouseEventTest
- */
-
-
-public class MouseEventTest {
-
- public static void main(String[] args) throws InvocationTargetException, InterruptedException {
-
- MouseEventScenario scenario = new MouseEventScenario();
- try {
- scenario.initUI();
-
- //mouseEntered and mouseExited events work unstable. These actions are not tested.
- scenario.doMouseActions();
-
- System.out.println("Test PASSED");
- } catch (AWTException e) {
- e.printStackTrace();
- } finally {
- scenario.disposeBrowserFrame();
- }
- }
-} \ No newline at end of file
diff --git a/test/jdk/jb/java/jcef/dummy.html b/test/jdk/jb/java/jcef/dummy.html
deleted file mode 100644
index 7c1a313df95..00000000000
--- a/test/jdk/jb/java/jcef/dummy.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <title>Dummy html file</title>
-</head>
-<body>
-Dummy text
-</body>
-</html> \ No newline at end of file