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

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

Issue 1924473002: Don't hide the reparenting tab while detaching (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1222 fail(); 1222 fail();
1223 } 1223 }
1224 return connection; 1224 return connection;
1225 } 1225 }
1226 1226
1227 private ChromeActivity reparentAndVerifyTab() throws InterruptedException { 1227 private ChromeActivity reparentAndVerifyTab() throws InterruptedException {
1228 ActivityResult result = null; 1228 ActivityResult result = null;
1229 final ActivityMonitor monitor = getInstrumentation().addMonitor( 1229 final ActivityMonitor monitor = getInstrumentation().addMonitor(
1230 ChromeTabbedActivity.class.getName(), result, false); 1230 ChromeTabbedActivity.class.getName(), result, false);
1231 final Tab tabToBeReparented = mActivity.getActivityTab(); 1231 final Tab tabToBeReparented = mActivity.getActivityTab();
1232 final CallbackHelper tabHiddenHelper = new CallbackHelper();
1233 tabToBeReparented.addObserver(new EmptyTabObserver() {
gone 2016/04/26 22:05:38 This Observer should probably be removed at some p
Yusuf 2016/04/26 22:10:15 Done.
1234 @Override
1235 public void onHidden(Tab tab) {
1236 tabHiddenHelper.notifyCalled();
1237 }
1238 });
1232 ThreadUtils.postOnUiThread(new Runnable() { 1239 ThreadUtils.postOnUiThread(new Runnable() {
1233 @Override 1240 @Override
1234 public void run() { 1241 public void run() {
1235 mActivity.openCurrentUrlInBrowser(true); 1242 mActivity.openCurrentUrlInBrowser(true);
1236 assertNull(mActivity.getActivityTab()); 1243 assertNull(mActivity.getActivityTab());
1237 } 1244 }
1238 }); 1245 });
1239 CriteriaHelper.pollInstrumentationThread(new Criteria() { 1246 CriteriaHelper.pollInstrumentationThread(new Criteria() {
1240 @Override 1247 @Override
1241 public boolean isSatisfied() { 1248 public boolean isSatisfied() {
(...skipping 12 matching lines...) Expand all
1254 CriteriaHelper.pollUiThread((new Criteria() { 1261 CriteriaHelper.pollUiThread((new Criteria() {
1255 @Override 1262 @Override
1256 public boolean isSatisfied() { 1263 public boolean isSatisfied() {
1257 return mActivity.isActivityDestroyed(); 1264 return mActivity.isActivityDestroyed();
1258 } 1265 }
1259 })); 1266 }));
1260 assertEquals(newActivity.getWindowAndroid(), tabToBeReparented.getWindow Android()); 1267 assertEquals(newActivity.getWindowAndroid(), tabToBeReparented.getWindow Android());
1261 assertEquals(newActivity.getWindowAndroid(), 1268 assertEquals(newActivity.getWindowAndroid(),
1262 tabToBeReparented.getContentViewCore().getWindowAndroid()); 1269 tabToBeReparented.getContentViewCore().getWindowAndroid());
1263 assertFalse(tabToBeReparented.getDelegateFactory() instanceof CustomTabD elegateFactory); 1270 assertFalse(tabToBeReparented.getDelegateFactory() instanceof CustomTabD elegateFactory);
1271 assertEquals("The tab should never be hidden during the reparenting proc ess",
1272 0, tabHiddenHelper.getCallCount());
1264 return newActivity; 1273 return newActivity;
1265 } 1274 }
1266 1275
1267 private IBinder warmUpAndLaunchUrlWithSession(ICustomTabsCallback cb) 1276 private IBinder warmUpAndLaunchUrlWithSession(ICustomTabsCallback cb)
1268 throws InterruptedException { 1277 throws InterruptedException {
1269 CustomTabsConnection connection = warmUpAndWait(); 1278 CustomTabsConnection connection = warmUpAndWait();
1270 connection.newSession(cb); 1279 connection.newSession(cb);
1271 Context context = getInstrumentation().getTargetContext().getApplication Context(); 1280 Context context = getInstrumentation().getTargetContext().getApplication Context();
1272 startCustomTabActivityWithIntent(CustomTabsTestUtils.createMinimalCustom TabIntent( 1281 startCustomTabActivityWithIntent(CustomTabsTestUtils.createMinimalCustom TabIntent(
1273 context, mTestPage, cb.asBinder())); 1282 context, mTestPage, cb.asBinder()));
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1348 if (jsonText.equalsIgnoreCase("null")) jsonText = ""; 1357 if (jsonText.equalsIgnoreCase("null")) jsonText = "";
1349 value = jsonText; 1358 value = jsonText;
1350 } catch (InterruptedException | TimeoutException e) { 1359 } catch (InterruptedException | TimeoutException e) {
1351 e.printStackTrace(); 1360 e.printStackTrace();
1352 return false; 1361 return false;
1353 } 1362 }
1354 return TextUtils.equals(mExpected, value); 1363 return TextUtils.equals(mExpected, value);
1355 } 1364 }
1356 } 1365 }
1357 } 1366 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698