2 * Copyright (C) 2009 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package com.android.mediaframeworktest;
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;
26 import junit.framework.TestSuite;
28 public class MediaRecorderStressTestRunner extends InstrumentationTestRunner {
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;
42 public TestSuite getAllTests() {
43 TestSuite suite = new InstrumentationTestSuite(this);
44 suite.addTestSuite(MediaRecorderStressTest.class);
45 suite.addTestSuite(MediaPlayerStressTest.class);
50 public ClassLoader getLoader() {
51 return MediaRecorderStressTestRunner.class.getClassLoader();
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");
67 if (iterations != null ) {
68 mIterations = Integer.parseInt(iterations);
70 if ( video_encoder != null) {
71 mVideoEncoder = Integer.parseInt(video_encoder);
73 if ( audio_encoder != null) {
74 mAudioEncdoer = Integer.parseInt(audio_encoder);
76 if (frame_rate != null) {
77 mFrameRate = Integer.parseInt(frame_rate);
79 if (video_width != null) {
80 mVideoWidth = Integer.parseInt(video_width);
82 if (video_height != null) {
83 mVideoHeight = Integer.parseInt(video_height);
85 if (bit_rate != null) {
86 mBitRate = Integer.parseInt(bit_rate);
88 if (record_duration != null) {
89 mDuration = Integer.parseInt(record_duration);
91 if (remove_videos != null) {
92 if (remove_videos.compareTo("true") == 0) {