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