You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by jt...@apache.org on 2019/02/18 11:33:25 UTC
[incubator-netbeans-html4j] branch master updated: Verify the
debugger can be initialized
This is an automated email from the ASF dual-hosted git repository.
jtulach pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-netbeans-html4j.git
The following commit(s) were added to refs/heads/master by this push:
new 5e0890e Verify the debugger can be initialized
5e0890e is described below
commit 5e0890e9d00ba3eefea8fc4f5f3cba919ae6055e
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Sun Feb 17 21:17:48 2019 +0100
Verify the debugger can be initialized
---
.../main/java/org/netbeans/html/boot/fx/Dbgr.java | 9 +++-
.../java/org/netbeans/html/boot/fx/DbgrTest.java | 55 ++++++++++++++++++++++
2 files changed, 63 insertions(+), 1 deletion(-)
diff --git a/boot-fx/src/main/java/org/netbeans/html/boot/fx/Dbgr.java b/boot-fx/src/main/java/org/netbeans/html/boot/fx/Dbgr.java
index 423f5f2..7cc3d85 100644
--- a/boot-fx/src/main/java/org/netbeans/html/boot/fx/Dbgr.java
+++ b/boot-fx/src/main/java/org/netbeans/html/boot/fx/Dbgr.java
@@ -36,7 +36,14 @@ final class Dbgr {
Object d;
Method m;
try {
- d = eng.getClass().getMethod("impl_getDebugger").invoke(eng); // NOI18N
+ Method getDebugger;
+ try {
+ getDebugger = eng.getClass().getMethod("impl_getDebugger"); // NOI18N
+ } catch (NoSuchMethodException ex) {
+ getDebugger = eng.getClass().getDeclaredMethod("getDebugger"); // NOI18N
+ getDebugger.setAccessible(true);
+ }
+ d = getDebugger.invoke(eng);
Class<?> debugger = eng.getClass().getClassLoader().loadClass("com.sun.javafx.scene.web.Debugger"); // NOI18N
debugger.getMethod("setEnabled", boolean.class).invoke(d, true); // NOI18N
debugger.getMethod("setMessageCallback", Callback.class).invoke(d, callback); // NOI18N
diff --git a/boot-fx/src/test/java/org/netbeans/html/boot/fx/DbgrTest.java b/boot-fx/src/test/java/org/netbeans/html/boot/fx/DbgrTest.java
new file mode 100644
index 0000000..024f039
--- /dev/null
+++ b/boot-fx/src/test/java/org/netbeans/html/boot/fx/DbgrTest.java
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.netbeans.html.boot.fx;
+
+import java.util.concurrent.CountDownLatch;
+import javafx.application.Platform;
+import javafx.scene.web.WebEngine;
+import javafx.scene.web.WebView;
+import javafx.util.Callback;
+import static org.testng.Assert.assertNotNull;
+import org.testng.annotations.Test;
+
+public class DbgrTest implements Callback<String, Void> {
+
+ public DbgrTest() {
+ }
+
+ @Test
+ public void initializeDebuggerForWebView() throws Exception {
+ Dbgr[] instance = { null };
+ CountDownLatch cdl = new CountDownLatch(1);
+ Platform.runLater(() -> {
+ WebView wv = new WebView();
+ WebEngine engine = wv.getEngine();
+ instance[0] = new Dbgr(engine, this);
+ cdl.countDown();
+ });
+
+ cdl.await();
+ assertNotNull(instance[0], "Instance of Dbgr class created");
+ assertNotNull(instance[0].dbg, "Debugger initialized");
+ assertNotNull(instance[0].sendMsg, "Send method initialized");
+ }
+
+ @Override
+ public Void call(String p) {
+ return null;
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists