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

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

Issue 2254863002: Revert of Android: Make the spare renderer accessible to all Chrome tabs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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.chrome.browser.customtabs; 5 package org.chromium.chrome.browser.customtabs;
6 6
7 import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_E ND_DEVICE; 7 import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_E ND_DEVICE;
8 8
9 import android.app.Activity; 9 import android.app.Activity;
10 import android.app.Application; 10 import android.app.Application;
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 Context context = getInstrumentation().getTargetContext().getApplication Context(); 1085 Context context = getInstrumentation().getTargetContext().getApplication Context();
1086 final CustomTabsConnection connection = warmUpAndWait(); 1086 final CustomTabsConnection connection = warmUpAndWait();
1087 CustomTabsSessionToken token = CustomTabsSessionToken.createDummySession TokenForTesting(); 1087 CustomTabsSessionToken token = CustomTabsSessionToken.createDummySession TokenForTesting();
1088 connection.newSession(token); 1088 connection.newSession(token);
1089 try { 1089 try {
1090 startCustomTabActivityWithIntent( 1090 startCustomTabActivityWithIntent(
1091 CustomTabsTestUtils.createMinimalCustomTabIntent(context, mT estPage)); 1091 CustomTabsTestUtils.createMinimalCustomTabIntent(context, mT estPage));
1092 } catch (InterruptedException e) { 1092 } catch (InterruptedException e) {
1093 fail(); 1093 fail();
1094 } 1094 }
1095 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 1095 assertFalse(
1096 @Override 1096 "Warmup() should have allocated a child connection",
1097 public void run() { 1097 mActivity.shouldAllocateChildConnection());
1098 assertFalse("Warmup() should have allocated a child connection",
1099 mActivity.shouldAllocateChildConnection());
1100 }
1101 });
1102 } 1098 }
1103 1099
1104 /** 1100 /**
1105 * Tests that the activity knows there is no child process. 1101 * Tests that the activity knows there is no child process.
1106 */ 1102 */
1107 @SmallTest 1103 @SmallTest
1108 @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) 1104 @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE)
1109 public void testAllocateChildConnectionNoWarmup() throws Exception { 1105 public void testAllocateChildConnectionNoWarmup() throws Exception {
1110 Context context = getInstrumentation().getTargetContext().getApplication Context(); 1106 Context context = getInstrumentation().getTargetContext().getApplication Context();
1111 final CustomTabsConnection connection = 1107 final CustomTabsConnection connection =
1112 CustomTabsConnection.getInstance((Application) context); 1108 CustomTabsConnection.getInstance((Application) context);
1113 CustomTabsSessionToken token = CustomTabsSessionToken.createDummySession TokenForTesting(); 1109 CustomTabsSessionToken token = CustomTabsSessionToken.createDummySession TokenForTesting();
1114 connection.newSession(token); 1110 connection.newSession(token);
1115 1111
1116 try { 1112 try {
1117 startCustomTabActivityWithIntent( 1113 startCustomTabActivityWithIntent(
1118 CustomTabsTestUtils.createMinimalCustomTabIntent(context, mT estPage2)); 1114 CustomTabsTestUtils.createMinimalCustomTabIntent(context, mT estPage2));
1119 } catch (InterruptedException e) { 1115 } catch (InterruptedException e) {
1120 fail(); 1116 fail();
1121 } 1117 }
1122 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 1118 assertTrue(
1123 @Override 1119 "No spare renderer available, should allocate a child connection .",
1124 public void run() { 1120 mActivity.shouldAllocateChildConnection());
1125 assertTrue("No spare renderer available, should allocate a child connection.",
1126 mActivity.shouldAllocateChildConnection());
1127 }
1128 });
1129 } 1121 }
1130 1122
1131 /** 1123 /**
1132 * Tests that the activity knows there is already a child process when prere ndering. 1124 * Tests that the activity knows there is already a child process when prere ndering.
1133 */ 1125 */
1134 @SmallTest 1126 @SmallTest
1135 @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) 1127 @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE)
1136 public void testAllocateChildConnectionWithPrerender() throws Exception { 1128 public void testAllocateChildConnectionWithPrerender() throws Exception {
1137 Context context = getInstrumentation().getTargetContext().getApplication Context(); 1129 Context context = getInstrumentation().getTargetContext().getApplication Context();
1138 final CustomTabsConnection connection = warmUpAndWait(); 1130 final CustomTabsConnection connection = warmUpAndWait();
1139 CustomTabsSessionToken token = CustomTabsSessionToken.createDummySession TokenForTesting(); 1131 CustomTabsSessionToken token = CustomTabsSessionToken.createDummySession TokenForTesting();
1140 connection.newSession(token); 1132 connection.newSession(token);
1141 assertTrue(connection.mayLaunchUrl(token, Uri.parse(mTestPage), null, nu ll)); 1133 assertTrue(connection.mayLaunchUrl(token, Uri.parse(mTestPage), null, nu ll));
1142 try { 1134 try {
1143 startCustomTabActivityWithIntent( 1135 startCustomTabActivityWithIntent(
1144 CustomTabsTestUtils.createMinimalCustomTabIntent(context, mT estPage)); 1136 CustomTabsTestUtils.createMinimalCustomTabIntent(context, mT estPage));
1145 } catch (InterruptedException e) { 1137 } catch (InterruptedException e) {
1146 fail(); 1138 fail();
1147 } 1139 }
1148 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 1140 assertFalse(
1149 @Override 1141 "Prerendering should have allocated a child connection",
1150 public void run() { 1142 mActivity.shouldAllocateChildConnection());
1151 assertFalse("Prerendering should have allocated a child connecti on",
1152 mActivity.shouldAllocateChildConnection());
1153 }
1154 });
1155 } 1143 }
1156 1144
1157 /** 1145 /**
1158 * Tests that prerendering accepts a referrer, and that this is not lost whe n launching the 1146 * Tests that prerendering accepts a referrer, and that this is not lost whe n launching the
1159 * Custom Tab. 1147 * Custom Tab.
1160 */ 1148 */
1161 @SmallTest 1149 @SmallTest
1162 @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) 1150 @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE)
1163 public void testPrerenderingWithReferrer() throws Exception { 1151 public void testPrerenderingWithReferrer() throws Exception {
1164 String referrer = "android-app://com.foo.me/"; 1152 String referrer = "android-app://com.foo.me/";
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
1544 if (jsonText.equalsIgnoreCase("null")) jsonText = ""; 1532 if (jsonText.equalsIgnoreCase("null")) jsonText = "";
1545 value = jsonText; 1533 value = jsonText;
1546 } catch (InterruptedException | TimeoutException e) { 1534 } catch (InterruptedException | TimeoutException e) {
1547 e.printStackTrace(); 1535 e.printStackTrace();
1548 return false; 1536 return false;
1549 } 1537 }
1550 return TextUtils.equals(mExpected, value); 1538 return TextUtils.equals(mExpected, value);
1551 } 1539 }
1552 } 1540 }
1553 } 1541 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698