Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1402)

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/util/UrlUtilitiesTest.java

Issue 2636103002: [WebAPKs] Show minibar when WebAPK navigates outside scope specified in Web Manifest (Closed)
Patch Set: Merge branch 'master' into minibar Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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));

Powered by Google App Engine
This is Rietveld 408576698