OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.util; | 5 package org.chromium.chrome.browser.util; |
6 | 6 |
7 import android.support.test.filters.SmallTest; | 7 import android.support.test.filters.SmallTest; |
8 | 8 |
9 import org.junit.Assert; | 9 import org.junit.Assert; |
10 import org.junit.Before; | 10 import org.junit.Before; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 @Test | 77 @Test |
78 @SmallTest | 78 @SmallTest |
79 public void testIsValidForIntentFallbackUrl() { | 79 public void testIsValidForIntentFallbackUrl() { |
80 Assert.assertTrue(UrlUtilities.isValidForIntentFallbackNavigation( | 80 Assert.assertTrue(UrlUtilities.isValidForIntentFallbackNavigation( |
81 "https://user:pass@awesome.com:9000/bad-scheme:#fake:")); | 81 "https://user:pass@awesome.com:9000/bad-scheme:#fake:")); |
82 Assert.assertTrue( | 82 Assert.assertTrue( |
83 UrlUtilities.isValidForIntentFallbackNavigation("http://awesome.
example.com/")); | 83 UrlUtilities.isValidForIntentFallbackNavigation("http://awesome.
example.com/")); |
84 Assert.assertFalse(UrlUtilities.isValidForIntentFallbackNavigation("inli
ne:skates.co.uk")); | 84 Assert.assertFalse(UrlUtilities.isValidForIntentFallbackNavigation("inli
ne:skates.co.uk")); |
85 Assert.assertFalse(UrlUtilities.isValidForIntentFallbackNavigation("java
script:alert(1)")); | 85 Assert.assertFalse(UrlUtilities.isValidForIntentFallbackNavigation("java
script:alert(1)")); |
| 86 Assert.assertFalse( |
| 87 UrlUtilities.isValidForIntentFallbackNavigation("file://hostname
/path/to/file")); |
| 88 Assert.assertFalse(UrlUtilities.isValidForIntentFallbackNavigation("data
:data")); |
| 89 Assert.assertFalse(UrlUtilities.isValidForIntentFallbackNavigation("abou
t:awesome")); |
86 Assert.assertFalse(UrlUtilities.isValidForIntentFallbackNavigation("")); | 90 Assert.assertFalse(UrlUtilities.isValidForIntentFallbackNavigation("")); |
87 } | 91 } |
88 | 92 |
89 @Test | 93 @Test |
90 @SmallTest | 94 @SmallTest |
91 public void testValidateIntentUrl() { | 95 public void testValidateIntentUrl() { |
92 // Valid action, hostname, and (empty) path. | 96 // Valid action, hostname, and (empty) path. |
93 Assert.assertTrue(UrlUtilities.validateIntentUrl( | 97 Assert.assertTrue(UrlUtilities.validateIntentUrl( |
94 "intent://10010#Intent;scheme=tel;action=com.google.android.apps
." | 98 "intent://10010#Intent;scheme=tel;action=com.google.android.apps
." |
95 + "authenticator.AUTHENTICATE;end")); | 99 + "authenticator.AUTHENTICATE;end")); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 } | 192 } |
189 | 193 |
190 @Test | 194 @Test |
191 @SmallTest | 195 @SmallTest |
192 public void testUrlsFragmentsDiffer() { | 196 public void testUrlsFragmentsDiffer() { |
193 String url = "http://www.example.com/path"; | 197 String url = "http://www.example.com/path"; |
194 Assert.assertFalse(UrlUtilities.urlsFragmentsDiffer(url, url)); | 198 Assert.assertFalse(UrlUtilities.urlsFragmentsDiffer(url, url)); |
195 Assert.assertTrue(UrlUtilities.urlsFragmentsDiffer(url + "#fragment", ur
l)); | 199 Assert.assertTrue(UrlUtilities.urlsFragmentsDiffer(url + "#fragment", ur
l)); |
196 } | 200 } |
197 } | 201 } |
OLD | NEW |