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

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

Issue 1059413004: Add a validator for intent:// URLs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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/UrlUtilitiesTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/UrlUtilitiesTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/UrlUtilitiesTest.java
index d40403d745a2a240504169124b6b29b104666730..1002ac0b51fff20a3f4645429021b907c8d2a38c 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/UrlUtilitiesTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/UrlUtilitiesTest.java
@@ -104,4 +104,28 @@ public class UrlUtilitiesTest extends InstrumentationTestCase {
assertEquals("about:blank", UrlUtilities.getOriginForDisplay(uri, false));
}
+ @SmallTest
+ public void testValidateIntentUrl() {
+ String[] expectedTrue = {
+ "intent://10010#Intent;scheme=tel;action=com.google.android.apps."
+ + "authenticator.AUTHENTICATE;end",
+ "intent://scan/#Intent;package=com.google.zxing.client.android;"
+ + "scheme=zxing;end;"
+ };
+
+ for (int i = 0; i < expectedTrue.length; ++i) {
+ assertTrue(UrlUtilities.validateIntentUrl(expectedTrue[i]));
+ }
+
+ String[] expectedFalse = {
+ "intent://10010#Intent;scheme=tel;action=com.google.android.apps."
+ + "authenticator.AUTHENTICATE;end','*');"
Yaron 2015/04/24 16:04:18 There's a lot of other validation that is currentl
palmer 2015/04/24 18:05:22 Definitely. Adding more tests now. The above was w
+ + "alert(document.cookie);//"
+ };
+
+ for (int i = 0; i < expectedFalse.length; ++i) {
+ assertFalse(UrlUtilities.validateIntentUrl(expectedFalse[i]));
+ }
+ }
+
}

Powered by Google App Engine
This is Rietveld 408576698