OLD | NEW |
---|---|
(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"); | |
Matt Giuca
2015/03/26 00:02:08
Please add a test with an astral character (e.g.,
tsergeant
2015/03/26 00:29:12
Done.
| |
36 } | |
37 } | |
OLD | NEW |