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])); |
+ } |
+ } |
+ |
} |