Chromium Code Reviews| Index: chrome/android/javatests/src/org/chromium/chrome/browser/util/UrlUtilitiesTest.java |
| diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/util/UrlUtilitiesTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/util/UrlUtilitiesTest.java |
| index 33ce22258973d08d08f88902581fd8bdf7388748..7e86dedbd0d456ea7741c1191a182cf0d10e0a6e 100644 |
| --- a/chrome/android/javatests/src/org/chromium/chrome/browser/util/UrlUtilitiesTest.java |
| +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/util/UrlUtilitiesTest.java |
| @@ -143,6 +143,21 @@ public class UrlUtilitiesTest extends NativeLibraryTestBase { |
| } |
| @SmallTest |
| + public void testIsUrlWithinScope() { |
| + String scope = "http://www.example.com/sub"; |
| + assertTrue(UrlUtilities.isUrlWithinScope(scope, scope)); |
| + assertTrue(UrlUtilities.isUrlWithinScope(scope + "/path", scope)); |
| + assertTrue(UrlUtilities.isUrlWithinScope(scope + "/a b", scope + "/a%20b/path")); |
| + |
| + assertFalse(UrlUtilities.isUrlWithinScope("https://www.example.com/sub", scope)); |
| + assertFalse(UrlUtilities.isUrlWithinScope(scope, scope + "/inner")); |
| + assertFalse(UrlUtilities.isUrlWithinScope(scope + "/this", scope + "/different")); |
| + assertFalse(UrlUtilities.isUrlWithinScope("http://awesome.example.com", "http://example.com")); |
|
Maria
2017/01/18 17:11:08
long line?
|
| + assertFalse(UrlUtilities.isUrlWithinScope( |
| + "https://www.google.com.evil.com", "https://www.google.com")); |
| + } |
| + |
| + @SmallTest |
| public void testUrlsMatchIgnoringFragments() { |
| String url = "http://www.example.com/path"; |
| assertTrue(UrlUtilities.urlsMatchIgnoringFragments(url, url)); |