Methods Summary |
---|
protected void | setUp()
super.setUp();
mTestObject = new TestObject();
setUpWebView(mTestObject, "testObject");
|
public void | testArrayLength()
executeJavaScript("testObject.setIntArray([42, 43, 44]);");
int[] result = mTestObject.waitForIntArray();
assertEquals(3, result.length);
assertEquals(42, result[0]);
assertEquals(43, result[1]);
assertEquals(44, result[2]);
|
public void | testLengthOutOfBounds()
// LIVECONNECT_COMPLIANCE: This should not count as an array, so we
// should raise a JavaScript exception.
executeJavaScript("testObject.setIntArray({length: -1});");
assertNull(mTestObject.waitForIntArray());
// LIVECONNECT_COMPLIANCE: This should not count as an array, so we
// should raise a JavaScript exception.
long length = (long)Integer.MAX_VALUE + 1L;
executeJavaScript("testObject.setIntArray({length: " + length + "});");
assertNull(mTestObject.waitForIntArray());
// LIVECONNECT_COMPLIANCE: This should not count as an array, so we
// should raise a JavaScript exception.
length = (long)Integer.MAX_VALUE + 1L - (long)Integer.MIN_VALUE + 1L;
executeJavaScript("testObject.setIntArray({length: " + length + "});");
assertNull(mTestObject.waitForIntArray());
|
public void | testMethodReturningArrayNotCalled()
// We don't invoke methods which return arrays, but note that no
// exception is raised.
// LIVECONNECT_COMPLIANCE: Should call method and convert result to
// JavaScript array.
executeJavaScript("testObject.setBooleanValue(undefined === testObject.arrayMethod())");
assertTrue(mTestObject.waitForBooleanValue());
assertFalse(mTestObject.wasArrayMethodCalled());
|
public void | testMultiDimensionalArrayMethod()
// LIVECONNECT_COMPLIANCE: Should handle multi-dimensional arrays.
executeJavaScript("testObject.setIntIntArray([ [42, 43], [44, 45] ]);");
assertNull(mTestObject.waitForIntIntArray());
|
public void | testNonNumericLengthProperty()
// LIVECONNECT_COMPLIANCE: This should not count as an array, so we
// should raise a JavaScript exception.
executeJavaScript("testObject.setIntArray({length: \"foo\"});");
assertNull(mTestObject.waitForIntArray());
|
public void | testObjectWithLengthProperty()
executeJavaScript("testObject.setIntArray({length: 3, 1: 42});");
int[] result = mTestObject.waitForIntArray();
assertEquals(3, result.length);
assertEquals(0, result[0]);
assertEquals(42, result[1]);
assertEquals(0, result[2]);
|
public void | testPassArrayToNonStringNonArrayMethod()
// LIVECONNECT_COMPLIANCE: Should raise JavaScript exception.
executeJavaScript("testObject.setIntValue([42, 42, 42]);");
assertEquals(0, mTestObject.waitForIntValue());
|
public void | testPassArrayToStringMethod()
// LIVECONNECT_COMPLIANCE: Should call toString() on array.
executeJavaScript("testObject.setStringValue([42, 42, 42]);");
assertEquals("undefined", mTestObject.waitForStringValue());
|
public void | testPassEmptyArray()
executeJavaScript("testObject.setIntArray([]);");
assertEquals(0, mTestObject.waitForIntArray().length);
|
public void | testPassMultiDimensionalArray()
// LIVECONNECT_COMPLIANCE: Should handle multi-dimensional arrays.
executeJavaScript("testObject.setIntArray([ [42, 43], [44, 45] ]);");
int[] result = mTestObject.waitForIntArray();
assertEquals(2, result.length);
assertEquals(0, result[0]);
assertEquals(0, result[1]);
|
public void | testPassNonArrayToArrayMethod()
// LIVECONNECT_COMPLIANCE: Should raise JavaScript exception.
executeJavaScript("testObject.setIntArray(42);");
assertNull(mTestObject.waitForIntArray());
|
public void | testPassNull()
executeJavaScript("testObject.setIntArray(null);");
assertNull(mTestObject.waitForIntArray());
|
public void | testPassUndefined()
executeJavaScript("testObject.setIntArray(undefined);");
assertNull(mTestObject.waitForIntArray());
|
public void | testSparseArray()
executeJavaScript("var x = [42, 43]; x[3] = 45; testObject.setIntArray(x);");
int[] result = mTestObject.waitForIntArray();
assertEquals(4, result.length);
assertEquals(42, result[0]);
assertEquals(43, result[1]);
assertEquals(0, result[2]);
assertEquals(45, result[3]);
|