From 1bc5501a7e8e1d35888ece8b0fe11af8e06ac678 Mon Sep 17 00:00:00 2001 From: "qsr@chromium.org" Date: Mon, 2 Jun 2014 18:04:59 +0000 Subject: Generate java bindings for constants. This CL is the first CL introducing java bindings. It only generates constants. This is a reland of https://codereview.chromium.org/291903003 TBR=viettrungluu@chromium.org,rmcilroy@chromium.org Review URL: https://codereview.chromium.org/305963009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274278 0039d316-1c4b-4281-b951-d872f2087c98 --- .../org/chromium/mojo/bindings/BindingsTest.java | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 mojo/android/javatests/src/org/chromium/mojo/bindings/BindingsTest.java (limited to 'mojo/android/javatests/src') diff --git a/mojo/android/javatests/src/org/chromium/mojo/bindings/BindingsTest.java b/mojo/android/javatests/src/org/chromium/mojo/bindings/BindingsTest.java new file mode 100644 index 0000000..1c4807b --- /dev/null +++ b/mojo/android/javatests/src/org/chromium/mojo/bindings/BindingsTest.java @@ -0,0 +1,33 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.mojo.bindings; + +import android.test.suitebuilder.annotation.SmallTest; + +import junit.framework.TestCase; + +import org.chromium.mojo.bindings.test.sample.SampleServiceConstants; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; + +/** + * Testing generated classes and associated features. + */ +public class BindingsTest extends TestCase { + + /** + * Testing constants are correctly generated. + */ + @SmallTest + public void testConstants() throws NoSuchFieldException, SecurityException { + assertEquals(3, SampleServiceConstants.THREE); + Field threeField = SampleServiceConstants.class.getField("THREE"); + assertEquals(byte.class, threeField.getType()); + assertEquals(Modifier.FINAL, threeField.getModifiers() & Modifier.FINAL); + assertEquals(Modifier.STATIC, threeField.getModifiers() & Modifier.STATIC); + } + +} -- cgit v1.1