Index: chrome/android/javatests/src/org/chromium/chrome/browser/BindingManagerIntegrationTest.java |
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/BindingManagerIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/BindingManagerIntegrationTest.java |
index 241589f8f638d46f8062d1fcaf42bbb13ad8e777..44cc7ab8ab11304cef7270f045e9a74ef6ef662b 100644 |
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/BindingManagerIntegrationTest.java |
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/BindingManagerIntegrationTest.java |
@@ -5,12 +5,21 @@ |
package org.chromium.chrome.browser; |
import android.content.Context; |
+import android.support.test.InstrumentationRegistry; |
import android.support.test.filters.LargeTest; |
import android.test.MoreAsserts; |
import android.util.SparseArray; |
import android.util.SparseBooleanArray; |
+import org.junit.After; |
+import org.junit.Assert; |
+import org.junit.Before; |
+import org.junit.Rule; |
+import org.junit.Test; |
+import org.junit.runner.RunWith; |
+ |
import org.chromium.base.ThreadUtils; |
+import org.chromium.base.test.util.CommandLineFlags; |
import org.chromium.base.test.util.DisabledTest; |
import org.chromium.base.test.util.Feature; |
import org.chromium.base.test.util.Restriction; |
@@ -21,7 +30,8 @@ import org.chromium.chrome.browser.tabmodel.TabCreatorManager.TabCreator; |
import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType; |
import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; |
import org.chromium.chrome.browser.tabmodel.TabModelUtils; |
-import org.chromium.chrome.test.ChromeActivityTestCaseBase; |
+import org.chromium.chrome.test.ChromeActivityTestRule; |
+import org.chromium.chrome.test.ChromeJUnit4ClassRunner; |
import org.chromium.chrome.test.util.ChromeRestriction; |
import org.chromium.chrome.test.util.ChromeTabUtils; |
import org.chromium.chrome.test.util.PrerenderTestHelper; |
@@ -31,6 +41,7 @@ import org.chromium.content.browser.ManagedChildProcessConnection; |
import org.chromium.content.browser.test.ChildProcessAllocatorSettings; |
import org.chromium.content.browser.test.util.Criteria; |
import org.chromium.content.browser.test.util.CriteriaHelper; |
+import org.chromium.content.browser.test.util.TouchCommon; |
import org.chromium.content_public.browser.LoadUrlParams; |
import org.chromium.net.test.EmbeddedTestServer; |
import org.chromium.ui.base.DeviceFormFactor; |
@@ -42,8 +53,14 @@ import java.util.concurrent.Callable; |
* Integration tests for the BindingManager API. This test plants a mock BindingManager |
* implementation and verifies that the signals it relies on are correctly delivered. |
*/ |
+@RunWith(ChromeJUnit4ClassRunner.class) |
@RetryOnFailure |
-public class BindingManagerIntegrationTest extends ChromeActivityTestCaseBase<ChromeActivity> { |
+@CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE, |
+ ChromeActivityTestRule.DISABLE_NETWORK_PREDICTION_FLAG}) |
+public class BindingManagerIntegrationTest { |
+ @Rule |
+ public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = |
+ new ChromeActivityTestRule<>(ChromeActivity.class); |
private static class MockBindingManager implements BindingManager { |
// Maps pid to the last received visibility state of the renderer. |
@@ -155,24 +172,21 @@ public class BindingManagerIntegrationTest extends ChromeActivityTestCaseBase<Ch |
private static final String SHARED_RENDERER_PAGE2_PATH = |
"/chrome/test/data/android/bindingmanager/shared_renderer2.html"; |
- public BindingManagerIntegrationTest() { |
- super(ChromeActivity.class); |
- } |
- |
/** |
* Verifies that the .setProcessInForeground() signal is called correctly as the tabs are |
* created and switched. |
*/ |
+ @Test |
@LargeTest |
@Feature({"ProcessManagement"}) |
public void testTabSwitching() throws InterruptedException { |
// Create two tabs and wait until they are loaded, so that their renderers are around. |
final Tab[] tabs = new Tab[2]; |
- getInstrumentation().runOnMainSync(new Runnable() { |
+ InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { |
@Override |
public void run() { |
// Foreground tab. |
- TabCreator tabCreator = getActivity().getCurrentTabCreator(); |
+ TabCreator tabCreator = mActivityTestRule.getActivity().getCurrentTabCreator(); |
tabs[0] = tabCreator.createNewTab( |
new LoadUrlParams(mTestServer.getURL(FILE_PATH)), |
TabLaunchType.FROM_CHROME_UI, null); |
@@ -190,8 +204,8 @@ public class BindingManagerIntegrationTest extends ChromeActivityTestCaseBase<Ch |
ChromeTabUtils.waitForTabPageLoaded(tabs[1], mTestServer.getURL(FILE_PATH)); |
// Wait for the new tab animations on phones to finish. |
- if (!DeviceFormFactor.isTablet(getActivity())) { |
- final ChromeActivity activity = getActivity(); |
+ if (!DeviceFormFactor.isTablet(mActivityTestRule.getActivity())) { |
+ final ChromeActivity activity = mActivityTestRule.getActivity(); |
CriteriaHelper.pollUiThread(new Criteria("Did not finish animation") { |
@Override |
public boolean isSatisfied() { |
@@ -201,14 +215,14 @@ public class BindingManagerIntegrationTest extends ChromeActivityTestCaseBase<Ch |
} |
}); |
} |
- getInstrumentation().waitForIdleSync(); |
+ InstrumentationRegistry.getInstrumentation().waitForIdleSync(); |
- getInstrumentation().runOnMainSync(new Runnable() { |
+ InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { |
@Override |
public void run() { |
// Make sure that the renderers were spawned. |
- assertTrue(tabs[0].getContentViewCore().getCurrentRenderProcessId() > 0); |
- assertTrue(tabs[1].getContentViewCore().getCurrentRenderProcessId() > 0); |
+ Assert.assertTrue(tabs[0].getContentViewCore().getCurrentRenderProcessId() > 0); |
+ Assert.assertTrue(tabs[1].getContentViewCore().getCurrentRenderProcessId() > 0); |
// Verify that the renderer of the foreground tab was signalled as visible. |
mBindingManager.assertIsInForeground( |
@@ -219,7 +233,8 @@ public class BindingManagerIntegrationTest extends ChromeActivityTestCaseBase<Ch |
tabs[1].getContentViewCore().getCurrentRenderProcessId()); |
// Select tabs[1] and verify that the renderer visibility was flipped. |
- TabModelUtils.setIndex(getActivity().getCurrentTabModel(), indexOf(tabs[1])); |
+ TabModelUtils.setIndex( |
+ mActivityTestRule.getActivity().getCurrentTabModel(), indexOf(tabs[1])); |
mBindingManager.assertIsInBackground( |
tabs[0].getContentViewCore().getCurrentRenderProcessId()); |
mBindingManager.assertIsInForeground( |
@@ -233,17 +248,18 @@ public class BindingManagerIntegrationTest extends ChromeActivityTestCaseBase<Ch |
* crashed in background is restored in foreground. This is a regression test for |
* http://crbug.com/399521. |
*/ |
+ @Test |
@DisabledTest(message = "crbug.com/543153") |
@LargeTest |
@Feature({"ProcessManagement"}) |
public void testCrashInBackground() throws InterruptedException { |
// Create two tabs and wait until they are loaded, so that their renderers are around. |
final Tab[] tabs = new Tab[2]; |
- getInstrumentation().runOnMainSync(new Runnable() { |
+ InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { |
@Override |
public void run() { |
// Foreground tab. |
- TabCreator tabCreator = getActivity().getCurrentTabCreator(); |
+ TabCreator tabCreator = mActivityTestRule.getActivity().getCurrentTabCreator(); |
tabs[0] = tabCreator.createNewTab( |
new LoadUrlParams(mTestServer.getURL(FILE_PATH)), |
TabLaunchType.FROM_CHROME_UI, null); |
@@ -261,8 +277,8 @@ public class BindingManagerIntegrationTest extends ChromeActivityTestCaseBase<Ch |
ChromeTabUtils.waitForTabPageLoaded(tabs[1], mTestServer.getURL(FILE_PATH)); |
// Wait for the new tab animations on phones to finish. |
- if (!DeviceFormFactor.isTablet(getActivity())) { |
- final ChromeActivity activity = getActivity(); |
+ if (!DeviceFormFactor.isTablet(mActivityTestRule.getActivity())) { |
+ final ChromeActivity activity = mActivityTestRule.getActivity(); |
CriteriaHelper.pollUiThread(new Criteria("Did not finish animation") { |
@Override |
public boolean isSatisfied() { |
@@ -272,14 +288,14 @@ public class BindingManagerIntegrationTest extends ChromeActivityTestCaseBase<Ch |
} |
}); |
} |
- getInstrumentation().waitForIdleSync(); |
+ InstrumentationRegistry.getInstrumentation().waitForIdleSync(); |
- getInstrumentation().runOnMainSync(new Runnable() { |
+ InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { |
@Override |
public void run() { |
// Make sure that the renderers were spawned. |
- assertTrue(tabs[0].getContentViewCore().getCurrentRenderProcessId() > 0); |
- assertTrue(tabs[1].getContentViewCore().getCurrentRenderProcessId() > 0); |
+ Assert.assertTrue(tabs[0].getContentViewCore().getCurrentRenderProcessId() > 0); |
+ Assert.assertTrue(tabs[1].getContentViewCore().getCurrentRenderProcessId() > 0); |
// Verify that the renderer of the foreground tab was signalled as visible. |
mBindingManager.assertIsInForeground( |
@@ -292,7 +308,7 @@ public class BindingManagerIntegrationTest extends ChromeActivityTestCaseBase<Ch |
}); |
// Kill the renderer and wait for the crash to be noted by the browser process. |
- assertTrue(ChildProcessLauncher.crashProcessForTesting( |
+ Assert.assertTrue(ChildProcessLauncher.crashProcessForTesting( |
tabs[1].getContentViewCore().getCurrentRenderProcessId())); |
CriteriaHelper.pollInstrumentationThread( |
@@ -304,10 +320,11 @@ public class BindingManagerIntegrationTest extends ChromeActivityTestCaseBase<Ch |
}); |
// Switch to the tab that crashed in background. |
- getInstrumentation().runOnMainSync(new Runnable() { |
+ InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { |
@Override |
public void run() { |
- TabModelUtils.setIndex(getActivity().getCurrentTabModel(), indexOf(tabs[1])); |
+ TabModelUtils.setIndex( |
+ mActivityTestRule.getActivity().getCurrentTabModel(), indexOf(tabs[1])); |
} |
}); |
@@ -324,7 +341,7 @@ public class BindingManagerIntegrationTest extends ChromeActivityTestCaseBase<Ch |
"isInForeground() was not called for the process.", |
tabs[1].getContentViewCore().getCurrentRenderProcessId()); |
- getInstrumentation().runOnMainSync(new Runnable() { |
+ InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { |
@Override |
public void run() { |
// Verify the visibility of the renderers. |
@@ -340,6 +357,7 @@ public class BindingManagerIntegrationTest extends ChromeActivityTestCaseBase<Ch |
* Verifies that a renderer that crashes in foreground has the correct visibility when |
* recreated. |
*/ |
+ @Test |
@LargeTest |
@Feature({"ProcessManagement"}) |
public void testCrashInForeground() throws InterruptedException { |
@@ -349,16 +367,17 @@ public class BindingManagerIntegrationTest extends ChromeActivityTestCaseBase<Ch |
new Callable<Tab>() { |
@Override |
public Tab call() throws Exception { |
- TabCreator tabCreator = getActivity().getCurrentTabCreator(); |
+ TabCreator tabCreator = |
+ mActivityTestRule.getActivity().getCurrentTabCreator(); |
return tabCreator.createNewTab( |
new LoadUrlParams(testUrl), TabLaunchType.FROM_CHROME_UI, null); |
} |
}); |
ChromeTabUtils.waitForTabPageLoaded(tab, testUrl); |
- getInstrumentation().waitForIdleSync(); |
+ InstrumentationRegistry.getInstrumentation().waitForIdleSync(); |
// Kill the renderer and wait for the crash to be noted by the browser process. |
- assertTrue(ChildProcessLauncher.crashProcessForTesting( |
+ Assert.assertTrue(ChildProcessLauncher.crashProcessForTesting( |
tab.getContentViewCore().getCurrentRenderProcessId())); |
CriteriaHelper.pollInstrumentationThread( |
@@ -370,7 +389,7 @@ public class BindingManagerIntegrationTest extends ChromeActivityTestCaseBase<Ch |
}); |
// Reload the tab, respawning the renderer. |
- getInstrumentation().runOnMainSync(new Runnable() { |
+ InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { |
@Override |
public void run() { |
tab.reload(); |
@@ -392,7 +411,7 @@ public class BindingManagerIntegrationTest extends ChromeActivityTestCaseBase<Ch |
"isInForeground() was not called for the process.", |
tab.getContentViewCore().getCurrentRenderProcessId()); |
- getInstrumentation().runOnMainSync(new Runnable() { |
+ InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { |
@Override |
public void run() { |
// Verify the visibility of the renderer. |
@@ -416,6 +435,7 @@ public class BindingManagerIntegrationTest extends ChromeActivityTestCaseBase<Ch |
* setInForeground(), but it can't be guaranteed because they are triggered from different |
* threads. |
*/ |
+ @Test |
@LargeTest |
@Feature({"ProcessManagement"}) |
public void testVisibilityDetermined() throws InterruptedException { |
@@ -424,7 +444,8 @@ public class BindingManagerIntegrationTest extends ChromeActivityTestCaseBase<Ch |
new Callable<Tab>() { |
@Override |
public Tab call() { |
- TabCreator tabCreator = getActivity().getCurrentTabCreator(); |
+ TabCreator tabCreator = |
+ mActivityTestRule.getActivity().getCurrentTabCreator(); |
return tabCreator.createNewTab( |
new LoadUrlParams(mTestServer.getURL(FILE_PATH)), |
TabLaunchType.FROM_CHROME_UI, null); |
@@ -434,10 +455,11 @@ public class BindingManagerIntegrationTest extends ChromeActivityTestCaseBase<Ch |
// Ensure the following calls happened: |
// - FG - setInForeground(true) - when the tab is created in the foreground |
// - DETERMINED - visibilityDetermined() - after the initial navigation is committed |
- assertEquals("FG;DETERMINED;", mBindingManager.getVisibilityCalls(initialNavigationPid)); |
+ Assert.assertEquals( |
+ "FG;DETERMINED;", mBindingManager.getVisibilityCalls(initialNavigationPid)); |
// Navigate to about:version which requires a different renderer. |
- loadUrlInTab(ABOUT_VERSION_PATH, PageTransition.LINK, fgTab); |
+ mActivityTestRule.loadUrlInTab(ABOUT_VERSION_PATH, PageTransition.LINK, fgTab); |
int secondNavigationPid = getRenderProcessId(fgTab); |
MoreAsserts.assertNotEqual(secondNavigationPid, initialNavigationPid); |
// Ensure the following calls happened: |
@@ -448,15 +470,17 @@ public class BindingManagerIntegrationTest extends ChromeActivityTestCaseBase<Ch |
// visibilityDetermined() are triggered from different threads. |
mBindingManager.assertIsInForeground(secondNavigationPid); |
String visibilityCalls = mBindingManager.getVisibilityCalls(secondNavigationPid); |
- assertTrue(visibilityCalls, "BG;FG;DETERMINED;".equals(visibilityCalls) |
- || "BG;DETERMINED;FG;".equals(visibilityCalls)); |
+ Assert.assertTrue(visibilityCalls, |
+ "BG;FG;DETERMINED;".equals(visibilityCalls) |
+ || "BG;DETERMINED;FG;".equals(visibilityCalls)); |
// Open a tab in the background and load it. |
final Tab bgTab = ThreadUtils.runOnUiThreadBlockingNoException( |
new Callable<Tab>() { |
@Override |
public Tab call() { |
- TabCreator tabCreator = getActivity().getCurrentTabCreator(); |
+ TabCreator tabCreator = |
+ mActivityTestRule.getActivity().getCurrentTabCreator(); |
Tab tab = tabCreator.createNewTab( |
new LoadUrlParams(mTestServer.getURL(FILE_PATH)), |
TabLaunchType.FROM_LONGPRESS_BACKGROUND, null); |
@@ -471,7 +495,7 @@ public class BindingManagerIntegrationTest extends ChromeActivityTestCaseBase<Ch |
// Ensure the following calls happened: |
// - BG - setInForeground(false) - when tab is created in the background |
// - DETERMINED - visibilityDetermined() - after the navigation is committed |
- assertEquals("BG;DETERMINED;", mBindingManager.getVisibilityCalls(bgNavigationPid)); |
+ Assert.assertEquals("BG;DETERMINED;", mBindingManager.getVisibilityCalls(bgNavigationPid)); |
} |
/** |
@@ -479,36 +503,39 @@ public class BindingManagerIntegrationTest extends ChromeActivityTestCaseBase<Ch |
* process and discards its old render process. Test that visibilityDetermined() is called for |
* the swapped in render process. |
*/ |
+ @Test |
@LargeTest |
@Restriction({Restriction.RESTRICTION_TYPE_NON_LOW_END_DEVICE}) |
@Feature({"ProcessManagement"}) |
public void testVisibilityDeterminedNavigateToPrerenderedPage() throws InterruptedException { |
- loadUrl(mTestServer.getURL(FILE_PATH)); |
- Tab tab = getActivity().getActivityTab(); |
+ mActivityTestRule.loadUrl(mTestServer.getURL(FILE_PATH)); |
+ Tab tab = mActivityTestRule.getActivity().getActivityTab(); |
int pid1 = getRenderProcessId(tab); |
String prerenderUrl = mTestServer.getURL(FILE_PATH2); |
PrerenderTestHelper.prerenderUrl(prerenderUrl, tab); |
- assertEquals(TabLoadStatus.FULL_PRERENDERED_PAGE_LOAD, loadUrl(prerenderUrl)); |
+ Assert.assertEquals( |
+ TabLoadStatus.FULL_PRERENDERED_PAGE_LOAD, mActivityTestRule.loadUrl(prerenderUrl)); |
int pid2 = getRenderProcessId(tab); |
MoreAsserts.assertNotEqual(pid1, pid2); |
- assertTrue(mBindingManager.getVisibilityCalls(pid1).contains("DETERMINED;")); |
- assertTrue(mBindingManager.getVisibilityCalls(pid2).contains("DETERMINED;")); |
+ Assert.assertTrue(mBindingManager.getVisibilityCalls(pid1).contains("DETERMINED;")); |
+ Assert.assertTrue(mBindingManager.getVisibilityCalls(pid2).contains("DETERMINED;")); |
} |
/** |
* Verifies that BindingManager.releaseAllModerateBindings() is called once all the sandboxed |
* services are allocated. |
*/ |
+ @Test |
@ChildProcessAllocatorSettings(sandboxedServiceCount = 4) |
@LargeTest |
@Feature({"ProcessManagement"}) |
public void testReleaseAllModerateBindings() throws InterruptedException { |
- final TabCreator tabCreator = getActivity().getCurrentTabCreator(); |
+ final TabCreator tabCreator = mActivityTestRule.getActivity().getCurrentTabCreator(); |
final Tab[] tabs = new Tab[3]; |
- getInstrumentation().runOnMainSync(new Runnable() { |
+ InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { |
@Override |
public void run() { |
// Foreground tab. |
@@ -522,9 +549,9 @@ public class BindingManagerIntegrationTest extends ChromeActivityTestCaseBase<Ch |
ChromeTabUtils.waitForTabPageLoaded(tabs[0], "about:blank"); |
ChromeTabUtils.waitForTabPageLoaded(tabs[1], "about:blank"); |
// At this point 3 sanboxed services are allocated; the initial one + 2 new tabs. |
- assertFalse(mBindingManager.isReleaseAllModerateBindingsCalled()); |
+ Assert.assertFalse(mBindingManager.isReleaseAllModerateBindingsCalled()); |
- getInstrumentation().runOnMainSync(new Runnable() { |
+ InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { |
@Override |
public void run() { |
// Foreground tab. |
@@ -538,33 +565,34 @@ public class BindingManagerIntegrationTest extends ChromeActivityTestCaseBase<Ch |
} |
// Test crashes on tablets. See crbug.com/594407 |
+ @Test |
@LargeTest |
@Feature({"ProcessManagement"}) |
@Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE) |
public void testRestoreSharedRenderer() throws Exception { |
- loadUrl(mTestServer.getURL(SHARED_RENDERER_PAGE_PATH)); |
+ mActivityTestRule.loadUrl(mTestServer.getURL(SHARED_RENDERER_PAGE_PATH)); |
final Tab[] tabs = new Tab[2]; |
- tabs[0] = getActivity().getActivityTab(); |
- singleClickView(tabs[0].getView()); |
+ tabs[0] = mActivityTestRule.getActivity().getActivityTab(); |
+ TouchCommon.singleClickView(tabs[0].getView()); |
CriteriaHelper.pollInstrumentationThread(new Criteria("Child tab isn't opened.") { |
@Override |
public boolean isSatisfied() { |
- return getActivity().getCurrentTabModel().getCount() == 2 |
- && tabs[0] != getActivity().getActivityTab() |
- && getActivity() |
+ return mActivityTestRule.getActivity().getCurrentTabModel().getCount() == 2 |
+ && tabs[0] != mActivityTestRule.getActivity().getActivityTab() |
+ && mActivityTestRule.getActivity() |
.getActivityTab() |
.getContentViewCore() |
.getCurrentRenderProcessId() |
!= 0; |
} |
}); |
- tabs[1] = getActivity().getActivityTab(); |
- assertEquals(tabs[0].getContentViewCore().getCurrentRenderProcessId(), |
+ tabs[1] = mActivityTestRule.getActivity().getActivityTab(); |
+ Assert.assertEquals(tabs[0].getContentViewCore().getCurrentRenderProcessId(), |
tabs[1].getContentViewCore().getCurrentRenderProcessId()); |
- getInstrumentation().runOnMainSync(new Runnable() { |
+ InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { |
@Override |
public void run() { |
// Verify the visibility of the renderer. |
@@ -573,7 +601,7 @@ public class BindingManagerIntegrationTest extends ChromeActivityTestCaseBase<Ch |
} |
}); |
- assertTrue(ChildProcessLauncher.crashProcessForTesting( |
+ Assert.assertTrue(ChildProcessLauncher.crashProcessForTesting( |
tabs[1].getContentViewCore().getCurrentRenderProcessId())); |
CriteriaHelper.pollInstrumentationThread( |
@@ -584,7 +612,7 @@ public class BindingManagerIntegrationTest extends ChromeActivityTestCaseBase<Ch |
} |
}); |
// Reload the tab, respawning the renderer. |
- getInstrumentation().runOnMainSync(new Runnable() { |
+ InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { |
@Override |
public void run() { |
tabs[1].reload(); |
@@ -607,7 +635,7 @@ public class BindingManagerIntegrationTest extends ChromeActivityTestCaseBase<Ch |
"setInForeground() was not called for the process.", |
tabs[1].getContentViewCore().getCurrentRenderProcessId()); |
- getInstrumentation().runOnMainSync(new Runnable() { |
+ InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { |
@Override |
public void run() { |
// Verify the visibility of the renderer. |
@@ -620,32 +648,27 @@ public class BindingManagerIntegrationTest extends ChromeActivityTestCaseBase<Ch |
}); |
} |
- @Override |
- public void startMainActivity() throws InterruptedException { |
- startMainActivityOnBlankPage(); |
- } |
- |
- @Override |
- protected void setUp() throws Exception { |
+ @Before |
+ public void setUp() throws Exception { |
// Hook in the test binding manager. |
mBindingManager = new MockBindingManager(); |
ChildProcessLauncher.setBindingManagerForTesting(mBindingManager); |
- super.setUp(); |
+ mActivityTestRule.startMainActivityOnBlankPage(); |
- mTestServer = EmbeddedTestServer.createAndStartServer(getInstrumentation().getContext()); |
+ mTestServer = EmbeddedTestServer.createAndStartServer( |
+ InstrumentationRegistry.getInstrumentation().getContext()); |
} |
- @Override |
- protected void tearDown() throws Exception { |
+ @After |
+ public void tearDown() throws Exception { |
mTestServer.stopAndDestroyServer(); |
- super.tearDown(); |
} |
/** |
* @return the index of the given tab in the current tab model |
*/ |
private int indexOf(Tab tab) { |
- return getActivity().getCurrentTabModel().indexOf(tab); |
+ return mActivityTestRule.getActivity().getCurrentTabModel().indexOf(tab); |
} |
} |