Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1327)

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java

Issue 2087043003: customtabs: Don't create an extra child process when one is already there. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/init/NativeInitializationController.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
index 0cfb817f5839b603e43fe4d4cf61f36cf6e83774..0e1103531fef057de5a526d2e584c6d0b17415eb 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
@@ -1054,6 +1054,72 @@ public class CustomTabActivityTest extends CustomTabActivityTestBase {
}
/**
+ * Tests that the activity knows there is already a child process when warmup() has been called.
+ */
+ @SmallTest
+ @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE)
+ public void testAllocateChildConnectionWithWarmup() throws Exception {
+ Context context = getInstrumentation().getTargetContext().getApplicationContext();
+ final CustomTabsConnection connection = warmUpAndWait();
+ CustomTabsSessionToken token = CustomTabsSessionToken.createDummySessionTokenForTesting();
+ connection.newSession(token);
+ try {
+ startCustomTabActivityWithIntent(
+ CustomTabsTestUtils.createMinimalCustomTabIntent(context, mTestPage));
+ } catch (InterruptedException e) {
+ fail();
+ }
+ assertFalse(
+ "Warmup() should have allocated a child connection",
+ mActivity.shouldAllocateChildConnection());
+ }
+
+ /**
+ * Tests that the activity knows there is no child process.
+ */
+ @SmallTest
+ @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE)
+ public void testAllocateChildConnectionNoWarmup() throws Exception {
+ Context context = getInstrumentation().getTargetContext().getApplicationContext();
+ final CustomTabsConnection connection =
+ CustomTabsConnection.getInstance((Application) context);
+ CustomTabsSessionToken token = CustomTabsSessionToken.createDummySessionTokenForTesting();
+ connection.newSession(token);
+
+ try {
+ startCustomTabActivityWithIntent(
+ CustomTabsTestUtils.createMinimalCustomTabIntent(context, mTestPage2));
+ } catch (InterruptedException e) {
+ fail();
+ }
+ assertTrue(
+ "No spare renderer available, should allocate a child connection.",
+ mActivity.shouldAllocateChildConnection());
+ }
+
+ /**
+ * Tests that the activity knows there is already a child process when prerendering.
+ */
+ @SmallTest
+ @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE)
+ public void testAllocateChildConnectionWithPrerender() throws Exception {
+ Context context = getInstrumentation().getTargetContext().getApplicationContext();
+ final CustomTabsConnection connection = warmUpAndWait();
+ CustomTabsSessionToken token = CustomTabsSessionToken.createDummySessionTokenForTesting();
+ connection.newSession(token);
+ assertTrue(connection.mayLaunchUrl(token, Uri.parse(mTestPage), null, null));
+ try {
+ startCustomTabActivityWithIntent(
+ CustomTabsTestUtils.createMinimalCustomTabIntent(context, mTestPage));
+ } catch (InterruptedException e) {
+ fail();
+ }
+ assertFalse(
+ "Prerendering should have allocated a child connection",
+ mActivity.shouldAllocateChildConnection());
+ }
+
+ /**
* Tests that prerendering accepts a referrer, and that this is not lost when launching the
* Custom Tab.
*/
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/init/NativeInitializationController.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698