2424import android .hardware .Camera ;
2525import android .media .MediaPlayer ;
2626import android .media .MediaRecorder ;
27+ import android .os .Environment ;
2728import android .test .ActivityInstrumentationTestCase2 ;
2829import android .test .suitebuilder .annotation .LargeTest ;
2930import android .util .Log ;
@@ -66,6 +67,9 @@ protected void setUp() throws Exception {
6667 private int mTotalNotSeekable = 0 ;
6768 private int mTotalMetaDataUpdate = 0 ;
6869
70+ //Test result output file
71+ private static final String PLAYBACK_RESULT = "PlaybackTestResult.txt" ;
72+
6973 private void writeTestOutput (String filename , Writer output ) throws Exception {
7074 output .write ("File Name: " + filename );
7175 output .write (" Complete: " + CodecTest .onCompleteSuccess );
@@ -109,27 +113,19 @@ else if (CodecTest.mPlaybackError){
109113 @ LargeTest
110114 public void testVideoPlayback () throws Exception {
111115 String fileWithError = "Filename:\n " ;
112- File playbackOutput = new File ("/sdcard/PlaybackTestResult.txt" );
116+ File playbackOutput = new File (Environment . getExternalStorageDirectory (), PLAYBACK_RESULT );
113117 Writer output = new BufferedWriter (new FileWriter (playbackOutput , true ));
114118
115119 boolean testResult = true ;
116120 // load directory files
117121 boolean onCompleteSuccess = false ;
118122 File dir = new File (MediaNames .MEDIA_SAMPLE_POOL );
119-
120- Instrumentation inst = getInstrumentation ();
121- Intent intent = new Intent ();
122-
123- intent .setClass (getInstrumentation ().getTargetContext (), MediaFrameworkTest .class );
124- intent .addFlags (Intent .FLAG_ACTIVITY_NEW_TASK );
125-
126123 String [] children = dir .list ();
127124 if (children == null ) {
128125 Log .v ("MediaPlayerApiTest:testMediaSamples" , "dir is empty" );
129126 return ;
130127 } else {
131128 for (int i = 0 ; i < children .length ; i ++) {
132- Activity act = inst .startActivitySync (intent );
133129 //Get filename of directory
134130 String filename = children [i ];
135131 onCompleteSuccess =
@@ -141,8 +137,6 @@ public void testVideoPlayback() throws Exception {
141137 testResult = false ;
142138 }
143139 Thread .sleep (3000 );
144- //Call onCreat to recreate the surface
145- act .finish ();
146140 //Write test result to an output file
147141 writeTestOutput (filename ,output );
148142 //Get the summary
0 commit comments