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

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

Issue 1276993002: Revert of Add custom tabs tests using intents with non-null sessions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 android.app.Activity; 7 import android.app.Activity;
8 import android.app.Instrumentation; 8 import android.app.Instrumentation;
9 import android.content.ComponentName;
9 import android.content.Intent; 10 import android.content.Intent;
11 import android.net.Uri;
12 import android.support.customtabs.CustomTabsIntent;
10 13
11 import org.chromium.chrome.browser.DeferredStartupHandler; 14 import org.chromium.chrome.browser.DeferredStartupHandler;
15 import org.chromium.chrome.browser.document.ChromeLauncherActivity;
12 import org.chromium.chrome.browser.tab.Tab; 16 import org.chromium.chrome.browser.tab.Tab;
17 import org.chromium.chrome.browser.util.IntentUtils;
13 import org.chromium.chrome.test.ChromeActivityTestCaseBase; 18 import org.chromium.chrome.test.ChromeActivityTestCaseBase;
14 import org.chromium.content.browser.test.util.Criteria; 19 import org.chromium.content.browser.test.util.Criteria;
15 import org.chromium.content.browser.test.util.CriteriaHelper; 20 import org.chromium.content.browser.test.util.CriteriaHelper;
16 21
17 /** 22 /**
18 * Base class for all instrumentation tests that require a {@link CustomTabActiv ity}. 23 * Base class for all instrumentation tests that require a {@link CustomTabActiv ity}.
19 */ 24 */
20 public abstract class CustomTabActivityTestBase extends 25 public abstract class CustomTabActivityTestBase extends
21 ChromeActivityTestCaseBase<CustomTabActivity> { 26 ChromeActivityTestCaseBase<CustomTabActivity> {
22 27
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } 60 }
56 })); 61 }));
57 Tab tab = getActivity().getActivityTab(); 62 Tab tab = getActivity().getActivityTab();
58 63
59 assertTrue("Deferred startup never completed", 64 assertTrue("Deferred startup never completed",
60 CriteriaHelper.pollForUIThreadCriteria(new Criteria() { 65 CriteriaHelper.pollForUIThreadCriteria(new Criteria() {
61 @Override 66 @Override
62 public boolean isSatisfied() { 67 public boolean isSatisfied() {
63 return DeferredStartupHandler.getInstance().isDeferredSt artupComplete(); 68 return DeferredStartupHandler.getInstance().isDeferredSt artupComplete();
64 } 69 }
65 }, 5000, 200)); 70 }));
66 71
67 assertNotNull(tab); 72 assertNotNull(tab);
68 assertNotNull(tab.getView()); 73 assertNotNull(tab.getView());
69 } 74 }
75
76 /**
77 * Creates the simplest intent that is sufficient to let {@link ChromeLaunch erActivity} launch
78 * the {@link CustomTabActivity}.
79 */
80 protected Intent createMinimalCustomTabIntent(String url) {
81 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
82 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
83 intent.setComponent(new ComponentName(getInstrumentation().getTargetCont ext(),
84 ChromeLauncherActivity.class));
85 IntentUtils.safePutBinderExtra(intent, CustomTabsIntent.EXTRA_SESSION, n ull);
86 return intent;
87 }
70 } 88 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698