| 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.os.Environment; | |
| 10 import android.test.suitebuilder.annotation.SmallTest; | 9 import android.test.suitebuilder.annotation.SmallTest; |
| 11 | 10 |
| 12 import org.chromium.base.test.util.RetryOnFailure; | 11 import org.chromium.base.test.util.RetryOnFailure; |
| 13 import org.chromium.chrome.browser.customtabs.CustomTabDelegateFactory.CustomTab
NavigationDelegate; | 12 import org.chromium.chrome.browser.customtabs.CustomTabDelegateFactory.CustomTab
NavigationDelegate; |
| 14 import org.chromium.chrome.browser.externalnav.ExternalNavigationHandler; | 13 import org.chromium.chrome.browser.externalnav.ExternalNavigationHandler; |
| 15 import org.chromium.chrome.browser.externalnav.ExternalNavigationHandler.Overrid
eUrlLoadingResult; | 14 import org.chromium.chrome.browser.externalnav.ExternalNavigationHandler.Overrid
eUrlLoadingResult; |
| 16 import org.chromium.chrome.browser.externalnav.ExternalNavigationParams; | 15 import org.chromium.chrome.browser.externalnav.ExternalNavigationParams; |
| 17 import org.chromium.chrome.browser.tab.Tab; | 16 import org.chromium.chrome.browser.tab.Tab; |
| 18 import org.chromium.chrome.browser.tab.TabDelegateFactory; | 17 import org.chromium.chrome.browser.tab.TabDelegateFactory; |
| 19 import org.chromium.net.test.EmbeddedTestServer; | 18 import org.chromium.net.test.EmbeddedTestServer; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 46 } | 45 } |
| 47 } | 46 } |
| 48 | 47 |
| 49 private static final String TEST_PATH = "/chrome/test/data/android/google.ht
ml"; | 48 private static final String TEST_PATH = "/chrome/test/data/android/google.ht
ml"; |
| 50 private CustomTabNavigationDelegate mNavigationDelegate; | 49 private CustomTabNavigationDelegate mNavigationDelegate; |
| 51 private EmbeddedTestServer mTestServer; | 50 private EmbeddedTestServer mTestServer; |
| 52 private ExternalNavigationHandler mUrlHandler; | 51 private ExternalNavigationHandler mUrlHandler; |
| 53 | 52 |
| 54 @Override | 53 @Override |
| 55 public void setUp() throws Exception { | 54 public void setUp() throws Exception { |
| 56 mTestServer = EmbeddedTestServer.createAndStartFileServer( | 55 mTestServer = EmbeddedTestServer.createAndStartServer(getInstrumentation
().getContext()); |
| 57 getInstrumentation().getContext(), Environment.getExternalStorag
eDirectory()); | |
| 58 super.setUp(); | 56 super.setUp(); |
| 59 } | 57 } |
| 60 | 58 |
| 61 @Override | 59 @Override |
| 62 public void tearDown() throws Exception { | 60 public void tearDown() throws Exception { |
| 63 mTestServer.stopAndDestroyServer(); | 61 mTestServer.stopAndDestroyServer(); |
| 64 super.tearDown(); | 62 super.tearDown(); |
| 65 } | 63 } |
| 66 | 64 |
| 67 @Override | 65 @Override |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 public void testIntentPickerNotShownForNormalUrl() { | 103 public void testIntentPickerNotShownForNormalUrl() { |
| 106 final String testUrl = "http://customtabtest.com"; | 104 final String testUrl = "http://customtabtest.com"; |
| 107 ExternalNavigationParams params = new ExternalNavigationParams.Builder(t
estUrl, false) | 105 ExternalNavigationParams params = new ExternalNavigationParams.Builder(t
estUrl, false) |
| 108 .build(); | 106 .build(); |
| 109 OverrideUrlLoadingResult result = mUrlHandler.shouldOverrideUrlLoading(p
arams); | 107 OverrideUrlLoadingResult result = mUrlHandler.shouldOverrideUrlLoading(p
arams); |
| 110 assertEquals(OverrideUrlLoadingResult.NO_OVERRIDE, result); | 108 assertEquals(OverrideUrlLoadingResult.NO_OVERRIDE, result); |
| 111 assertFalse("External activities should not be started to handle the url
", | 109 assertFalse("External activities should not be started to handle the url
", |
| 112 mNavigationDelegate.hasExternalActivityStarted()); | 110 mNavigationDelegate.hasExternalActivityStarted()); |
| 113 } | 111 } |
| 114 } | 112 } |
| OLD | NEW |