I have updated my firefox plugin to work with latest versions开发者_开发问答 of firefox (3.6 and higher) by moving from xpcom to npruntime.
While doing this I have written several wrappers and the only way to test my code seems to be through javascript.
Could someone suggest another way to test my helper objects? Are there any other types of tests that may be useful here?
I will repeat the advice I gave you in my answer to your other question by suggesting that you look at using FireBreath for this plugin; it already has the wrappers to make NPObjects work well and as an added bonus on windows you can use your plugin on IE also.
That said, writing unit tests for a NPAPI plugin is fairly difficult. Depending on how your code is written you could "fake out" a few of the important functions -- such as the memory management functions NPN_MemAlloc and NPN_MemFree -- and then use those to write unit tests, or you could write automated tests that use a web browser.
FireBreath includes a NPAPIHost project that was designed to assist with unit testing NPAPI plugins, but it has not been fully completed. Still, you could use it as a starting point if you want.
Honestly, though, I would just use FireBreath and then you can focus on your own code instead of trying to write and maintain your own abstraction for the scripting system.
精彩评论