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

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

Issue 1267243003: Add custom tabs tests using intents with non-null sessions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added the utils class 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionTest.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/CustomTabsTestUtils.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsTestUtils.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsTestUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..bfae2e6dd772df05b7375e06c87ed8effe5591c7
--- /dev/null
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsTestUtils.java
@@ -0,0 +1,47 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.customtabs;
+
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.support.customtabs.CustomTabsIntent;
+import android.support.customtabs.ICustomTabsCallback;
+
+import org.chromium.chrome.browser.document.ChromeLauncherActivity;
+import org.chromium.chrome.browser.util.IntentUtils;
+
+/**
+ * Utility class that contains convenience calls related with custom tabs testing.
+ */
+public class CustomTabsTestUtils {
+ public static ICustomTabsCallback newDummyCallback() {
+ return new ICustomTabsCallback.Stub() {
+ @Override
+ public void onNavigationEvent(int navigationEvent, Bundle extras) {}
+
+ @Override
+ public IBinder asBinder() {
+ return this;
+ }
+ };
+ }
+
+ /**
+ * Creates the simplest intent that is sufficient to let {@link ChromeLauncherActivity} launch
+ * the {@link CustomTabActivity}.
+ */
+ public static Intent createMinimalCustomTabIntent(
+ Context context, String url, IBinder session) {
+ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ intent.setComponent(new ComponentName(context, ChromeLauncherActivity.class));
+ IntentUtils.safePutBinderExtra(intent, CustomTabsIntent.EXTRA_SESSION, session);
+ return intent;
+ }
+}
« no previous file with comments | « chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698