blob: 0b0d0ce1c2fcb4de4035d40961b792760dcc9148 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
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
17package com.android.mediaframeworktest;
18
Yu Shan Emily Lau48584d72010-05-25 14:13:10 -070019import android.media.MediaRecorder;
20import android.os.Bundle;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080021import android.test.InstrumentationTestRunner;
22import android.test.InstrumentationTestSuite;
Yu Shan Emily Lau5d386a12011-02-07 21:18:00 -080023import com.android.mediaframeworktest.stress.MediaRecorderStressTest;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080024
25import junit.framework.TestSuite;
26
27public class MediaRecorderStressTestRunner extends InstrumentationTestRunner {
28
Yu Shan Emily Lau48584d72010-05-25 14:13:10 -070029 // Default recorder settings
30 public static int mIterations = 100;
31 public static int mVideoEncoder = MediaRecorder.VideoEncoder.H263;
32 public static int mAudioEncdoer = MediaRecorder.AudioEncoder.AMR_NB;
33 public static int mFrameRate = 20;
34 public static int mVideoWidth = 352;
35 public static int mVideoHeight = 288;
36 public static int mBitRate = 100;
37 public static boolean mRemoveVideo = true;
38 public static int mDuration = 10000;
39
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080040 @Override
41 public TestSuite getAllTests() {
42 TestSuite suite = new InstrumentationTestSuite(this);
43 suite.addTestSuite(MediaRecorderStressTest.class);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044 return suite;
45 }
46
47 @Override
48 public ClassLoader getLoader() {
49 return MediaRecorderStressTestRunner.class.getClassLoader();
50 }
Yu Shan Emily Lau48584d72010-05-25 14:13:10 -070051
52 @Override
53 public void onCreate(Bundle icicle) {
54 super.onCreate(icicle);
55 String iterations = (String) icicle.get("iterations");
56 String video_encoder = (String) icicle.get("video_encoder");
57 String audio_encoder = (String) icicle.get("audio_encoder");
58 String frame_rate = (String) icicle.get("frame_rate");
59 String video_width = (String) icicle.get("video_width");
60 String video_height = (String) icicle.get("video_height");
61 String bit_rate = (String) icicle.get("bit_rate");
62 String record_duration = (String) icicle.get("record_duration");
63 String remove_videos = (String) icicle.get("remove_videos");
64
65 if (iterations != null ) {
66 mIterations = Integer.parseInt(iterations);
67 }
68 if ( video_encoder != null) {
69 mVideoEncoder = Integer.parseInt(video_encoder);
70 }
71 if ( audio_encoder != null) {
72 mAudioEncdoer = Integer.parseInt(audio_encoder);
73 }
74 if (frame_rate != null) {
75 mFrameRate = Integer.parseInt(frame_rate);
76 }
77 if (video_width != null) {
78 mVideoWidth = Integer.parseInt(video_width);
79 }
80 if (video_height != null) {
81 mVideoHeight = Integer.parseInt(video_height);
82 }
83 if (bit_rate != null) {
84 mBitRate = Integer.parseInt(bit_rate);
85 }
86 if (record_duration != null) {
87 mDuration = Integer.parseInt(record_duration);
88 }
89 if (remove_videos != null) {
90 if (remove_videos.compareTo("true") == 0) {
91 mRemoveVideo = true;
92 } else {
93 mRemoveVideo = false;
94 }
95 }
96 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080097}