OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.base.test; | 5 package org.chromium.base.test; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.net.ConnectivityManager; | 8 import android.net.ConnectivityManager; |
9 import android.net.NetworkInfo; | 9 import android.net.NetworkInfo; |
10 import android.os.Build; | 10 import android.os.Build; |
11 import android.os.Bundle; | 11 import android.os.Bundle; |
12 import android.test.AndroidTestRunner; | 12 import android.test.AndroidTestRunner; |
13 import android.test.InstrumentationTestRunner; | 13 import android.test.InstrumentationTestRunner; |
14 import android.text.TextUtils; | 14 import android.text.TextUtils; |
15 | 15 |
16 import junit.framework.TestCase; | 16 import junit.framework.TestCase; |
17 import junit.framework.TestResult; | 17 import junit.framework.TestResult; |
18 | 18 |
19 import org.chromium.base.Log; | 19 import org.chromium.base.Log; |
20 import org.chromium.base.SysUtils; | 20 import org.chromium.base.SysUtils; |
21 import org.chromium.base.multidex.ChromiumMultiDex; | 21 import org.chromium.base.multidex.ChromiumMultiDexInstaller; |
22 import org.chromium.base.test.util.CommandLineFlags; | 22 import org.chromium.base.test.util.CommandLineFlags; |
23 import org.chromium.base.test.util.DisableIfSkipCheck; | 23 import org.chromium.base.test.util.DisableIfSkipCheck; |
24 import org.chromium.base.test.util.MinAndroidSdkLevel; | 24 import org.chromium.base.test.util.MinAndroidSdkLevel; |
25 import org.chromium.base.test.util.Restriction; | 25 import org.chromium.base.test.util.Restriction; |
26 import org.chromium.base.test.util.SkipCheck; | 26 import org.chromium.base.test.util.SkipCheck; |
27 import org.chromium.test.reporter.TestStatusListener; | 27 import org.chromium.test.reporter.TestStatusListener; |
28 | 28 |
29 import java.lang.reflect.Method; | 29 import java.lang.reflect.Method; |
30 | 30 |
31 // TODO(jbudorick): Add support for on-device handling of timeouts. | 31 // TODO(jbudorick): Add support for on-device handling of timeouts. |
32 /** | 32 /** |
33 * An Instrumentation test runner that checks SDK level for tests with specific
requirements. | 33 * An Instrumentation test runner that checks SDK level for tests with specific
requirements. |
34 */ | 34 */ |
35 public class BaseInstrumentationTestRunner extends InstrumentationTestRunner { | 35 public class BaseInstrumentationTestRunner extends InstrumentationTestRunner { |
36 private static final String TAG = "base_test"; | 36 private static final String TAG = "base_test"; |
37 | 37 |
38 @Override | 38 @Override |
39 public void onCreate(Bundle arguments) { | 39 public void onCreate(Bundle arguments) { |
40 ChromiumMultiDex.install(getTargetContext()); | 40 ChromiumMultiDexInstaller.install(getTargetContext()); |
41 super.onCreate(arguments); | 41 super.onCreate(arguments); |
42 } | 42 } |
43 | 43 |
44 @Override | 44 @Override |
45 protected AndroidTestRunner getAndroidTestRunner() { | 45 protected AndroidTestRunner getAndroidTestRunner() { |
46 AndroidTestRunner runner = new AndroidTestRunner() { | 46 AndroidTestRunner runner = new AndroidTestRunner() { |
47 @Override | 47 @Override |
48 protected TestResult createTestResult() { | 48 protected TestResult createTestResult() { |
49 BaseTestResult r = new BaseTestResult(BaseInstrumentationTestRun
ner.this); | 49 BaseTestResult r = new BaseTestResult(BaseInstrumentationTestRun
ner.this); |
50 addTestHooks(r); | 50 addTestHooks(r); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 Log.i(TAG, "Test " + testClass.getName() + "#" + testCase.ge
tName() | 136 Log.i(TAG, "Test " + testClass.getName() + "#" + testCase.ge
tName() |
137 + " is not enabled at SDK level " + Build.VERSION.SD
K_INT | 137 + " is not enabled at SDK level " + Build.VERSION.SD
K_INT |
138 + "."); | 138 + "."); |
139 return true; | 139 return true; |
140 } | 140 } |
141 } | 141 } |
142 return false; | 142 return false; |
143 } | 143 } |
144 } | 144 } |
145 } | 145 } |
OLD | NEW |