diff options
author | qsr@chromium.org <qsr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-05 15:16:34 +0000 |
---|---|---|
committer | qsr@chromium.org <qsr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-05 15:16:34 +0000 |
commit | f0e9de8689abfa92a6f5b28afabb25e403a1a6bd (patch) | |
tree | e93933db273bb8cc9bed4167b9834c956624096f /mojo/android/javatests | |
parent | 0ad92036a417c001f88a0dc638d1e8e00c6da1e8 (diff) | |
download | chromium_src-f0e9de8689abfa92a6f5b28afabb25e403a1a6bd.zip chromium_src-f0e9de8689abfa92a6f5b28afabb25e403a1a6bd.tar.gz chromium_src-f0e9de8689abfa92a6f5b28afabb25e403a1a6bd.tar.bz2 |
Generate enums for mojo java bindings.
Review URL: https://codereview.chromium.org/300043006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275130 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/android/javatests')
-rw-r--r-- | mojo/android/javatests/src/org/chromium/mojo/bindings/BindingsTest.java | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/mojo/android/javatests/src/org/chromium/mojo/bindings/BindingsTest.java b/mojo/android/javatests/src/org/chromium/mojo/bindings/BindingsTest.java index ea77023..27fba62 100644 --- a/mojo/android/javatests/src/org/chromium/mojo/bindings/BindingsTest.java +++ b/mojo/android/javatests/src/org/chromium/mojo/bindings/BindingsTest.java @@ -8,6 +8,9 @@ import android.test.suitebuilder.annotation.SmallTest; import junit.framework.TestCase; +import org.chromium.mojo.bindings.test.imported.Color; +import org.chromium.mojo.bindings.test.imported.Shape; +import org.chromium.mojo.bindings.test.sample.Enum; import org.chromium.mojo.bindings.test.sample.InterfaceConstants; import org.chromium.mojo.bindings.test.sample.SampleServiceConstants; @@ -19,8 +22,7 @@ import java.lang.reflect.Modifier; */ public class BindingsTest extends TestCase { - private static void checkConstantField(Field field, Class<?> expectedClass) - { + private static void checkConstantField(Field field, Class<?> expectedClass) { assertEquals(expectedClass, field.getType()); assertEquals(Modifier.FINAL, field.getModifiers() & Modifier.FINAL); assertEquals(Modifier.STATIC, field.getModifiers() & Modifier.STATIC); @@ -38,4 +40,25 @@ public class BindingsTest extends TestCase { checkConstantField(InterfaceConstants.class.getField("LONG"), long.class); } + /** + * Testing enums are correctly generated. + */ + @SmallTest + public void testEnums() throws NoSuchFieldException, SecurityException { + assertEquals(0, Color.COLOR_RED); + assertEquals(1, Color.COLOR_BLACK); + checkConstantField(Color.class.getField("COLOR_BLACK"), int.class); + checkConstantField(Color.class.getField("COLOR_RED"), int.class); + + assertEquals(0, Enum.ENUM_VALUE); + checkConstantField(Enum.class.getField("ENUM_VALUE"), int.class); + + assertEquals(1, Shape.SHAPE_RECTANGLE); + assertEquals(2, Shape.SHAPE_CIRCLE); + assertEquals(3, Shape.SHAPE_TRIANGLE); + checkConstantField(Shape.class.getField("SHAPE_RECTANGLE"), int.class); + checkConstantField(Shape.class.getField("SHAPE_CIRCLE"), int.class); + checkConstantField(Shape.class.getField("SHAPE_TRIANGLE"), int.class); + } + } |