| 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(createMinimalCustomTabIntent(TEST_URL))
; | 61 startCustomTabActivityWithIntent(CustomTabsTestUtils.createMinimalCustom
TabIntent( |
| 62 getInstrumentation().getTargetContext(), TEST_URL, null)); |
| 62 Tab tab = getActivity().getActivityTab(); | 63 Tab tab = getActivity().getActivityTab(); |
| 63 assertTrue("A custom tab is not present in the activity.", tab instanceo
f CustomTab); | 64 assertTrue("A custom tab is not present in the activity.", tab instanceo
f CustomTab); |
| 64 CustomTab customTab = (CustomTab) tab; | 65 CustomTab customTab = (CustomTab) tab; |
| 65 mUrlHandler = customTab.getExternalNavigationHandler(); | 66 mUrlHandler = customTab.getExternalNavigationHandler(); |
| 66 mNavigationDelegate = customTab.getExternalNavigationDelegate(); | 67 mNavigationDelegate = customTab.getExternalNavigationDelegate(); |
| 67 } | 68 } |
| 68 | 69 |
| 69 /** | 70 /** |
| 70 * For urls with special schemes and hosts, and there is exactly one activit
y having a matching | 71 * For urls with special schemes and hosts, and there is exactly one activit
y having a matching |
| 71 * intent filter, the framework will make that activity the default handler
of the special url. | 72 * 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... |
| 119 false); | 120 false); |
| 120 } | 121 } |
| 121 }); | 122 }); |
| 122 | 123 |
| 123 loadUrlHelper.waitForCallback(0, 1); | 124 loadUrlHelper.waitForCallback(0, 1); |
| 124 assertTrue("A new tab should not have been created.", | 125 assertTrue("A new tab should not have been created.", |
| 125 ApplicationStatus.getLastTrackedFocusedActivity() == getActivity
()); | 126 ApplicationStatus.getLastTrackedFocusedActivity() == getActivity
()); |
| 126 assertEquals(testUrl, getActivity().getActivityTab().getUrl()); | 127 assertEquals(testUrl, getActivity().getActivityTab().getUrl()); |
| 127 } | 128 } |
| 128 } | 129 } |
| OLD | NEW |