OSDN Git Service

Added the runtime parameters for the mediarecorder stress test.
[android-x86/frameworks-base.git] / media / tests / MediaFrameworkTest / src / com / android / mediaframeworktest / MediaRecorderStressTestRunner.java
1 /*
2  * Copyright (C) 2009 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package com.android.mediaframeworktest;
18
19 import android.media.MediaRecorder;
20 import android.os.Bundle;
21 import android.test.InstrumentationTestRunner;
22 import android.test.InstrumentationTestSuite;
23 import com.android.mediaframeworktest.stress.MediaRecorderStressTest;
24 import com.android.mediaframeworktest.stress.MediaPlayerStressTest;
25
26 import junit.framework.TestSuite;
27
28 public class MediaRecorderStressTestRunner extends InstrumentationTestRunner {
29
30     // Default recorder settings
31     public static int mIterations = 100;
32     public static int mVideoEncoder = MediaRecorder.VideoEncoder.H263;
33     public static int mAudioEncdoer = MediaRecorder.AudioEncoder.AMR_NB;
34     public static int mFrameRate = 20;
35     public static int mVideoWidth = 352;
36     public static int mVideoHeight = 288;
37     public static int mBitRate = 100;
38     public static boolean mRemoveVideo = true;
39     public static int mDuration = 10000;
40
41     @Override
42     public TestSuite getAllTests() {
43         TestSuite suite = new InstrumentationTestSuite(this);
44         suite.addTestSuite(MediaRecorderStressTest.class);
45         suite.addTestSuite(MediaPlayerStressTest.class);
46         return suite;
47     }
48
49     @Override
50     public ClassLoader getLoader() {
51         return MediaRecorderStressTestRunner.class.getClassLoader();
52     }
53
54     @Override
55     public void onCreate(Bundle icicle) {
56         super.onCreate(icicle);
57         String iterations = (String) icicle.get("iterations");
58         String video_encoder = (String) icicle.get("video_encoder");
59         String audio_encoder = (String) icicle.get("audio_encoder");
60         String frame_rate = (String) icicle.get("frame_rate");
61         String video_width = (String) icicle.get("video_width");
62         String video_height = (String) icicle.get("video_height");
63         String bit_rate = (String) icicle.get("bit_rate");
64         String record_duration = (String) icicle.get("record_duration");
65         String remove_videos = (String) icicle.get("remove_videos");
66
67         if (iterations != null ) {
68             mIterations = Integer.parseInt(iterations);
69         }
70         if ( video_encoder != null) {
71             mVideoEncoder = Integer.parseInt(video_encoder);
72         }
73         if ( audio_encoder != null) {
74             mAudioEncdoer = Integer.parseInt(audio_encoder);
75         }
76         if (frame_rate != null) {
77             mFrameRate = Integer.parseInt(frame_rate);
78         }
79         if (video_width != null) {
80             mVideoWidth = Integer.parseInt(video_width);
81         }
82         if (video_height != null) {
83             mVideoHeight = Integer.parseInt(video_height);
84         }
85         if (bit_rate != null) {
86             mBitRate = Integer.parseInt(bit_rate);
87         }
88         if (record_duration != null) {
89             mDuration = Integer.parseInt(record_duration);
90         }
91         if (remove_videos != null) {
92             if (remove_videos.compareTo("true") == 0) {
93                 mRemoveVideo = true;
94             } else {
95                 mRemoveVideo = false;
96             }
97         }
98     }
99 }