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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser;
6
7 import android.test.suitebuilder.annotation.SmallTest;
8
9 import junit.framework.TestCase;
10
11 /**
12 * Tests for WebsiteSettingsPopup
13 */
14 public class WebsiteSettingsPopupTest extends TestCase {
15 @SmallTest
16 public void testPrepareUrlForDisplay() {
17 assertEquals("Encode suspicious message",
18 WebsiteSettingsPopup.prepareUrlForDisplay(
19 "http://example.com/# WARNING \u00A0Chrome has detecte d malware on your"
20 + " device!"),
21 "http://example.com/#%20%20WARNING%20%20%C2%A0Chrome%20has%20det ected%20malware%20"
22 + "on%20your%20device!");
23 assertEquals("Do not encode valid Unicode fragment",
24 WebsiteSettingsPopup.prepareUrlForDisplay("http://example.com/#D üsseldorf"),
25 "http://example.com/#Düsseldorf");
26 assertEquals("Encode fragment with spaces",
27 WebsiteSettingsPopup.prepareUrlForDisplay("http://example.com/#h i how are you"),
28 "http://example.com/#hi%20how%20are%20you");
29 assertEquals("Encode fragment with Unicode whitespace",
30 WebsiteSettingsPopup.prepareUrlForDisplay("http://example.com/#e m\u2003space"),
31 "http://example.com/#em%E2%80%83space");
32 assertEquals("Do not encode reserved URI characters or valid Unicode",
33 WebsiteSettingsPopup.prepareUrlForDisplay("http://example.com/?q =a#Düsseldorf,"
34 + " Germany"),
35 "http://example.com/?q=a#Düsseldorf,%20Germany");
36 assertEquals("Preserve characters from supplementary Unicode planes",
37 WebsiteSettingsPopup.prepareUrlForDisplay("http://example.com/#\ uD835\uDC9Cstral"),
38 "http://example.com/#\uD835\uDC9Cstral");
39 }
40 }
OLDNEW
« 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