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

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: 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 unified diff | Download patch
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.InstrumentationTestCase;
8 import android.test.suitebuilder.annotation.SmallTest;
9
10 /**
11 * Tests for WebsiteSettingsPopup
12 */
13 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.
14 @SmallTest
15 public void testRemoveSuspiciousUrl() {
16 assertEquals("Encode suspicious message",
17 WebsiteSettingsPopup.encodeSuspiciousUrl(
18 "http://example.com/# WARNING \u00A0Chrome has detecte d malware on your"
19 + " device!"),
20 "http://example.com/#%20%20WARNING%20%20%C2%A0Chrome%20has%20det ected%20malware%20"
21 + "on%20your%20device!");
22 assertEquals("Do not encode valid Unicode fragment",
23 WebsiteSettingsPopup.encodeSuspiciousUrl("http://example.com/#Dü sseldorf"),
24 "http://example.com/#Düsseldorf");
25 assertEquals("Encode fragment with spaces",
26 WebsiteSettingsPopup.encodeSuspiciousUrl("http://example.com/#hi how are you"),
27 "http://example.com/#hi%20how%20are%20you");
28 assertEquals("Encode fragment with Unicode whitespace",
29 WebsiteSettingsPopup.encodeSuspiciousUrl("http://example.com/#em \u2003space"),
30 "http://example.com/#em%E2%80%83space");
31 assertEquals("Do not encode reserved URI characters or valid Unicode",
32 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.
33 "http://example.com/?q=a#Düsseldorf,%20Germany");
34 }
35 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698