[rfc][icedtea-web] PluginAppletViewer unit tests with test extensions for mocking plugin input&output pipes

Adam Domurad adomurad at redhat.com
Mon Mar 11 14:21:16 PDT 2013

This is an attempt to enable unit testing of hard-to-test parts of 
It introduces a new class 'PluginPipeMock' that allows the requests 
coming from the plugin to be read one-by-one, and the ability to send 
mocked replies.
This is possible thanks to that fact that PluginStreamHandler takes 
arbitrary and InputStream&OutputStream.

Attached are unit tests for PluginAppletViewer.eval, 
PluginAppletViewer.call, PluginAppletViewer.toString and 
While the javascript-related functionality is mocked, the 
responsibilities from the Java-side of things are tested.

It may be worth looking into using iostream's on the C++ side and 
mocking them similarly (for the unfamiliar, they are also classes that 
can be inherited from, so a similar approach can be taken).
Even better would be to provide the C++ side with some NPAPI-enabled 
javascript engine to interface with so we can fully test the javascript 
stuff with unit tests.

2013-XX-XX  Adam Domurad  <adomurad at redhat.com>

     * Makefile.am
     (stamps/test-extensions-compile.stamp): Make plugin classes available
     to test extensions
     * tests/test-extensions/net/sourceforge/jnlp/AsyncCallWithTimeout.java:
     New, helper for doing asynchronous calls with a given timeout. Returns
     an exit code.
     * tests/test-extensions/sun/applet/PluginPipeMessages.java: New, helper
     for verifying plugin messages and getting the reference number.
     * tests/netx/unit/sun/applet/PluginAppletViewerTest.java: New, uses
     PluginPipeMock to test the javascript requests to the plygin.
     * tests/test-extensions/sun/applet/mock/PluginPipeMock.java: New, 
     for getting the plugin requests and mocking the replies.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-liveconnect-messages.patch
Type: text/x-patch
Size: 16442 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20130311/28557979/test-liveconnect-messages.patch 

More information about the distro-pkg-dev mailing list