1 /* 2 * Copyright (C) 2010, 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.connectivitymanagertest; 18 19 import android.os.Bundle; 20 import android.test.InstrumentationTestRunner; 21 import android.test.InstrumentationTestSuite; 22 23 import com.android.connectivitymanagertest.functional.ConnectivityManagerMobileTest; 24 import com.android.connectivitymanagertest.functional.WifiConnectionTest; 25 26 import junit.framework.TestSuite; 27 28 /** 29 * Instrumentation Test Runner for all connectivity manager tests. 30 * 31 * To run the connectivity manager tests: 32 * 33 * adb shell am instrument -e ssid <ssid> \ 34 * -w com.android.connectivitymanagertest/.ConnectivityManagerTestRunner 35 */ 36 37 public class ConnectivityManagerTestRunner extends InstrumentationTestRunner { 38 public boolean mWifiOnlyFlag = false; 39 public String mTestSsid = null; 40 41 @Override 42 public TestSuite getAllTests() { 43 TestSuite suite = new InstrumentationTestSuite(this); 44 suite.addTestSuite(ConnectivityManagerMobileTest.class); 45 suite.addTestSuite(WifiConnectionTest.class); 46 return suite; 47 } 48 49 @Override 50 public ClassLoader getLoader() { 51 return ConnectivityManagerTestRunner.class.getClassLoader(); 52 } 53 54 @Override 55 public void onCreate(Bundle icicle) { 56 super.onCreate(icicle); 57 String testSSID = (String) icicle.get("ssid"); 58 if (testSSID != null) { 59 mTestSsid = testSSID; 60 } 61 String wifiOnlyFlag = (String) icicle.get("wifi-only"); 62 if (wifiOnlyFlag != null) { 63 mWifiOnlyFlag = true; 64 } 65 } 66 } 67