summaryrefslogtreecommitdiffstats
path: root/tests/CanvasCompare/src/com/android/test/hwuicompare/Test.java
blob: 1ff153c003c141c4d853920fa49e3d9901c24c64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package com.android.test.hwuicompare;

import com.android.test.hwuicompare.AutomaticActivity.FinalCallback;

import android.os.Bundle;
import android.test.ActivityInstrumentationTestCase2;

public class Test extends ActivityInstrumentationTestCase2<AutomaticActivity> {
    AutomaticActivity mActivity;
    private Bundle mBundle;

    public Test() {
        super(AutomaticActivity.class);
    }

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        mBundle = new Bundle();
        mActivity = getActivity();
        mActivity.setFinalCallback(new FinalCallback() {

            @Override
            void report(String key, float value) {
                mBundle.putFloat(key, value);
            }
            @Override
            void complete() {
                synchronized(mBundle) {
                    mBundle.notify();
                }
            }
        });
    }

    public void testCanvas() {
        synchronized(mBundle) {
            try {
                mBundle.wait();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        getInstrumentation().sendStatus(0, mBundle);
    }
}