OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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.app.Application; | 7 import android.os.Bundle; |
8 import android.content.Context; | |
9 import android.support.test.runner.AndroidJUnitRunner; | 8 import android.support.test.runner.AndroidJUnitRunner; |
10 | 9 |
11 import org.chromium.base.multidex.ChromiumMultiDexInstaller; | 10 import org.chromium.base.multidex.ChromiumMultiDexInstaller; |
12 | 11 |
13 /** | 12 /** |
14 * A custom AndroidJUnitRunner that supports multidex installer. | 13 * A custom AndroidJUnitRunner that supports multidex installer. |
15 * | 14 * |
16 * This class is the equivalent of BaseChromiumInstrumentationTestRunner in JUni
t3. Please | 15 * This class is the equivalent of BaseChromiumInstrumentationTestRunner in JUni
t3. Please |
17 * beware that is this not a class runner. It is declared in test apk AndroidMan
ifest.xml | 16 * beware that is this not a class runner. It is declared in test apk AndroidMan
ifest.xml |
18 * <instrumentation> | 17 * <instrumentation> |
19 */ | 18 */ |
20 public class BaseChromiumAndroidJUnitRunner extends AndroidJUnitRunner { | 19 public class BaseChromiumAndroidJUnitRunner extends AndroidJUnitRunner { |
21 @Override | 20 @Override |
22 public Application newApplication(ClassLoader cl, String className, Context
context) | 21 public void onCreate(Bundle arguments) { |
23 throws ClassNotFoundException, IllegalAccessException, Instantiation
Exception { | 22 ChromiumMultiDexInstaller.install(getTargetContext()); |
24 ChromiumMultiDexInstaller.install(new BaseChromiumRunnerCommon.MultiDexC
ontextWrapper( | 23 super.onCreate(arguments); |
25 getContext(), getTargetContext())); | |
26 BaseChromiumRunnerCommon.reorderDexPathElements(cl, getContext(), getTar
getContext()); | |
27 return super.newApplication(cl, className, context); | |
28 } | 24 } |
29 } | 25 } |
OLD | NEW |