blob: cae9e31c3cadf42eb36b370e80fba01b784a925f [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2008 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.unit;
18
19import android.media.MediaRecorder;
20import android.test.AndroidTestCase;
Yu Shan Emily Lau3e7b3c02009-03-24 22:20:13 -070021import android.test.suitebuilder.annotation.MediumTest;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.test.suitebuilder.annotation.Suppress;
23
24/**
25 * Unit test class to test the set of valid and invalid states that
26 * MediaRecorder.reset() method can be called.
27 */
28public class MediaRecorderResetStateUnitTest extends AndroidTestCase implements MediaRecorderMethodUnderTest {
29 private MediaRecorderStateUnitTestTemplate mTestTemplate = new MediaRecorderStateUnitTestTemplate();
30
31 /**
32 * 1. It is valid to call reset() in the following states:
33 * {Prepared, Initial, Initialized, DataSourceConfigured, Recording, Error}.
34 * 2. It is invalid to call reset() in the following states:
35 * {}
36 *
37 * @param stateErrors the MediaRecorderStateErrors to check against.
38 */
39 public void checkStateErrors(MediaRecorderStateErrors stateErrors) {
40 // Valid states.
41 assertTrue(!stateErrors.errorInPreparedState);
42 assertTrue(!stateErrors.errorInRecordingState);
43 assertTrue(!stateErrors.errorInInitialState);
44 assertTrue(!stateErrors.errorInInitialStateAfterReset);
45 assertTrue(!stateErrors.errorInInitialStateAfterStop);
46 assertTrue(!stateErrors.errorInInitializedState);
47 assertTrue(!stateErrors.errorInErrorState);
48 assertTrue(!stateErrors.errorInDataSourceConfiguredState);
49
50 // Invalid states.
51 }
52
53 public void invokeMethodUnderTest(MediaRecorder recorder) {
54 recorder.reset();
55 }
56
Yu Shan Emily Lau3e7b3c02009-03-24 22:20:13 -070057 @MediumTest
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080058 public void testReset() {
59 mTestTemplate.runTestOnMethod(this);
60 }
61
62 @Override
63 public String toString() {
64 return "reset()";
65 }
66}