1 package com.android.test.hwuicompare; 2 3 import com.android.test.hwuicompare.AutomaticActivity.FinalCallback; 4 5 import android.os.Bundle; 6 import android.test.ActivityInstrumentationTestCase2; 7 8 public class Test extends ActivityInstrumentationTestCase2<AutomaticActivity> { 9 AutomaticActivity mActivity; 10 private Bundle mBundle; 11 Test()12 public Test() { 13 super(AutomaticActivity.class); 14 } 15 16 @Override setUp()17 protected void setUp() throws Exception { 18 super.setUp(); 19 mBundle = new Bundle(); 20 mActivity = getActivity(); 21 mActivity.setFinalCallback(new FinalCallback() { 22 23 @Override 24 void report(String key, float value) { 25 mBundle.putFloat(key, value); 26 } 27 @Override 28 void complete() { 29 synchronized(mBundle) { 30 mBundle.notify(); 31 } 32 } 33 }); 34 } 35 testCanvas()36 public void testCanvas() { 37 synchronized(mBundle) { 38 try { 39 mBundle.wait(); 40 } catch (InterruptedException e) { 41 e.printStackTrace(); 42 } 43 } 44 getInstrumentation().sendStatus(0, mBundle); 45 } 46 } 47