Igor Murashkin | 4491d68 | 2013-05-31 16:43:48 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 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.os.Bundle; |
| 20 | import android.test.InstrumentationTestRunner; |
| 21 | import android.test.InstrumentationTestSuite; |
Igor Murashkin | 7072550 | 2013-06-25 20:27:06 +0000 | [diff] [blame] | 22 | import android.util.Log; |
Igor Murashkin | 4491d68 | 2013-05-31 16:43:48 -0700 | [diff] [blame] | 23 | |
| 24 | import com.android.mediaframeworktest.integration.CameraBinderTest; |
Igor Murashkin | 7072550 | 2013-06-25 20:27:06 +0000 | [diff] [blame] | 25 | import com.android.mediaframeworktest.integration.CameraDeviceBinderTest; |
Igor Murashkin | 4491d68 | 2013-05-31 16:43:48 -0700 | [diff] [blame] | 26 | |
| 27 | import junit.framework.TestSuite; |
| 28 | |
| 29 | /** |
| 30 | * Instrumentation Test Runner for all media framework integration tests. |
| 31 | * |
| 32 | * Running all tests: |
| 33 | * |
| 34 | * adb shell am instrument -w com.android.mediaframeworktest/.MediaFrameworkIntegrationTestRunner |
| 35 | */ |
| 36 | |
| 37 | public class MediaFrameworkIntegrationTestRunner extends InstrumentationTestRunner { |
| 38 | |
Igor Murashkin | 7072550 | 2013-06-25 20:27:06 +0000 | [diff] [blame] | 39 | private static final String TAG = "MediaFrameworkIntegrationTestRunner"; |
| 40 | |
| 41 | public static int mCameraId = 0; |
Igor Murashkin | 4491d68 | 2013-05-31 16:43:48 -0700 | [diff] [blame] | 42 | |
| 43 | @Override |
| 44 | public TestSuite getAllTests() { |
| 45 | TestSuite suite = new InstrumentationTestSuite(this); |
| 46 | suite.addTestSuite(CameraBinderTest.class); |
Igor Murashkin | 7072550 | 2013-06-25 20:27:06 +0000 | [diff] [blame] | 47 | suite.addTestSuite(CameraDeviceBinderTest.class); |
Igor Murashkin | 4491d68 | 2013-05-31 16:43:48 -0700 | [diff] [blame] | 48 | return suite; |
| 49 | } |
| 50 | |
| 51 | @Override |
| 52 | public ClassLoader getLoader() { |
| 53 | return MediaFrameworkIntegrationTestRunner.class.getClassLoader(); |
| 54 | } |
| 55 | |
| 56 | @Override |
| 57 | public void onCreate(Bundle icicle) { |
| 58 | super.onCreate(icicle); |
Igor Murashkin | 7072550 | 2013-06-25 20:27:06 +0000 | [diff] [blame] | 59 | |
| 60 | String cameraId = (String) icicle.get("camera_id"); |
| 61 | if (cameraId != null) { |
| 62 | try { |
| 63 | Log.v(TAG, |
| 64 | String.format("Reading camera_id from icicle: '%s'", cameraId)); |
| 65 | mCameraId = Integer.parseInt(cameraId); |
| 66 | } |
| 67 | catch (NumberFormatException e) { |
| 68 | Log.e(TAG, String.format("Failed to convert camera_id to integer")); |
| 69 | } |
| 70 | } |
Igor Murashkin | 4491d68 | 2013-05-31 16:43:48 -0700 | [diff] [blame] | 71 | } |
| 72 | } |