diff options
author | Steve Block <steveblock@google.com> | 2011-11-14 18:07:35 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2011-11-16 14:26:37 +0000 |
commit | 908bc4a8463e083c49909d8bce71fd016da9b5af (patch) | |
tree | 2a08e91f738fc5ddd65aaf000a585957cf143e23 /tests/WebViewTests/src/com/android/webviewtests | |
parent | 13ad467a91ac6d86a959b49f0168a0e6893aef2c (diff) | |
download | frameworks_base-908bc4a8463e083c49909d8bce71fd016da9b5af.zip frameworks_base-908bc4a8463e083c49909d8bce71fd016da9b5af.tar.gz frameworks_base-908bc4a8463e083c49909d8bce71fd016da9b5af.tar.bz2 |
Fix tests for methods returning arrays in WebView's Java Bridge
Change-Id: Ibbac2268307fbfcff09a2d3b0f841ce420edc416
Diffstat (limited to 'tests/WebViewTests/src/com/android/webviewtests')
-rw-r--r-- | tests/WebViewTests/src/com/android/webviewtests/JavaBridgeArrayTest.java | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/tests/WebViewTests/src/com/android/webviewtests/JavaBridgeArrayTest.java b/tests/WebViewTests/src/com/android/webviewtests/JavaBridgeArrayTest.java index 51dd80d..5497990 100644 --- a/tests/WebViewTests/src/com/android/webviewtests/JavaBridgeArrayTest.java +++ b/tests/WebViewTests/src/com/android/webviewtests/JavaBridgeArrayTest.java @@ -40,6 +40,8 @@ public class JavaBridgeArrayTest extends JavaBridgeTestBase { private int[] mIntArray; + private boolean mWasArrayMethodCalled; + public synchronized void setBooleanValue(boolean x) { mBooleanValue = x; notifyResultIsReady(); @@ -76,11 +78,13 @@ public class JavaBridgeArrayTest extends JavaBridgeTestBase { return mIntArray; } - public int[] getIntArray() { + public synchronized int[] arrayMethod() { + mWasArrayMethodCalled = true; return new int[] {42, 43, 44}; } - public int[] getEmptyIntArray() { - return new int[] {}; + + public synchronized boolean wasArrayMethodCalled() { + return mWasArrayMethodCalled; } } @@ -160,18 +164,13 @@ public class JavaBridgeArrayTest extends JavaBridgeTestBase { // Note that this requires being able to pass a boolean from JavaScript to // Java. - public void testReturnArray() throws Throwable { - // LIVECONNECT_COMPLIANCE: Convert to JavaScript array. - executeJavaScript("testObject.setBooleanValue(undefined === testObject.getIntArray())"); - assertTrue(mTestObject.waitForBooleanValue()); - } - - // Note that this requires being able to pass a boolean from JavaScript to - // Java. - public void testReturnEmptyArray() throws Throwable { - // LIVECONNECT_COMPLIANCE: Convert to JavaScript array. - executeJavaScript( - "testObject.setBooleanValue(undefined === testObject.getEmptyIntArray())"); + public void testMethodReturningArrayNotCalled() throws Throwable { + // 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()); } } |