Java 类android.test.ActivityTestCase 实例源码

项目:loopy-sdk-android    文件:TestUtils.java   
public static Boolean click(ActivityTestCase test, final View view) throws Throwable {

        final CountDownLatch latch = new CountDownLatch(1);
        final Holder<Boolean> result = new Holder<Boolean>();
        test.runTestOnUiThread(new Runnable() {
            @Override
            public void run() {
                result.set(view.performClick());
                latch.countDown();
            }
        });

        latch.await(10, TimeUnit.SECONDS);

        return result.get();
    }