OLD | NEW |
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.os.Bundle; | 8 import android.os.Bundle; |
9 import android.test.suitebuilder.annotation.SmallTest; | 9 import android.test.suitebuilder.annotation.SmallTest; |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 private static final String TEST_URL = "about:blank"; | 54 private static final String TEST_URL = "about:blank"; |
55 private ExternalNavigationHandler mUrlHandler; | 55 private ExternalNavigationHandler mUrlHandler; |
56 private CustomTabNavigationDelegate mNavigationDelegate; | 56 private CustomTabNavigationDelegate mNavigationDelegate; |
57 | 57 |
58 @Override | 58 @Override |
59 public void startMainActivity() throws InterruptedException { | 59 public void startMainActivity() throws InterruptedException { |
60 super.startMainActivity(); | 60 super.startMainActivity(); |
61 startCustomTabActivityWithIntent(CustomTabsTestUtils.createMinimalCustom
TabIntent( | 61 startCustomTabActivityWithIntent(createMinimalCustomTabIntent(TEST_URL))
; |
62 getInstrumentation().getTargetContext(), TEST_URL, null)); | |
63 Tab tab = getActivity().getActivityTab(); | 62 Tab tab = getActivity().getActivityTab(); |
64 assertTrue("A custom tab is not present in the activity.", tab instanceo
f CustomTab); | 63 assertTrue("A custom tab is not present in the activity.", tab instanceo
f CustomTab); |
65 CustomTab customTab = (CustomTab) tab; | 64 CustomTab customTab = (CustomTab) tab; |
66 mUrlHandler = customTab.getExternalNavigationHandler(); | 65 mUrlHandler = customTab.getExternalNavigationHandler(); |
67 mNavigationDelegate = customTab.getExternalNavigationDelegate(); | 66 mNavigationDelegate = customTab.getExternalNavigationDelegate(); |
68 } | 67 } |
69 | 68 |
70 /** | 69 /** |
71 * For urls with special schemes and hosts, and there is exactly one activit
y having a matching | 70 * For urls with special schemes and hosts, and there is exactly one activit
y having a matching |
72 * intent filter, the framework will make that activity the default handler
of the special url. | 71 * intent filter, the framework will make that activity the default handler
of the special url. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 false); | 119 false); |
121 } | 120 } |
122 }); | 121 }); |
123 | 122 |
124 loadUrlHelper.waitForCallback(0, 1); | 123 loadUrlHelper.waitForCallback(0, 1); |
125 assertTrue("A new tab should not have been created.", | 124 assertTrue("A new tab should not have been created.", |
126 ApplicationStatus.getLastTrackedFocusedActivity() == getActivity
()); | 125 ApplicationStatus.getLastTrackedFocusedActivity() == getActivity
()); |
127 assertEquals(testUrl, getActivity().getActivityTab().getUrl()); | 126 assertEquals(testUrl, getActivity().getActivityTab().getUrl()); |
128 } | 127 } |
129 } | 128 } |
OLD | NEW |