Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 package org.chromium.chrome.test; | |
| 6 | |
| 7 import android.app.Instrumentation; | |
| 8 import android.content.Context; | |
| 9 import android.support.test.InstrumentationRegistry; | |
| 10 | |
| 11 import org.junit.rules.TestRule; | |
| 12 import org.junit.runner.Description; | |
| 13 import org.junit.runners.model.Statement; | |
| 14 | |
| 15 import org.chromium.chrome.browser.ChromeActivity; | |
| 16 import org.chromium.chrome.test.MultiActivityTestCommon.MultiActivityTestCommonC allback; | |
| 17 import org.chromium.chrome.test.util.browser.tabmodel.document.MockStorageDelega te; | |
| 18 | |
| 19 /** Custom TestRule for MultiActivity Tests*/ | |
|
gone
2017/04/30 02:00:14
Tests. */
the real yoland
2017/05/01 23:35:36
Done
| |
| 20 public class MultiActivityTestRule implements TestRule, MultiActivityTestCommonC allback { | |
| 21 private final MultiActivityTestCommon mTestCommon; | |
| 22 | |
| 23 public MultiActivityTestRule() { | |
| 24 mTestCommon = new MultiActivityTestCommon(this); | |
| 25 } | |
| 26 | |
| 27 public MockStorageDelegate getStorageDelegate() { | |
| 28 return mTestCommon.mStorageDelegate; | |
| 29 } | |
| 30 | |
| 31 public Context getContext() { | |
| 32 return mTestCommon.mContext; | |
| 33 } | |
| 34 | |
| 35 public void waitForFullLoad(final ChromeActivity activity, final String expe ctedTitle) { | |
| 36 mTestCommon.waitForFullLoad(activity, expectedTitle); | |
| 37 } | |
| 38 | |
| 39 public void waitForFullLoad( | |
| 40 final ChromeActivity activity, final String expectedTitle, boolean w aitLongerForLoad) { | |
| 41 mTestCommon.waitForFullLoad(activity, expectedTitle, waitLongerForLoad); | |
| 42 } | |
| 43 | |
| 44 @Override | |
| 45 public Statement apply(final Statement base, Description desc) { | |
| 46 return new Statement() { | |
| 47 @Override | |
| 48 public void evaluate() throws Throwable { | |
| 49 mTestCommon.setUp(); | |
| 50 base.evaluate(); | |
| 51 mTestCommon.tearDown(); | |
| 52 } | |
| 53 }; | |
| 54 } | |
| 55 | |
| 56 @Override | |
| 57 public Instrumentation getInstrumentation() { | |
| 58 return InstrumentationRegistry.getInstrumentation(); | |
| 59 } | |
| 60 } | |
| OLD | NEW |