|
22 | 22 | import com.android.mediaframeworktest.functional.CodecTest; |
23 | 23 |
|
24 | 24 | import android.content.Context; |
25 | | -import android.test.ActivityInstrumentationTestCase; |
| 25 | +import android.test.ActivityInstrumentationTestCase2; |
26 | 26 | import android.util.Log; |
27 | 27 | import android.test.suitebuilder.annotation.LargeTest; |
28 | 28 | import android.test.suitebuilder.annotation.MediumTest; |
|
33 | 33 | /** |
34 | 34 | * Junit / Instrumentation test case for the media player api |
35 | 35 | */ |
36 | | -public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFrameworkTest> { |
37 | | - private boolean duratoinWithinTolerence = false; |
38 | | - private String TAG = "MediaPlayerApiTest"; |
39 | | - private boolean isWMAEnable = false; |
40 | | - private boolean isWMVEnable = false; |
| 36 | +public class MediaPlayerApiTest extends ActivityInstrumentationTestCase2<MediaFrameworkTest> { |
| 37 | + private boolean duratoinWithinTolerence = false; |
| 38 | + private String TAG = "MediaPlayerApiTest"; |
| 39 | + private boolean isWMAEnable = false; |
| 40 | + private boolean isWMVEnable = false; |
41 | 41 |
|
42 | | - Context mContext; |
| 42 | + Context mContext; |
43 | 43 |
|
44 | | - public MediaPlayerApiTest() { |
45 | | - super("com.android.mediaframeworktest", MediaFrameworkTest.class); |
46 | | - isWMAEnable = MediaProfileReader.getWMAEnable(); |
47 | | - isWMVEnable = MediaProfileReader.getWMVEnable(); |
48 | | - } |
| 44 | + public MediaPlayerApiTest() { |
| 45 | + super("com.android.mediaframeworktest", MediaFrameworkTest.class); |
| 46 | + isWMAEnable = MediaProfileReader.getWMAEnable(); |
| 47 | + isWMVEnable = MediaProfileReader.getWMVEnable(); |
| 48 | + } |
49 | 49 |
|
50 | 50 | protected void setUp() throws Exception { |
51 | | - super.setUp(); |
52 | | - |
53 | | - } |
54 | | - |
| 51 | + //Insert a 2 second before launching the test activity. This is |
| 52 | + //the workaround for the race condition of requesting the updated surface. |
| 53 | + Thread.sleep(2000); |
| 54 | + getActivity(); |
| 55 | + super.setUp(); |
| 56 | + } |
| 57 | + |
55 | 58 | public boolean verifyDuration(int duration, int expectedDuration){ |
56 | 59 | if ((duration > expectedDuration * 1.1) || (duration < expectedDuration * 0.9)) |
57 | 60 | return false; |
|
0 commit comments