1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 package org.chromium.mojo.bindings; 6 7 import android.test.suitebuilder.annotation.SmallTest; 8 9 import junit.framework.TestCase; 10 11 import org.chromium.mojo.bindings.Callbacks.Callback1; 12 import org.chromium.mojo.bindings.Callbacks.Callback7; 13 14 import java.util.ArrayList; 15 import java.util.Arrays; 16 import java.util.List; 17 18 /** 19 * Testing generated callbacks 20 */ 21 public class CallbacksTest extends TestCase { 22 23 /** 24 * Testing {@link Callback1}. 25 */ 26 @SmallTest testCallback1()27 public void testCallback1() { 28 final List<Integer> parameters = new ArrayList<Integer>(); 29 new Callback1<Integer>() { 30 @Override 31 public void call(Integer i1) { 32 parameters.add(i1); 33 } 34 }.call(1); 35 assertEquals(Arrays.asList(1), parameters); 36 } 37 38 /** 39 * Testing {@link Callback7}. 40 */ 41 @SmallTest testCallback7()42 public void testCallback7() { 43 final List<Integer> parameters = new ArrayList<Integer>(); 44 new Callback7<Integer, Integer, Integer, Integer, Integer, Integer, Integer>() { 45 @Override 46 public void call(Integer i1, Integer i2, Integer i3, Integer i4, Integer i5, Integer i6, 47 Integer i7) { 48 parameters.add(i1); 49 parameters.add(i2); 50 parameters.add(i3); 51 parameters.add(i4); 52 parameters.add(i5); 53 parameters.add(i6); 54 parameters.add(i7); 55 } 56 }.call(1, 2, 3, 4, 5, 6, 7); 57 assertEquals(Arrays.asList(1, 2, 3, 4, 5, 6, 7), parameters); 58 } 59 } 60