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