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