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

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

Issue 1011383005: Percent-encode illegal characters in Android page info popup URL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Only encode whitespace characters Created 5 years, 9 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/WebsiteSettingsPopupTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/WebsiteSettingsPopupTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/WebsiteSettingsPopupTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..6ab2de201ed9a9c6fae398722e885fa1653c7ca3
--- /dev/null
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/WebsiteSettingsPopupTest.java
@@ -0,0 +1,35 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser;
+
+import android.test.InstrumentationTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
+
+/**
+ * Tests for WebsiteSettingsPopup
+ */
+public class WebsiteSettingsPopupTest extends InstrumentationTestCase {
Ted C 2015/03/25 19:55:38 can this extend directly from TestCase instead of
tsergeant 2015/03/25 23:44:47 Done.
+ @SmallTest
+ public void testRemoveSuspiciousUrl() {
+ assertEquals("Encode suspicious message",
+ WebsiteSettingsPopup.encodeSuspiciousUrl(
+ "http://example.com/# WARNING \u00A0Chrome has detected malware on your"
+ + " device!"),
+ "http://example.com/#%20%20WARNING%20%20%C2%A0Chrome%20has%20detected%20malware%20"
+ + "on%20your%20device!");
+ assertEquals("Do not encode valid Unicode fragment",
+ WebsiteSettingsPopup.encodeSuspiciousUrl("http://example.com/#Düsseldorf"),
+ "http://example.com/#Düsseldorf");
+ assertEquals("Encode fragment with spaces",
+ WebsiteSettingsPopup.encodeSuspiciousUrl("http://example.com/#hi how are you"),
+ "http://example.com/#hi%20how%20are%20you");
+ assertEquals("Encode fragment with Unicode whitespace",
+ WebsiteSettingsPopup.encodeSuspiciousUrl("http://example.com/#em\u2003space"),
+ "http://example.com/#em%E2%80%83space");
+ assertEquals("Do not encode reserved URI characters or valid Unicode",
+ WebsiteSettingsPopup.encodeSuspiciousUrl("http://example.com/?q=a#Düsseldorf, Germany"),
Ted C 2015/03/25 19:55:38 >100 chars
tsergeant 2015/03/25 23:44:47 Done.
+ "http://example.com/?q=a#Düsseldorf,%20Germany");
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698