зеркало из https://github.com/mozilla/pjs.git
Bug 693341 - Test interface arrays. r=khuey
This commit is contained in:
Родитель
74c7ab692e
Коммит
44c0919430
|
@ -90,6 +90,7 @@ TestParams.prototype = {
|
|||
testLongLongArray: f_is,
|
||||
testStringArray: f_is,
|
||||
testWstringArray: f_is,
|
||||
testInterfaceArray: f_is,
|
||||
testSizedString: f_is,
|
||||
testSizedWstring: f_is,
|
||||
};
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "xpctest_private.h"
|
||||
#include "xpctest_interfaces.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsXPCTestParams, nsIXPCTestParams)
|
||||
|
||||
|
@ -59,6 +60,7 @@ nsXPCTestParams::~nsXPCTestParams()
|
|||
}
|
||||
|
||||
#define TAKE_OWNERSHIP_NOOP(val) {}
|
||||
#define TAKE_OWNERSHIP_INTERFACE(val) {(val)->AddRef();}
|
||||
#define TAKE_OWNERSHIP_STRING(val) { \
|
||||
nsDependentCString vprime(val); \
|
||||
val = ToNewCString(vprime); \
|
||||
|
@ -274,6 +276,16 @@ NS_IMETHODIMP nsXPCTestParams::TestWstringArray(PRUint32 aLength, const PRUnicha
|
|||
BUFFER_METHOD_IMPL(PRUnichar*, 0, TAKE_OWNERSHIP_WSTRING);
|
||||
}
|
||||
|
||||
/* void testInterfaceArray (in unsigned long aLength, [array, size_is (aLength)] in nsIXPCTestInterfaceA a,
|
||||
* inout unsigned long bLength, [array, size_is (bLength)] inout nsIXPCTestInterfaceA b,
|
||||
* out unsigned long rvLength, [array, size_is (rvLength), retval] out nsIXPCTestInterfaceA rv); */
|
||||
NS_IMETHODIMP nsXPCTestParams::TestInterfaceArray(PRUint32 aLength, nsIXPCTestInterfaceA **a,
|
||||
PRUint32 *bLength NS_INOUTPARAM, nsIXPCTestInterfaceA * **b NS_INOUTPARAM,
|
||||
PRUint32 *rvLength NS_OUTPARAM, nsIXPCTestInterfaceA * **rv NS_OUTPARAM)
|
||||
{
|
||||
BUFFER_METHOD_IMPL(nsIXPCTestInterfaceA*, 0, TAKE_OWNERSHIP_INTERFACE);
|
||||
}
|
||||
|
||||
/* void testSizedString (in unsigned long aLength, [size_is (aLength)] in string a,
|
||||
* inout unsigned long bLength, [size_is (bLength)] inout string b,
|
||||
* out unsigned long rvLength, [size_is (rvLength), retval] out string rv); */
|
||||
|
|
|
@ -44,6 +44,9 @@
|
|||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIXPCTestInterfaceA;
|
||||
interface nsIXPCTestInterfaceB;
|
||||
|
||||
[scriptable, uuid(b94cd289-d0df-4d25-8995-facf687d921d)]
|
||||
interface nsIXPCTestParams : nsISupports {
|
||||
|
||||
|
@ -85,6 +88,9 @@ interface nsIXPCTestParams : nsISupports {
|
|||
void testWstringArray(in unsigned long aLength, [array, size_is(aLength)] in wstring a,
|
||||
inout unsigned long bLength, [array, size_is(bLength)] inout wstring b,
|
||||
out unsigned long rvLength, [retval, array, size_is(rvLength)] out wstring rv);
|
||||
void testInterfaceArray(in unsigned long aLength, [array, size_is(aLength)] in nsIXPCTestInterfaceA a,
|
||||
inout unsigned long bLength, [array, size_is(bLength)] inout nsIXPCTestInterfaceA b,
|
||||
out unsigned long rvLength, [retval, array, size_is(rvLength)] out nsIXPCTestInterfaceA rv);
|
||||
|
||||
// Test sized strings.
|
||||
void testSizedString(in unsigned long aLength, [size_is(aLength)] in string a,
|
||||
|
|
|
@ -135,6 +135,8 @@ function test_component(contractid) {
|
|||
["ids", "fleas", "woes", "wide", "has", "know", "!"], 7, arrayComparator);
|
||||
doIsTest("testWstringArray", ["沒有語言", "的偉大嗎?]"], 2,
|
||||
["we", "are", "being", "sooo", "international", "right", "now"], 7, arrayComparator);
|
||||
doIsTest("testInterfaceArray", [makeA(), makeA()], 2,
|
||||
[makeA(), makeA(), makeA(), makeA(), makeA(), makeA()], 6, arrayComparator);
|
||||
|
||||
// Test sized strings.
|
||||
var ssTests = ["Tis not possible, I muttered", "give me back my free hardcore!", "quoth the server:", "4〠4"];
|
||||
|
|
Загрузка…
Ссылка в новой задаче