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.support.test.filters.SmallTest; 8 9 import org.junit.Assert; 10 import org.junit.Test; 11 import org.junit.runner.RunWith; 12 13 import org.chromium.base.test.BaseJUnit4ClassRunner; 14 import org.chromium.mojo.bindings.Callbacks.Callback1; 15 import org.chromium.mojo.bindings.Callbacks.Callback7; 16 17 import java.util.ArrayList; 18 import java.util.Arrays; 19 import java.util.List; 20 21 /** 22 * Testing generated callbacks 23 */ 24 @RunWith(BaseJUnit4ClassRunner.class) 25 public class CallbacksTest { 26 /** 27 * Testing {@link Callback1}. 28 */ 29 @Test 30 @SmallTest testCallback1()31 public void testCallback1() { 32 final List<Integer> parameters = new ArrayList<Integer>(); 33 new Callback1<Integer>() { 34 @Override 35 public void call(Integer i1) { 36 parameters.add(i1); 37 } 38 } 39 .call(1); 40 Assert.assertEquals(Arrays.asList(1), parameters); 41 } 42 43 /** 44 * Testing {@link Callback7}. 45 */ 46 @Test 47 @SmallTest testCallback7()48 public void testCallback7() { 49 final List<Integer> parameters = new ArrayList<Integer>(); 50 new Callback7<Integer, Integer, Integer, Integer, Integer, Integer, Integer>() { 51 @Override 52 public void call(Integer i1, Integer i2, Integer i3, Integer i4, Integer i5, Integer i6, 53 Integer i7) { 54 parameters.add(i1); 55 parameters.add(i2); 56 parameters.add(i3); 57 parameters.add(i4); 58 parameters.add(i5); 59 parameters.add(i6); 60 parameters.add(i7); 61 } 62 } 63 .call(1, 2, 3, 4, 5, 6, 7); 64 Assert.assertEquals(Arrays.asList(1, 2, 3, 4, 5, 6, 7), parameters); 65 } 66 } 67