• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.cisco.codec.unittest;
2 
3 
4 import android.os.Bundle;
5 import android.app.Activity;
6 import android.view.Menu;
7 import android.view.View;
8 import android.util.Log;
9 import android.widget.TextView;
10 import android.os.Build;
11 import android.os.Process;
12 
13 public class MainActivity extends Activity {
14 
15   private TextView mStatusView;
16 
17   @Override
onCreate(Bundle savedInstanceState)18   protected void onCreate (Bundle savedInstanceState) {
19     super.onCreate (savedInstanceState);
20     setContentView (R.layout.activity_main);
21 
22     mStatusView = (TextView)findViewById (R.id.status_view);
23 
24     runUnitTest();
25 
26   }
27 
28   @Override
onDestroy()29   public void onDestroy() {
30     super.onDestroy();
31     Log.i ("codec_unittest", "OnDestroy");
32     Process.killProcess (Process.myPid());
33   }
34 
35 
36 
runUnitTest()37   public void runUnitTest() {
38     Thread thread = new Thread() {
39 
40       public void run() {
41         Log.i ("codec_unittest", "codec unittest begin");
42         CharSequence text = "Running...";
43         if (mStatusView != null) {
44           mStatusView.setText (text);
45         }
46 
47 //        String path = getIntent().getStringExtra("path");
48 //        if (path.length() <=0)
49 //        {
50 //          path = "/sdcard/codec_unittest.xml";
51 //        }
52         String path = "/sdcard/codec_unittest.xml";
53         Log.i ("codec_unittest", "codec unittest runing @" + path);
54         DoUnittest ("/sdcard", path);
55         Log.i ("codec_unittest", "codec unittest end");
56         finish();
57       }
58 
59     };
60     thread.start();
61   }
62 
63   static {
64     try {
65       System.loadLibrary ("stlport_shared");
66       //System.loadLibrary("openh264");
67       System.loadLibrary ("ut");
68       System.loadLibrary ("utDemo");
69 
70 
71     } catch (Exception e) {
72       Log.v ("codec_unittest", "Load library failed");
73     }
74 
75   }
76 
DoUnittest(String directory, String path)77   public native void DoUnittest (String directory, String path);
78 
79 }
80