The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package com.android.mediaframeworktest; |
| 18 | |
| 19 | import android.test.InstrumentationTestRunner; |
| 20 | import android.test.InstrumentationTestSuite; |
| 21 | import com.android.mediaframeworktest.unit.*; |
| 22 | |
| 23 | import junit.framework.TestSuite; |
| 24 | |
| 25 | /** |
| 26 | * Instrumentation Test Runner for all media framework unit tests. |
Nicolas Catania | a5ccb22 | 2009-07-14 21:55:54 -0700 | [diff] [blame] | 27 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 28 | * Make sure that MediaFrameworkUnitTestRunner has been added to |
| 29 | * AndroidManifest.xml file, and then "make -j4 mediaframeworktest; adb sync" |
| 30 | * to build and upload mediaframeworktest to the phone or emulator. |
Nicolas Catania | a5ccb22 | 2009-07-14 21:55:54 -0700 | [diff] [blame] | 31 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 32 | * Example on running all unit tests for a single class: |
| 33 | * adb shell am instrument -e class \ |
Nicolas Catania | a5ccb22 | 2009-07-14 21:55:54 -0700 | [diff] [blame] | 34 | * com.android.mediaframeworktest.unit.MediaMetadataRetrieverUnitTest \ |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 35 | * -w com.android.mediaframeworktest/.MediaFrameworkUnitTestRunner |
Nicolas Catania | a5ccb22 | 2009-07-14 21:55:54 -0700 | [diff] [blame] | 36 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 37 | * Example on running all unit tests for the media framework: |
| 38 | * adb shell am instrument \ |
| 39 | * -w com.android.mediaframeworktest/.MediaFrameworkUnitTestRunner |
| 40 | */ |
| 41 | |
| 42 | public class MediaFrameworkUnitTestRunner extends InstrumentationTestRunner { |
| 43 | |
| 44 | @Override |
| 45 | public TestSuite getAllTests() { |
| 46 | TestSuite suite = new InstrumentationTestSuite(this); |
| 47 | addMediaMetadataRetrieverStateUnitTests(suite); |
| 48 | addMediaRecorderStateUnitTests(suite); |
| 49 | addMediaPlayerStateUnitTests(suite); |
Dongwon Kang | 8e2ed8d | 2011-10-10 19:18:45 -0700 | [diff] [blame] | 50 | addMediaScannerUnitTests(suite); |
Igor Murashkin | e363fbb | 2013-06-25 20:26:06 +0000 | [diff] [blame] | 51 | addCameraUnitTests(suite); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 52 | return suite; |
| 53 | } |
| 54 | |
| 55 | @Override |
| 56 | public ClassLoader getLoader() { |
| 57 | return MediaFrameworkUnitTestRunner.class.getClassLoader(); |
| 58 | } |
Nicolas Catania | a5ccb22 | 2009-07-14 21:55:54 -0700 | [diff] [blame] | 59 | |
Igor Murashkin | e363fbb | 2013-06-25 20:26:06 +0000 | [diff] [blame] | 60 | private void addCameraUnitTests(TestSuite suite) { |
| 61 | suite.addTestSuite(CameraUtilsDecoratorTest.class); |
| 62 | suite.addTestSuite(CameraUtilsRuntimeExceptionTest.class); |
| 63 | suite.addTestSuite(CameraUtilsUncheckedThrowTest.class); |
| 64 | suite.addTestSuite(CameraUtilsBinderDecoratorTest.class); |
Igor Murashkin | 7072550 | 2013-06-25 20:27:06 +0000 | [diff] [blame^] | 65 | suite.addTestSuite(CameraMetadataTest.class); |
Igor Murashkin | e363fbb | 2013-06-25 20:26:06 +0000 | [diff] [blame] | 66 | } |
| 67 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 68 | // Running all unit tests checking the state machine may be time-consuming. |
| 69 | private void addMediaMetadataRetrieverStateUnitTests(TestSuite suite) { |
| 70 | suite.addTestSuite(MediaMetadataRetrieverTest.class); |
| 71 | } |
Nicolas Catania | a5ccb22 | 2009-07-14 21:55:54 -0700 | [diff] [blame] | 72 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 73 | // Running all unit tests checking the state machine may be time-consuming. |
| 74 | private void addMediaRecorderStateUnitTests(TestSuite suite) { |
| 75 | suite.addTestSuite(MediaRecorderPrepareStateUnitTest.class); |
| 76 | suite.addTestSuite(MediaRecorderResetStateUnitTest.class); |
| 77 | suite.addTestSuite(MediaRecorderSetAudioEncoderStateUnitTest.class); |
| 78 | suite.addTestSuite(MediaRecorderSetAudioSourceStateUnitTest.class); |
| 79 | suite.addTestSuite(MediaRecorderSetOutputFileStateUnitTest.class); |
| 80 | suite.addTestSuite(MediaRecorderSetOutputFormatStateUnitTest.class); |
| 81 | suite.addTestSuite(MediaRecorderStartStateUnitTest.class); |
| 82 | suite.addTestSuite(MediaRecorderStopStateUnitTest.class); |
| 83 | } |
| 84 | |
| 85 | // Running all unit tests checking the state machine may be time-consuming. |
| 86 | private void addMediaPlayerStateUnitTests(TestSuite suite) { |
| 87 | suite.addTestSuite(MediaPlayerGetDurationStateUnitTest.class); |
| 88 | suite.addTestSuite(MediaPlayerSeekToStateUnitTest.class); |
| 89 | suite.addTestSuite(MediaPlayerGetCurrentPositionStateUnitTest.class); |
| 90 | suite.addTestSuite(MediaPlayerGetVideoWidthStateUnitTest.class); |
| 91 | suite.addTestSuite(MediaPlayerGetVideoHeightStateUnitTest.class); |
| 92 | suite.addTestSuite(MediaPlayerIsPlayingStateUnitTest.class); |
| 93 | suite.addTestSuite(MediaPlayerResetStateUnitTest.class); |
| 94 | suite.addTestSuite(MediaPlayerPauseStateUnitTest.class); |
| 95 | suite.addTestSuite(MediaPlayerStartStateUnitTest.class); |
| 96 | suite.addTestSuite(MediaPlayerStopStateUnitTest.class); |
| 97 | suite.addTestSuite(MediaPlayerSetLoopingStateUnitTest.class); |
| 98 | suite.addTestSuite(MediaPlayerSetAudioStreamTypeStateUnitTest.class); |
| 99 | suite.addTestSuite(MediaPlayerSetVolumeStateUnitTest.class); |
Nicolas Catania | a5ccb22 | 2009-07-14 21:55:54 -0700 | [diff] [blame] | 100 | suite.addTestSuite(MediaPlayerMetadataParserTest.class); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 101 | } |
Dongwon Kang | 8e2ed8d | 2011-10-10 19:18:45 -0700 | [diff] [blame] | 102 | |
| 103 | private void addMediaScannerUnitTests(TestSuite suite) { |
| 104 | suite.addTestSuite(MediaInserterTest.class); |
| 105 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 106 | } |