OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 | 9 |
| 10 import org.chromium.base.annotations.MainDex; |
9 import org.chromium.base.multidex.ChromiumMultiDexInstaller; | 11 import org.chromium.base.multidex.ChromiumMultiDexInstaller; |
10 import org.chromium.base.test.util.CommandLineFlags; | 12 import org.chromium.base.test.util.CommandLineFlags; |
11 | 13 |
12 // TODO(jbudorick): Add support for on-device handling of timeouts. | 14 // TODO(jbudorick): Add support for on-device handling of timeouts. |
13 /** | 15 /** |
14 * An Instrumentation test runner for applications that are based on | 16 * An Instrumentation test runner for applications that are based on |
15 * {@code org.chromium.base.BaseChromiumApplication} | 17 * {@code org.chromium.base.BaseChromiumApplication} |
16 */ | 18 */ |
| 19 @MainDex |
17 public class BaseChromiumInstrumentationTestRunner extends BaseInstrumentationTe
stRunner { | 20 public class BaseChromiumInstrumentationTestRunner extends BaseInstrumentationTe
stRunner { |
18 @Override | 21 @Override |
19 public void onCreate(Bundle arguments) { | 22 public Application newApplication(ClassLoader cl, String className, Context
context) |
20 ChromiumMultiDexInstaller.install(getTargetContext()); | 23 throws ClassNotFoundException, IllegalAccessException, Instantiation
Exception { |
21 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); |
22 } | 28 } |
23 | 29 |
24 /** | 30 /** |
25 * Override this method to register hooks and checks to be run for each test
. Make sure to call | 31 * Override this method to register hooks and checks to be run for each test
. Make sure to call |
26 * the base implementation if you do so. | 32 * the base implementation if you do so. |
27 * | 33 * |
28 * @see BaseTestResult#addSkipCheck(BaseTestResult.SkipCheck) | 34 * @see BaseTestResult#addSkipCheck(BaseTestResult.SkipCheck) |
29 * @see BaseTestResult#addPreTestHook(BaseTestResult.PreTestHook) | 35 * @see BaseTestResult#addPreTestHook(BaseTestResult.PreTestHook) |
30 */ | 36 */ |
31 @Override | 37 @Override |
32 protected void addTestHooks(BaseTestResult result) { | 38 protected void addTestHooks(BaseTestResult result) { |
33 super.addTestHooks(result); | 39 super.addTestHooks(result); |
34 result.addPreTestHook(CommandLineFlags.getRegistrationHook()); | 40 result.addPreTestHook(CommandLineFlags.getRegistrationHook()); |
35 } | 41 } |
36 } | 42 } |
OLD | NEW |