package com.android.mail.utils;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
/**
* These test cases verify the handling of more advanced cross-site scripting attacks.
*/
@SmallTest
public class AdvancedHtmlSanitizerTest extends AndroidTestCase {
public void testSampleEmail() {
sanitize("\n" +
"
\n" +
"HTML E-mail\n" +
"\n" +
"\n" +
"\n" +
"Body here\n" +
"
\n" +
"Link to Google Search!\n" +
"
\n" +
"
\n" +
"I am a link!\n" +
"
\n" +
"Moar body here\n" +
"\n" +
""
,
"\n" +
"\n" +
"\n" +
"\n" +
"\n" +
"\n");
}
public void testXSS() {
sanitize("'';!--\"=&{()}", "'';!--"=&{()}");
sanitize("", "");
sanitize("\\\";alert('XSS');//", "\\";alert('XSS');//");
sanitize("
", "
");
sanitize("", "");
sanitize("", "");
sanitize("¼script¾alert(¢XSS¢)¼/script¾", "¼script¾alert(¢XSS¢)¼/script¾");
sanitize("cript:alert('XSS')\">",
"");
sanitize("", "");
sanitize("", "");
sanitize("\n" +
"\n" +
"\n" +
"alert(\"XSS\")" +
"\">\n" +
"