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 17package com.android.frameworks.downloadmanagertests; 18 19import android.content.Context; 20import android.net.wifi.WifiManager; 21import android.os.Bundle; 22import android.test.InstrumentationTestRunner; 23import android.test.InstrumentationTestSuite; 24 25import junit.framework.TestSuite; 26 27/** 28 * Instrumentation Test Runner for all download manager tests. 29 * 30 * To run the download manager tests: 31 * 32 * adb shell am instrument -e external_download_uri <uri> external_large_download_uri <uri> \ 33 * -w com.android.frameworks.downloadmanagertests/.DownloadManagerTestRunner 34 */ 35 36public class DownloadManagerTestRunner extends InstrumentationTestRunner { 37 private static final String EXTERNAL_DOWNLOAD_URI_KEY = "external_download_uri"; 38 public String externalDownloadUriValue = null; 39 40 @Override 41 public TestSuite getAllTests() { 42 TestSuite suite = new InstrumentationTestSuite(this); 43 suite.addTestSuite(DownloadManagerTestApp.class); 44 return suite; 45 } 46 47 @Override 48 public ClassLoader getLoader() { 49 return DownloadManagerTestRunner.class.getClassLoader(); 50 } 51 52 @Override 53 public void onCreate(Bundle icicle) { 54 // Extract the extra params passed in from the bundle... 55 String externalDownloadUri = (String) icicle.get(EXTERNAL_DOWNLOAD_URI_KEY); 56 if (externalDownloadUri != null) { 57 externalDownloadUriValue = externalDownloadUri; 58 } 59 // enable verbose wifi logging 60 ((WifiManager)getContext().getSystemService(Context.WIFI_SERVICE)) 61 .enableVerboseLogging(1); 62 super.onCreate(icicle); 63 } 64 65} 66