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 android.bluetooth;
18
19import junit.framework.TestSuite;
20
21import android.os.Bundle;
22import android.test.InstrumentationTestRunner;
23import android.test.InstrumentationTestSuite;
24
25public class BluetoothTestRunner extends InstrumentationTestRunner {
26    public static int sEnableIterations = 100;
27    public static int sDiscoverableIterations = 1000;
28    public static int sScanIterations = 1000;
29
30    @Override
31    public TestSuite getAllTests() {
32        TestSuite suite = new InstrumentationTestSuite(this);
33        suite.addTestSuite(BluetoothStressTest.class);
34        return suite;
35    }
36
37    @Override
38    public ClassLoader getLoader() {
39        return BluetoothTestRunner.class.getClassLoader();
40    }
41
42    @Override
43    public void onCreate(Bundle arguments) {
44        super.onCreate(arguments);
45
46        String val = arguments.getString("enable_iterations");
47        if (val != null) {
48            try {
49                sEnableIterations = Integer.parseInt(val);
50            } catch (NumberFormatException e) {
51                // Invalid argument, fall back to default value
52            }
53        }
54
55        val = arguments.getString("discoverable_iterations");
56        if (val != null) {
57            try {
58                sDiscoverableIterations = Integer.parseInt(val);
59            } catch (NumberFormatException e) {
60                // Invalid argument, fall back to default value
61            }
62        }
63
64        val = arguments.getString("scan_iterations");
65        if (val != null) {
66            try {
67                sScanIterations = Integer.parseInt(val);
68            } catch (NumberFormatException e) {
69                // Invalid argument, fall back to default value
70            }
71        }
72    }
73}
74