Update to new method names and QI impl. Add deleting array test.

This commit is contained in:
pedemont@us.ibm.com
2004-10-15 21:55:14 +00:00
parent b4e20286ad
commit c8bbca3c41
2 changed files with 16 additions and 11 deletions

View File

@@ -60,6 +60,8 @@ import org.mozilla.xpcom.*;
*/
public class TestArray {
public static final String NS_ARRAY_CID = "@mozilla.org/array;1";
public static void main(String [] args) {
System.loadLibrary("javaxpcom");
@@ -68,10 +70,11 @@ public class TestArray {
throw new RuntimeException("MOZILLA_FIVE_HOME system property not set.");
}
nsILocalFile localFile = GeckoEmbed.NS_NewLocalFile(mozillaPath, true);
GeckoEmbed.NS_InitEmbedding(localFile, null);
nsILocalFile localFile = GeckoEmbed.newLocalFile(mozillaPath, true);
GeckoEmbed.initEmbedding(localFile, null);
nsIMutableArray array = GeckoEmbed.NS_NewArray();
nsIComponentManager componentManager = GeckoEmbed.getComponentManager();
nsIMutableArray array = (nsIMutableArray) componentManager.createInstanceByContractID(NS_ARRAY_CID, null, nsIMutableArray.NS_IMUTABLEARRAY_IID);
if (array == null) {
throw new RuntimeException("Failed to create nsIMutableArray.");
}
@@ -157,7 +160,14 @@ public class TestArray {
fillArray(array, 4);
dumpArray(array, 4, fillResult, 4);
GeckoEmbed.NS_TermEmbedding();
// test deleting of array
System.out.println("release array:");
array = null;
System.gc();
componentManager = null;
System.gc();
GeckoEmbed.termEmbedding();
System.out.println("Test Passed.");
}