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.InstrumentationTestCase; |
| 8 import android.test.suitebuilder.annotation.SmallTest; |
| 9 |
| 10 /** |
| 11 * Tests for WebsiteSettingsPopup |
| 12 */ |
| 13 public class WebsiteSettingsPopupTest extends InstrumentationTestCase { |
| 14 @SmallTest |
| 15 public void testRemoveSuspiciousFragment() { |
| 16 assertEquals("Encode suspicious message", |
| 17 WebsiteSettingsPopup.encodeSuspiciousFragment( |
| 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.encodeSuspiciousFragment("http://example.co
m/#Düsseldorf"), |
| 24 "http://example.com/#Düsseldorf"); |
| 25 assertEquals("Encode fragment with spaces", |
| 26 WebsiteSettingsPopup.encodeSuspiciousFragment("http://example.co
m/#hi how are you"), |
| 27 "http://example.com/#hi%20how%20are%20you"); |
| 28 assertEquals("Encode fragment with unicode whitespace", |
| 29 WebsiteSettingsPopup.encodeSuspiciousFragment("http://example.co
m/#em\u2003space"), |
| 30 "http://example.com/#em%E2%80%83space"); |
| 31 assertEquals("Do not encode reserved URI characters", |
| 32 WebsiteSettingsPopup.encodeSuspiciousFragment("http://example.co
m/?q=a#a b c"), |
| 33 "http://example.com/?q=a#a%20b%20c"); |
| 34 } |
| 35 } |
OLD | NEW |