This source file includes following definitions.
- TEST
- TEST
#include "config.h"
#include "core/dom/DOMImplementation.h"
#include "wtf/text/WTFString.h"
#include <gtest/gtest.h>
using namespace WebCore;
namespace {
TEST(DOMImplementationTest, TextMIMEType)
{
EXPECT_TRUE(DOMImplementation::isTextMIMEType("text/plain"));
EXPECT_TRUE(DOMImplementation::isTextMIMEType("text/javascript"));
EXPECT_TRUE(DOMImplementation::isTextMIMEType("TEXT/JavaScript"));
EXPECT_TRUE(DOMImplementation::isTextMIMEType("application/json"));
EXPECT_TRUE(DOMImplementation::isTextMIMEType("application/jSON"));
EXPECT_TRUE(DOMImplementation::isTextMIMEType("application/json;foo=2"));
EXPECT_TRUE(DOMImplementation::isTextMIMEType("application/json "));
EXPECT_TRUE(DOMImplementation::isTextMIMEType("application/+json"));
EXPECT_TRUE(DOMImplementation::isTextMIMEType("application/x-javascript-like+json;a=2;c=4"));
EXPECT_TRUE(DOMImplementation::isTextMIMEType("application/javascript"));
EXPECT_TRUE(DOMImplementation::isTextMIMEType("Application/Javascript"));
EXPECT_TRUE(DOMImplementation::isTextMIMEType("application/x-custom+json;b=3"));
EXPECT_TRUE(DOMImplementation::isTextMIMEType("application/x-custom+json"));
EXPECT_TRUE(DOMImplementation::isTextMIMEType("application/x-what+json;"));
EXPECT_TRUE(DOMImplementation::isTextMIMEType("application/json;"));
EXPECT_TRUE(DOMImplementation::isTextMIMEType("application/json "));
EXPECT_FALSE(DOMImplementation::isTextMIMEType("application/x-custom;a=a+json"));
EXPECT_FALSE(DOMImplementation::isTextMIMEType("application/x-custom;a=a+json ;"));
EXPECT_FALSE(DOMImplementation::isTextMIMEType("application/x-custom+jsonsoup"));
EXPECT_FALSE(DOMImplementation::isTextMIMEType("application/x-custom+jsonsoup "));
EXPECT_FALSE(DOMImplementation::isTextMIMEType("text/html"));
EXPECT_FALSE(DOMImplementation::isTextMIMEType("text/xml"));
EXPECT_FALSE(DOMImplementation::isTextMIMEType("text/xsl"));
}
TEST(DOMImplementationTest, TextXMLType)
{
EXPECT_TRUE(DOMImplementation::isXMLMIMEType("text/xml"));
EXPECT_TRUE(DOMImplementation::isXMLMIMEType("Text/xml"));
EXPECT_TRUE(DOMImplementation::isXMLMIMEType("tEXt/XML"));
EXPECT_TRUE(DOMImplementation::isXMLMIMEType("application/xml"));
EXPECT_TRUE(DOMImplementation::isXMLMIMEType("application/XML"));
EXPECT_TRUE(DOMImplementation::isXMLMIMEType("application/x-tra+xML"));
EXPECT_TRUE(DOMImplementation::isXMLMIMEType("application/xslt+xml"));
EXPECT_TRUE(DOMImplementation::isXMLMIMEType("application/rdf+Xml"));
EXPECT_TRUE(DOMImplementation::isXMLMIMEType("image/svg+xml"));
EXPECT_TRUE(DOMImplementation::isXMLMIMEType("text/xsl"));
EXPECT_TRUE(DOMImplementation::isXMLMIMEType("text/XSL"));
EXPECT_TRUE(DOMImplementation::isXMLMIMEType("application/x+xml"));
EXPECT_FALSE(DOMImplementation::isXMLMIMEType("application/x-custom;a=a+xml"));
EXPECT_FALSE(DOMImplementation::isXMLMIMEType("application/x-custom;a=a+xml ;"));
EXPECT_FALSE(DOMImplementation::isXMLMIMEType("application/x-custom+xml2"));
EXPECT_FALSE(DOMImplementation::isXMLMIMEType("application/x-custom+xml2 "));
EXPECT_FALSE(DOMImplementation::isXMLMIMEType("application/x-custom+exml"));
EXPECT_FALSE(DOMImplementation::isXMLMIMEType("text/html"));
EXPECT_FALSE(DOMImplementation::isXMLMIMEType("application/xml;"));
EXPECT_FALSE(DOMImplementation::isXMLMIMEType("application/xml "));
EXPECT_FALSE(DOMImplementation::isXMLMIMEType("application/x-what+xml;"));
EXPECT_FALSE(DOMImplementation::isXMLMIMEType("application/x-tra+xML;a=2"));
EXPECT_FALSE(DOMImplementation::isXMLMIMEType("application/+xML"));
EXPECT_FALSE(DOMImplementation::isXMLMIMEType("application/+xml"));
}
}