package com.android.mail.utils; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; /** * These test cases verify that the HTML email body is transformed correctly to support toggling * the visibility of quoted text. */ @SmallTest public class QuotedHtmlSanitizerTest extends AndroidTestCase { /** * Random garbage in a class attribute of a div is stripped. */ public void testGarbageDiv() { // any random class value is disallowed sanitize("
", "
"); } /** * For Gmail,
indicates the block of quoted text. */ public void testGmailQuotedTextDiv() { sanitize("
", "
"); } /** * For Yahoo,
indicates the block of quoted text. */ public void testYahooQuotedTextDiv() { sanitize("
", "
"); } /** * For AOL,
indicates the block of quoted text. */ public void testAOLQuotedTextDiv() { sanitize("
", "
"); sanitize("
", "
"); } private void sanitize(String dirtyHTML, String expectedHTML) { final String cleansedHTML = HtmlSanitizer.sanitizeHtml(dirtyHTML); assertEquals(expectedHTML, cleansedHTML); } }