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

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: Change unicode representation 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
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/WebsiteSettingsPopup.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e1f605bf5ae0507f03bb46bd13ec97d2eac8ad95
--- /dev/null
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/WebsiteSettingsPopupTest.java
@@ -0,0 +1,40 @@
+// 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.suitebuilder.annotation.SmallTest;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for WebsiteSettingsPopup
+ */
+public class WebsiteSettingsPopupTest extends TestCase {
+ @SmallTest
+ public void testPrepareUrlForDisplay() {
+ assertEquals("Encode suspicious message",
+ WebsiteSettingsPopup.prepareUrlForDisplay(
+ "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.prepareUrlForDisplay("http://example.com/#Düsseldorf"),
+ "http://example.com/#Düsseldorf");
+ assertEquals("Encode fragment with spaces",
+ WebsiteSettingsPopup.prepareUrlForDisplay("http://example.com/#hi how are you"),
+ "http://example.com/#hi%20how%20are%20you");
+ assertEquals("Encode fragment with Unicode whitespace",
+ WebsiteSettingsPopup.prepareUrlForDisplay("http://example.com/#em\u2003space"),
+ "http://example.com/#em%E2%80%83space");
+ assertEquals("Do not encode reserved URI characters or valid Unicode",
+ WebsiteSettingsPopup.prepareUrlForDisplay("http://example.com/?q=a#Düsseldorf,"
+ + " Germany"),
+ "http://example.com/?q=a#Düsseldorf,%20Germany");
+ assertEquals("Preserve characters from supplementary Unicode planes",
+ WebsiteSettingsPopup.prepareUrlForDisplay("http://example.com/#\uD835\uDC9Cstral"),
+ "http://example.com/#\uD835\uDC9Cstral");
+ }
+}
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/WebsiteSettingsPopup.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698