/hg/icedtea-web: Added clipboard reproducers (PR708)
jvanek at icedtea.classpath.org
jvanek at icedtea.classpath.org
Fri Oct 26 03:14:51 PDT 2012
changeset 2c3a063c1aff in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=2c3a063c1aff
author: Jiri Vanek <jvanek at redhat.com>
date: Fri Oct 26 12:15:18 2012 +0200
Added clipboard reproducers (PR708)
diffstat:
ChangeLog | 44 ++-
tests/reproducers/signed/ClipboardContentSigned/resources/ClipboardContentSignedCopy1.jnlp | 58 +++
tests/reproducers/signed/ClipboardContentSigned/resources/ClipboardContentSignedCopy2.jnlp | 58 +++
tests/reproducers/signed/ClipboardContentSigned/resources/ClipboardContentSignedPaste1.jnlp | 57 +++
tests/reproducers/signed/ClipboardContentSigned/resources/ClipboardContentSignedPaste2.jnlp | 57 +++
tests/reproducers/signed/ClipboardContentSigned/srcs/ClipboardContentSigned.java | 183 ++++++++++
tests/reproducers/signed/ClipboardContentSigned/testcases/ClipboardContentSignedTests.java | 126 ++++++
tests/reproducers/simple/ClipboardContent/resources/ClipboardContentCopy1.jnlp | 58 +++
tests/reproducers/simple/ClipboardContent/resources/ClipboardContentCopy2.jnlp | 58 +++
tests/reproducers/simple/ClipboardContent/resources/ClipboardContentPaste1.jnlp | 57 +++
tests/reproducers/simple/ClipboardContent/resources/ClipboardContentPaste2.jnlp | 57 +++
tests/reproducers/simple/ClipboardContent/srcs/ClipboardContent.java | 183 ++++++++++
tests/reproducers/simple/ClipboardContent/testcases/ClipboardContentTests.java | 136 +++++++
tests/test-extensions/net/sourceforge/jnlp/tools/AsyncJavaws.java | 88 ++++
tests/test-extensions/net/sourceforge/jnlp/tools/ClipboardHelpers.java | 64 +++
tests/test-extensions/net/sourceforge/jnlp/tools/WaitingForStringProcess.java | 91 ++++
16 files changed, 1373 insertions(+), 2 deletions(-)
diffs (truncated from 1449 to 500 lines):
diff -r c52fcd37dbd8 -r 2c3a063c1aff ChangeLog
--- a/ChangeLog Tue Oct 23 09:56:26 2012 +0200
+++ b/ChangeLog Fri Oct 26 12:15:18 2012 +0200
@@ -1,3 +1,43 @@
+2012-10-26 Jiri Vanek <jvanek at redhat.com>
+
+ Added clipboard reproducers (PR708)
+ * tests/reproducers/signed/ClipboardContentSigned/resources/ClipboardContentSignedCopy1.jnlp:
+ Jnlp to invoke manual copying to clipboard on signed app, please note
+ the delayed death of application
+ * tests/reproducers/signed/ClipboardContentSigned/resources/ClipboardContentSignedCopy2.jnlp:
+ Jnlp to invoke jtextfield like copying signed app, please note the
+ delayed death of application
+ * tests/reproducers/signed/ClipboardContentSigned/resources/ClipboardContentSignedPaste1.jnlp:
+ Jnlp to invoke manual pasting on signed application
+ * tests/reproducers/signed/ClipboardContentSigned/resources/ClipboardContentSignedPaste2.jnlp:
+ Jnlp to invoke jtextfield like pasting on signed application
+ * tests/reproducers/signed/ClipboardContentSigned/srcs/ClipboardContentSigned.java:
+ Application which is trying to access clipboard by various ways.
+ * tests/reproducers/signed/ClipboardContentSigned/testcases/ClipboardContentSignedTests.java:
+ Automated tests for four above jnlps.
+ * tests/reproducers/simple/ClipboardContent/resources/ClipboardContentCopy1.jnlp:
+ Jnlp to invoke manual copying to clipboard on unsigned app, please note
+ the delayed death of application
+ * tests/reproducers/simple/ClipboardContent/resources/ClipboardContentCopy2.jnlp:
+ Jnlp to invoke jtextfield like copying unsigned app, please note the
+ delayed death of application
+ * tests/reproducers/simple/ClipboardContent/resources/ClipboardContentPaste1.jnlp:
+ Jnlp to invoke manual pasting on unsigned application
+ * tests/reproducers/simple/ClipboardContent/resources/ClipboardContentPaste2.jnlp:
+ Jnlp to invoke jtextfield like pasting on unsigned application
+ * tests/reproducers/simple/ClipboardContent/srcs/ClipboardContent.java:
+ Application which is trying to access clipboard by various ways.
+ * tests/reproducers/simple/ClipboardContent/testcases/ClipboardContentTests.java:
+ Automated tests for first and third of above four jnlps. The tests of
+ second and fourth is disabled due to necessary manual interaction
+ * tests/test-extensions/net/sourceforge/jnlp/tools/WaitingForStringProcess.java:
+ Utility class for process waiting for some string for another string
+ * tests/test-extensions/net/sourceforge/jnlp/tools/ClipboardHelpers.java
+ Utility class for copying/pasting text to/from clipboard
+ * tests/test-extensions/net/sourceforge/jnlp/tools/AsyncJavaws.java
+ Utility class for launching javaws in separate thread.
+
+
2012-10-23 Jiri Vanek <jvanek at redhat.com>
KnownToFail texts are now bold in html report
@@ -217,8 +257,8 @@
2012-09-26 Jana Fabrikova <jfabriko at redhat.com>
- * tests/test-extensions/net/sourceforge/jnlp/closinglisteners/StringMatchClosingListener.java:
- Added forgotten package name.
+ * tests/test-extensions/net/sourceforge/jnlp/closinglisteners/StringMatchClosingListener.java:
+ Added forgotten package name.
2012-09-25 Jiri Vanek <jvanek at redhat.com>
diff -r c52fcd37dbd8 -r 2c3a063c1aff tests/reproducers/signed/ClipboardContentSigned/resources/ClipboardContentSignedCopy1.jnlp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/reproducers/signed/ClipboardContentSigned/resources/ClipboardContentSignedCopy1.jnlp Fri Oct 26 12:15:18 2012 +0200
@@ -0,0 +1,58 @@
+<!--
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+IcedTea is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version.
+
+ -->
+<?xml version="1.0" encoding="utf-8"?>
+<jnlp spec="1.0" href="ClipboardContentSignedCopy1.jnlp" codebase=".">
+ <information>
+ <title>ClipboardContentSignedCopy1</title>
+ <vendor>IcedTea</vendor>
+ <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/>
+ <description>ClipboardContentSignedCopy1</description>
+ <offline/>
+ </information>
+ <resources>
+ <j2se version="1.4+"/>
+ <jar href="ClipboardContentSigned.jar"/>
+ </resources>
+ <application-desc main-class="ClipboardContentSigned">
+ <argument>copy1</argument>
+ <argument>10</argument>
+ </application-desc>
+ <security>
+ <all-permissions/>
+ </security>
+</jnlp>
diff -r c52fcd37dbd8 -r 2c3a063c1aff tests/reproducers/signed/ClipboardContentSigned/resources/ClipboardContentSignedCopy2.jnlp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/reproducers/signed/ClipboardContentSigned/resources/ClipboardContentSignedCopy2.jnlp Fri Oct 26 12:15:18 2012 +0200
@@ -0,0 +1,58 @@
+<!--
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+IcedTea is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version.
+
+ -->
+<?xml version="1.0" encoding="utf-8"?>
+<jnlp spec="1.0" href="ClipboardContentSignedCopy2.jnlp" codebase=".">
+ <information>
+ <title>ClipboardContentSignedCopy2</title>
+ <vendor>IcedTea</vendor>
+ <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/>
+ <description>ClipboardContentSignedCopy2</description>
+ <offline/>
+ </information>
+ <resources>
+ <j2se version="1.4+"/>
+ <jar href="ClipboardContentSigned.jar"/>
+ </resources>
+ <application-desc main-class="ClipboardContentSigned">
+ <argument>copy2</argument>
+ <argument>10</argument>
+ </application-desc>
+ <security>
+ <all-permissions/>
+ </security>
+</jnlp>
diff -r c52fcd37dbd8 -r 2c3a063c1aff tests/reproducers/signed/ClipboardContentSigned/resources/ClipboardContentSignedPaste1.jnlp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/reproducers/signed/ClipboardContentSigned/resources/ClipboardContentSignedPaste1.jnlp Fri Oct 26 12:15:18 2012 +0200
@@ -0,0 +1,57 @@
+<!--
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+IcedTea is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version.
+
+ -->
+<?xml version="1.0" encoding="utf-8"?>
+<jnlp spec="1.0" href="ClipboardContentSignedPaste1.jnlp" codebase=".">
+ <information>
+ <title>ClipboardContentSignedPaste1</title>
+ <vendor>IcedTea</vendor>
+ <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/>
+ <description>ClipboardContentSignedPaste1</description>
+ <offline/>
+ </information>
+ <resources>
+ <j2se version="1.4+"/>
+ <jar href="ClipboardContentSigned.jar"/>
+ </resources>
+ <application-desc main-class="ClipboardContentSigned">
+ <argument>paste1</argument>
+ </application-desc>
+ <security>
+ <all-permissions/>
+ </security>
+</jnlp>
diff -r c52fcd37dbd8 -r 2c3a063c1aff tests/reproducers/signed/ClipboardContentSigned/resources/ClipboardContentSignedPaste2.jnlp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/reproducers/signed/ClipboardContentSigned/resources/ClipboardContentSignedPaste2.jnlp Fri Oct 26 12:15:18 2012 +0200
@@ -0,0 +1,57 @@
+<!--
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+IcedTea is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version.
+
+ -->
+<?xml version="1.0" encoding="utf-8"?>
+<jnlp spec="1.0" href="ClipboardContentSignedPaste2.jnlp" codebase=".">
+ <information>
+ <title>ClipboardContentSignedPaste2</title>
+ <vendor>IcedTea</vendor>
+ <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/>
+ <description>ClipboardContentSignedPaste2</description>
+ <offline/>
+ </information>
+ <resources>
+ <j2se version="1.4+"/>
+ <jar href="ClipboardContentSigned.jar"/>
+ </resources>
+ <application-desc main-class="ClipboardContentSigned">
+ <argument>paste2</argument>
+ </application-desc>
+ <security>
+ <all-permissions/>
+ </security>
+</jnlp>
diff -r c52fcd37dbd8 -r 2c3a063c1aff tests/reproducers/signed/ClipboardContentSigned/srcs/ClipboardContentSigned.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/reproducers/signed/ClipboardContentSigned/srcs/ClipboardContentSigned.java Fri Oct 26 12:15:18 2012 +0200
@@ -0,0 +1,183 @@
+/* ClipboardContentSigned.java
+Copyright (C) 2012 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING. If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version.
+ */
+
+import java.awt.Toolkit;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.StringSelection;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.concurrent.TimeUnit;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.SwingUtilities;
+import javax.swing.text.JTextComponent;
+
+public class ClipboardContentSigned extends JPanel {
+
+ private static final String contentC = "COPY#$REPRODUCER";
+ private static final String contentP = "PASTE#$REPRODUCER";
+
+ private static class LocalFrame extends JFrame {
+
+ JTextField t;
+
+ public LocalFrame(String str) {
+ super();
+ t = new JTextField(str);
+ this.add(t);
+ this.setSize(100, 100);
+ this.pack();
+ t.selectAll();
+ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ }
+
+ public void run() throws InterruptedException {
+ SwingUtilities.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+ setVisible(true);
+
+ }
+ });
+ while (!this.isVisible()) {
+ Thread.sleep(100);
+ }
+ }
+
+ public JTextField getT() {
+ return t;
+ }
+ }
+
+ public void putToClipboard1(String str) {
+ Toolkit toolkit = Toolkit.getDefaultToolkit();
+ Clipboard clipboard = toolkit.getSystemClipboard();
+ StringSelection strSel = new StringSelection(str);
+ clipboard.setContents(strSel, null);
+ printFlavors();
+ }
+
+ public void putToClipboard2(final String str) throws InterruptedException, NoSuchMethodException, IllegalAccessException, UnsupportedFlavorException, IllegalArgumentException, InvocationTargetException, IOException {
+ final LocalFrame lf = new LocalFrame(str);
+ lf.run();
+ ((JTextComponent) (lf.getT())).copy();
+ printFlavors();
+ lf.dispose();
+ }
+
+ public String pasteFromClipboard2() throws InterruptedException, NoSuchMethodException, IllegalAccessException, UnsupportedFlavorException, IllegalArgumentException, InvocationTargetException, IOException {
+ final LocalFrame lf = new LocalFrame("xxx");
+ lf.run();
+ ((JTextComponent) (lf.getT())).paste();
+ printFlavors();
+ String s = lf.getT().getText();
+ lf.dispose();
+ return s;
+ }
+
+ private void printFlavors() {
+//just for debugging
+// Toolkit toolkit = Toolkit.getDefaultToolkit();
+// Clipboard clipboard = toolkit.getSystemClipboard();
+// Transferable clipData = clipboard.getContents(clipboard);
+// DataFlavor[] cd = clipData.getTransferDataFlavors();
+// for (DataFlavor dataFlavor : cd) {
+// System.out.println(dataFlavor.getMimeType());
+// }
+ }
+
+ public String pasteFromClipboard1() throws UnsupportedFlavorException, IOException {
+ Toolkit toolkit = Toolkit.getDefaultToolkit();
+ Clipboard clipboard = toolkit.getSystemClipboard();
+ Transferable clipData = clipboard.getContents(clipboard);
+ printFlavors();
+ String s = (String) (clipData.getTransferData(
+ DataFlavor.stringFlavor));
+ return s;
+ }
+
+ public static void main(String[] args) throws Exception {
+ ClipboardContentSigned cl = new ClipboardContentSigned();
+ if (args.length == 0) {
+ throw new IllegalArgumentException("at least copy1|2 or paste1|2 must be as argument (+mandatory number giving use timeout in seconds before termination)");
+ } else if (args.length == 1) {
+ cl.proceed(args[0]);
+ } else {
+ cl.proceed(args[0], args[1]);
+ }
+
+ }
+
+ public void proceed(String arg) throws Exception {
+ proceed(arg, 0);
+ }
+
+ public void proceed(String arg, String keepAliveFor) throws Exception {
+ proceed(arg, Long.valueOf(keepAliveFor));
+ }
+
+ public void proceed(String arg, long timeOut) throws Exception {
+ if (arg.equals("copy1")) {
+ System.out.println(this.getClass().getName() + " copying1 to clipboard " + contentC);
+ putToClipboard1(contentC);
+ System.out.println(this.getClass().getName() + " copied1 to clipboard " + pasteFromClipboard1());
+ } else if (arg.equals("paste1")) {
+ System.out.println(this.getClass().getName() + " pasting1 from clipboard ");
+ String nwContent = pasteFromClipboard1();
+ System.out.println(this.getClass().getName() + " pasted1 from clipboard " + nwContent);
+ } else if (arg.equals("copy2")) {
+ System.out.println(this.getClass().getName() + " copying2 to clipboard " + contentC);
+ putToClipboard2(contentC);
+ System.out.println(this.getClass().getName() + " copied2 to clipboard " + pasteFromClipboard2());
+ } else if (arg.equals("paste2")) {
+ System.out.println(this.getClass().getName() + " pasting2 from clipboard ");
+ String nwContent = pasteFromClipboard2();
+ System.out.println(this.getClass().getName() + " pasted2 from clipboard " + nwContent);
+ } else {
+ throw new IllegalArgumentException("supported copy1|2 paste1|2");
+ }
+ long start = System.nanoTime();
+ while (TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - start) < timeOut) {
+ Thread.sleep(500);
+ }
+ }
+}
diff -r c52fcd37dbd8 -r 2c3a063c1aff tests/reproducers/signed/ClipboardContentSigned/testcases/ClipboardContentSignedTests.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/reproducers/signed/ClipboardContentSigned/testcases/ClipboardContentSignedTests.java Fri Oct 26 12:15:18 2012 +0200
@@ -0,0 +1,126 @@
+/* ClipboardContentSignedTests.java
+ Copyright (C) 2012 Red Hat, Inc.
+
+ This file is part of IcedTea.
+
More information about the distro-pkg-dev
mailing list