Bug 1542146 - Apply the change with the option StatementMacros from clang-format-8 r=andi

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D26280

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Sylvestre Ledru 2019-04-05 21:42:17 +00:00
parent 5d41aca733
commit 03fc65347c
249 changed files with 3373 additions and 1853 deletions

View File

@ -17,17 +17,20 @@ static void TestSuffix(const OriginAttributes& attrs) {
EXPECT_EQ(attrs, attrsFromSuffix);
}
TEST(OriginAttributes, Suffix_default) {
TEST(OriginAttributes, Suffix_default)
{
OriginAttributes attrs;
TestSuffix(attrs);
}
TEST(OriginAttributes, Suffix_appId_inIsolatedMozBrowser) {
TEST(OriginAttributes, Suffix_appId_inIsolatedMozBrowser)
{
OriginAttributes attrs(1, true);
TestSuffix(attrs);
}
TEST(OriginAttributes, Suffix_maxAppId_inIsolatedMozBrowser) {
TEST(OriginAttributes, Suffix_maxAppId_inIsolatedMozBrowser)
{
OriginAttributes attrs(4294967295, true);
TestSuffix(attrs);
}

View File

@ -11,7 +11,8 @@
#include "mozilla/CycleCollectedJSContext.h"
#include "mozilla/dom/SimpleGlobalObject.h"
TEST(DOM_Base_ContentUtils, StringifyJSON_EmptyValue) {
TEST(DOM_Base_ContentUtils, StringifyJSON_EmptyValue)
{
JSObject* globalObject = mozilla::dom::SimpleGlobalObject::Create(
mozilla::dom::SimpleGlobalObject::GlobalType::BindingDetail);
mozilla::dom::AutoJSAPI jsAPI;
@ -25,7 +26,8 @@ TEST(DOM_Base_ContentUtils, StringifyJSON_EmptyValue) {
ASSERT_TRUE(serializedValue.EqualsLiteral("null"));
}
TEST(DOM_Base_ContentUtils, StringifyJSON_Object) {
TEST(DOM_Base_ContentUtils, StringifyJSON_Object)
{
JSObject* globalObject = mozilla::dom::SimpleGlobalObject::Create(
mozilla::dom::SimpleGlobalObject::GlobalType::BindingDetail);
mozilla::dom::AutoJSAPI jsAPI;

View File

@ -11,576 +11,709 @@
using mozilla::UniquePtr;
TEST(MimeType, EmptyString) {
TEST(MimeType, EmptyString)
{
const auto in = NS_LITERAL_STRING("");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed) << "Empty string";
ASSERT_FALSE(parsed)
<< "Empty string";
}
TEST(MimeType, JustWhitespace) {
TEST(MimeType, JustWhitespace)
{
const auto in = NS_LITERAL_STRING(" \t\r\n ");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed) << "Just whitespace";
ASSERT_FALSE(parsed)
<< "Just whitespace";
}
TEST(MimeType, JustBackslash) {
TEST(MimeType, JustBackslash)
{
const auto in = NS_LITERAL_STRING("\\");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed) << "Just backslash";
ASSERT_FALSE(parsed)
<< "Just backslash";
}
TEST(MimeType, JustForwardslash) {
TEST(MimeType, JustForwardslash)
{
const auto in = NS_LITERAL_STRING("/");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed) << "Just forward slash";
ASSERT_FALSE(parsed)
<< "Just forward slash";
}
TEST(MimeType, MissingType1) {
TEST(MimeType, MissingType1)
{
const auto in = NS_LITERAL_STRING("/bogus");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed) << "Missing type #1";
ASSERT_FALSE(parsed)
<< "Missing type #1";
}
TEST(MimeType, MissingType2) {
TEST(MimeType, MissingType2)
{
const auto in = NS_LITERAL_STRING(" \r\n\t/bogus");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed) << "Missing type #2";
ASSERT_FALSE(parsed)
<< "Missing type #2";
}
TEST(MimeType, MissingSubtype1) {
TEST(MimeType, MissingSubtype1)
{
const auto in = NS_LITERAL_STRING("bogus");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed) << "Missing subtype #1";
ASSERT_FALSE(parsed)
<< "Missing subtype #1";
}
TEST(MimeType, MissingSubType2) {
TEST(MimeType, MissingSubType2)
{
const auto in = NS_LITERAL_STRING("bogus/");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed) << "Missing subtype #2";
ASSERT_FALSE(parsed)
<< "Missing subtype #2";
}
TEST(MimeType, MissingSubType3) {
TEST(MimeType, MissingSubType3)
{
const auto in = NS_LITERAL_STRING("bogus;");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed) << "Missing subtype #3";
ASSERT_FALSE(parsed)
<< "Missing subtype #3";
}
TEST(MimeType, MissingSubType4) {
TEST(MimeType, MissingSubType4)
{
const auto in = NS_LITERAL_STRING("bogus; \r\n\t");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed) << "Missing subtype #3";
ASSERT_FALSE(parsed)
<< "Missing subtype #3";
}
TEST(MimeType, ExtraForwardSlash) {
TEST(MimeType, ExtraForwardSlash)
{
const auto in = NS_LITERAL_STRING("bogus/bogus/;");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed) << "Extra forward slash";
ASSERT_FALSE(parsed)
<< "Extra forward slash";
}
TEST(MimeType, WhitespaceInType) {
TEST(MimeType, WhitespaceInType)
{
const auto in = NS_LITERAL_STRING("t\re\nx\tt /html");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed) << "Type with whitespace";
ASSERT_FALSE(parsed)
<< "Type with whitespace";
}
TEST(MimeType, WhitespaceInSubtype) {
TEST(MimeType, WhitespaceInSubtype)
{
const auto in = NS_LITERAL_STRING("text/ h\rt\nm\tl");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed) << "Subtype with whitespace";
ASSERT_FALSE(parsed)
<< "Subtype with whitespace";
}
TEST(MimeType, NonAlphanumericMediaType1) {
TEST(MimeType, NonAlphanumericMediaType1)
{
const auto in = NS_LITERAL_STRING("</>");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed) << "Non-alphanumeric media type #1";
ASSERT_FALSE(parsed)
<< "Non-alphanumeric media type #1";
}
TEST(MimeType, NonAlphanumericMediaType2) {
TEST(MimeType, NonAlphanumericMediaType2)
{
const auto in = NS_LITERAL_STRING("(/)");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed) << "Non-alphanumeric media type #2";
ASSERT_FALSE(parsed)
<< "Non-alphanumeric media type #2";
}
TEST(MimeType, NonAlphanumericMediaType3) {
TEST(MimeType, NonAlphanumericMediaType3)
{
const auto in = NS_LITERAL_STRING("{/}");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed) << "Non-alphanumeric media type #3";
ASSERT_FALSE(parsed)
<< "Non-alphanumeric media type #3";
}
TEST(MimeType, NonAlphanumericMediaType4) {
TEST(MimeType, NonAlphanumericMediaType4)
{
const auto in = NS_LITERAL_STRING("\"/\"");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed) << "Non-alphanumeric media type #4";
ASSERT_FALSE(parsed)
<< "Non-alphanumeric media type #4";
}
TEST(MimeType, NonAlphanumericMediaType5) {
TEST(MimeType, NonAlphanumericMediaType5)
{
const auto in = NS_LITERAL_STRING("\0/\0");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed) << "Non-alphanumeric media type #5";
ASSERT_FALSE(parsed)
<< "Non-alphanumeric media type #5";
}
TEST(MimeType, NonAlphanumericMediaType6) {
TEST(MimeType, NonAlphanumericMediaType6)
{
const auto in = NS_LITERAL_STRING("text/html(;doesnot=matter");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed) << "Non-alphanumeric media type #6";
ASSERT_FALSE(parsed)
<< "Non-alphanumeric media type #6";
}
TEST(MimeType, NonLatin1MediaType1) {
TEST(MimeType, NonLatin1MediaType1)
{
const auto in = NS_LITERAL_STRING("ÿ/ÿ");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed) << "Non-latin1 media type #1";
ASSERT_FALSE(parsed)
<< "Non-latin1 media type #1";
}
TEST(MimeType, NonLatin1MediaType2) {
TEST(MimeType, NonLatin1MediaType2)
{
const auto in = NS_LITERAL_STRING(u"\x0100/\x0100");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed) << "Non-latin1 media type #2";
ASSERT_FALSE(parsed)
<< "Non-latin1 media type #2";
}
TEST(MimeType, MultipleParameters) {
TEST(MimeType, MultipleParameters)
{
const auto in =
NS_LITERAL_STRING("text/html;charset=gbk;no=1;charset_=gbk_;yes=2");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsString out;
parsed->Serialize(out);
ASSERT_TRUE(out.Equals(
NS_LITERAL_STRING("text/html;charset=gbk;no=1;charset_=gbk_;yes=2")))
<< "Multiple parameters";
<< "Multiple parameters";
}
TEST(MimeType, DuplicateParameter1) {
TEST(MimeType, DuplicateParameter1)
{
const auto in =
NS_LITERAL_STRING("text/html;charset=gbk;charset=windows-1255");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsString out;
parsed->Serialize(out);
ASSERT_TRUE(out.Equals(NS_LITERAL_STRING("text/html;charset=gbk")))
<< "Duplicate parameter #1";
<< "Duplicate parameter #1";
}
TEST(MimeType, DuplicateParameter2) {
TEST(MimeType, DuplicateParameter2)
{
const auto in = NS_LITERAL_STRING("text/html;charset=();charset=GBK");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsString out;
parsed->Serialize(out);
ASSERT_TRUE(out.Equals(NS_LITERAL_STRING("text/html;charset=\"()\"")))
<< "Duplicate parameter #2";
<< "Duplicate parameter #2";
}
TEST(MimeType, CString) {
TEST(MimeType, CString)
{
const auto in = NS_LITERAL_CSTRING("text/html;charset=();charset=GBK");
UniquePtr<CMimeType> parsed = CMimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsCString out;
parsed->Serialize(out);
ASSERT_TRUE(out.Equals(NS_LITERAL_CSTRING("text/html;charset=\"()\"")))
<< "Duplicate parameter #2";
<< "Duplicate parameter #2";
}
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable : 4819)
#endif
TEST(MimeType, NonAlphanumericParametersAreQuoted) {
TEST(MimeType, NonAlphanumericParametersAreQuoted)
{
const auto in = NS_LITERAL_STRING("text/html;test=\x00FF\\;charset=gbk");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsString out;
parsed->Serialize(out);
ASSERT_TRUE(out.Equals(
NS_LITERAL_STRING("text/html;test=\"\x00FF\\\\\";charset=gbk")))
<< "Non-alphanumeric parameters are quoted";
<< "Non-alphanumeric parameters are quoted";
}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
TEST(MimeType, ParameterQuotedIfHasLeadingWhitespace1) {
TEST(MimeType, ParameterQuotedIfHasLeadingWhitespace1)
{
const auto in = NS_LITERAL_STRING("text/html;charset= g\\\"bk");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\" g\\\\\\\"bk\""))
<< "Parameter is quoted if has leading whitespace #1";
<< "Parameter is quoted if has leading whitespace #1";
}
TEST(MimeType, ParameterQuotedIfHasLeadingWhitespace2) {
TEST(MimeType, ParameterQuotedIfHasLeadingWhitespace2)
{
const auto in = NS_LITERAL_STRING("text/html;charset= \"g\\bk\"");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\" \\\"g\\\\bk\\\"\""))
<< "Parameter is quoted if has leading whitespace #2";
<< "Parameter is quoted if has leading whitespace #2";
}
TEST(MimeType, ParameterQuotedIfHasInternalWhitespace) {
TEST(MimeType, ParameterQuotedIfHasInternalWhitespace)
{
const auto in = NS_LITERAL_STRING("text/html;charset=g \\b\"k");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\"g \\\\b\\\"k\""))
<< "Parameter is quoted if has internal whitespace";
<< "Parameter is quoted if has internal whitespace";
}
TEST(MimeType, ImproperlyQuotedParameter1) {
TEST(MimeType, ImproperlyQuotedParameter1)
{
const auto in = NS_LITERAL_STRING("x/x;test=\"");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("x/x;test=\"\""))
<< "Improperly-quoted parameter is handled properly #1";
<< "Improperly-quoted parameter is handled properly #1";
}
TEST(MimeType, ImproperlyQuotedParameter2) {
TEST(MimeType, ImproperlyQuotedParameter2)
{
const auto in = NS_LITERAL_STRING("x/x;test=\"\\");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("x/x;test=\"\\\\\""))
<< "Improperly-quoted parameter is handled properly #2";
<< "Improperly-quoted parameter is handled properly #2";
}
TEST(MimeType, NonLatin1ParameterIgnored) {
TEST(MimeType, NonLatin1ParameterIgnored)
{
const auto in = NS_LITERAL_STRING(u"x/x;test=\xFFFD;x=x");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("x/x;x=x"))
<< "Non latin-1 parameters are ignored";
<< "Non latin-1 parameters are ignored";
}
TEST(MimeType, ParameterIgnoredIfWhitespaceInName1) {
TEST(MimeType, ParameterIgnoredIfWhitespaceInName1)
{
const auto in = NS_LITERAL_STRING("text/html;charset =gbk;charset=123");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset=123"))
<< "Parameter ignored if whitespace in name #1";
<< "Parameter ignored if whitespace in name #1";
}
TEST(MimeType, ParameterIgnoredIfWhitespaceInName2) {
TEST(MimeType, ParameterIgnoredIfWhitespaceInName2)
{
const auto in = NS_LITERAL_STRING("text/html;cha rset =gbk;charset=123");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset=123"))
<< "Parameter ignored if whitespace in name #2";
<< "Parameter ignored if whitespace in name #2";
}
TEST(MimeType, WhitespaceTrimmed) {
TEST(MimeType, WhitespaceTrimmed)
{
const auto in = NS_LITERAL_STRING(
"\n\r\t text/plain\n\r\t ;\n\r\t charset=123\n\r\t ");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/plain;charset=123"))
<< "Whitespace appropriately ignored";
<< "Whitespace appropriately ignored";
}
TEST(MimeType, WhitespaceOnlyParameterIgnored) {
TEST(MimeType, WhitespaceOnlyParameterIgnored)
{
const auto in = NS_LITERAL_STRING("x/x;x= \r\n\t");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("x/x"))
<< "Whitespace-only parameter is ignored";
<< "Whitespace-only parameter is ignored";
}
TEST(MimeType, IncompleteParameterIgnored1) {
TEST(MimeType, IncompleteParameterIgnored1)
{
const auto in = NS_LITERAL_STRING("x/x;test");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("x/x")) << "Incomplete parameter is ignored #1";
ASSERT_TRUE(out.EqualsLiteral("x/x"))
<< "Incomplete parameter is ignored #1";
}
TEST(MimeType, IncompleteParameterIgnored2) {
TEST(MimeType, IncompleteParameterIgnored2)
{
const auto in = NS_LITERAL_STRING("x/x;test=");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("x/x")) << "Incomplete parameter is ignored #2";
ASSERT_TRUE(out.EqualsLiteral("x/x"))
<< "Incomplete parameter is ignored #2";
}
TEST(MimeType, IncompleteParameterIgnored3) {
TEST(MimeType, IncompleteParameterIgnored3)
{
const auto in = NS_LITERAL_STRING("x/x;test= \r\n\t");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("x/x")) << "Incomplete parameter is ignored #3";
ASSERT_TRUE(out.EqualsLiteral("x/x"))
<< "Incomplete parameter is ignored #3";
}
TEST(MimeType, IncompleteParameterIgnored4) {
TEST(MimeType, IncompleteParameterIgnored4)
{
const auto in = NS_LITERAL_STRING("text/html;test;charset=gbk");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk"))
<< "Incomplete parameter is ignored #4";
<< "Incomplete parameter is ignored #4";
}
TEST(MimeType, IncompleteParameterIgnored5) {
TEST(MimeType, IncompleteParameterIgnored5)
{
const auto in = NS_LITERAL_STRING("text/html;test=;charset=gbk");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk"))
<< "Incomplete parameter is ignored #5";
<< "Incomplete parameter is ignored #5";
}
TEST(MimeType, EmptyParameterIgnored1) {
TEST(MimeType, EmptyParameterIgnored1)
{
const auto in = NS_LITERAL_STRING("text/html ; ; charset=gbk");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk"))
<< "Empty parameter ignored #1";
<< "Empty parameter ignored #1";
}
TEST(MimeType, EmptyParameterIgnored2) {
TEST(MimeType, EmptyParameterIgnored2)
{
const auto in = NS_LITERAL_STRING("text/html;;;;charset=gbk");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk"))
<< "Empty parameter ignored #2";
<< "Empty parameter ignored #2";
}
TEST(MimeType, InvalidParameterIgnored1) {
TEST(MimeType, InvalidParameterIgnored1)
{
const auto in = NS_LITERAL_STRING("text/html;';charset=gbk");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk"))
<< "Invalid parameter ignored #1";
<< "Invalid parameter ignored #1";
}
TEST(MimeType, InvalidParameterIgnored2) {
TEST(MimeType, InvalidParameterIgnored2)
{
const auto in = NS_LITERAL_STRING("text/html;\";charset=gbk;=123; =321");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk"))
<< "Invalid parameter ignored #2";
<< "Invalid parameter ignored #2";
}
TEST(MimeType, InvalidParameterIgnored3) {
TEST(MimeType, InvalidParameterIgnored3)
{
const auto in = NS_LITERAL_STRING("text/html;charset= \"\u007F;charset=GBK");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset=GBK"))
<< "Invalid parameter ignored #3";
<< "Invalid parameter ignored #3";
}
TEST(MimeType, InvalidParameterIgnored4) {
TEST(MimeType, InvalidParameterIgnored4)
{
const auto in = NS_LITERAL_STRING(
"text/html;charset=\"\u007F;charset=foo\";charset=GBK;charset=");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset=GBK"))
<< "Invalid parameter ignored #4";
<< "Invalid parameter ignored #4";
}
TEST(MimeType, SingleQuotes1) {
TEST(MimeType, SingleQuotes1)
{
const auto in = NS_LITERAL_STRING("text/html;charset='gbk'");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset='gbk'"))
<< "Single quotes handled properly #1";
<< "Single quotes handled properly #1";
}
TEST(MimeType, SingleQuotes2) {
TEST(MimeType, SingleQuotes2)
{
const auto in = NS_LITERAL_STRING("text/html;charset='gbk");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset='gbk"))
<< "Single quotes handled properly #2";
<< "Single quotes handled properly #2";
}
TEST(MimeType, SingleQuotes3) {
TEST(MimeType, SingleQuotes3)
{
const auto in = NS_LITERAL_STRING("text/html;charset=gbk'");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk'"))
<< "Single quotes handled properly #3";
<< "Single quotes handled properly #3";
}
TEST(MimeType, SingleQuotes4) {
TEST(MimeType, SingleQuotes4)
{
const auto in = NS_LITERAL_STRING("text/html;charset=';charset=GBK");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset='"))
<< "Single quotes handled properly #4";
<< "Single quotes handled properly #4";
}
TEST(MimeType, SingleQuotes5) {
TEST(MimeType, SingleQuotes5)
{
const auto in = NS_LITERAL_STRING("text/html;charset=''';charset=GBK");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset='''"))
<< "Single quotes handled properly #5";
<< "Single quotes handled properly #5";
}
TEST(MimeType, DoubleQuotes1) {
TEST(MimeType, DoubleQuotes1)
{
const auto in = NS_LITERAL_STRING("text/html;charset=\"gbk\"");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk"))
<< "Double quotes handled properly #1";
<< "Double quotes handled properly #1";
}
TEST(MimeType, DoubleQuotes2) {
TEST(MimeType, DoubleQuotes2)
{
const auto in = NS_LITERAL_STRING("text/html;charset=\"gbk");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk"))
<< "Double quotes handled properly #2";
<< "Double quotes handled properly #2";
}
TEST(MimeType, DoubleQuotes3) {
TEST(MimeType, DoubleQuotes3)
{
const auto in = NS_LITERAL_STRING("text/html;charset=gbk\"");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\"gbk\\\"\""))
<< "Double quotes handled properly #3";
<< "Double quotes handled properly #3";
}
TEST(MimeType, DoubleQuotes4) {
TEST(MimeType, DoubleQuotes4)
{
const auto in = NS_LITERAL_STRING("text/html;charset=\" gbk\"");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\" gbk\""))
<< "Double quotes handled properly #4";
<< "Double quotes handled properly #4";
}
TEST(MimeType, DoubleQuotes5) {
TEST(MimeType, DoubleQuotes5)
{
const auto in = NS_LITERAL_STRING("text/html;charset=\"gbk \"");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\"gbk \""))
<< "Double quotes handled properly #5";
<< "Double quotes handled properly #5";
}
TEST(MimeType, DoubleQuotes6) {
TEST(MimeType, DoubleQuotes6)
{
const auto in = NS_LITERAL_STRING("text/html;charset=\"\\ gbk\"");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\" gbk\""))
<< "Double quotes handled properly #6";
<< "Double quotes handled properly #6";
}
TEST(MimeType, DoubleQuotes7) {
TEST(MimeType, DoubleQuotes7)
{
const auto in = NS_LITERAL_STRING("text/html;charset=\"\\g\\b\\k\"");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk"))
<< "Double quotes handled properly #7";
<< "Double quotes handled properly #7";
}
TEST(MimeType, DoubleQuotes8) {
TEST(MimeType, DoubleQuotes8)
{
const auto in = NS_LITERAL_STRING("text/html;charset=\"gbk\"x");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset=gbk"))
<< "Double quotes handled properly #8";
<< "Double quotes handled properly #8";
}
TEST(MimeType, DoubleQuotes9) {
TEST(MimeType, DoubleQuotes9)
{
const auto in = NS_LITERAL_STRING("text/html;charset=\"\";charset=GBK");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\"\""))
<< "Double quotes handled properly #9";
<< "Double quotes handled properly #9";
}
TEST(MimeType, DoubleQuotes10) {
TEST(MimeType, DoubleQuotes10)
{
const auto in = NS_LITERAL_STRING("text/html;charset=\";charset=GBK");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\";charset=GBK\""))
<< "Double quotes handled properly #10";
<< "Double quotes handled properly #10";
}
TEST(MimeType, UnexpectedCodePoints) {
TEST(MimeType, UnexpectedCodePoints)
{
const auto in = NS_LITERAL_STRING("text/html;charset={gbk}");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\"{gbk}\""))
<< "Unexpected code points handled properly";
<< "Unexpected code points handled properly";
}
TEST(MimeType, LongTypesSubtypesAccepted) {
TEST(MimeType, LongTypesSubtypesAccepted)
{
const auto in = NS_LITERAL_STRING(
"012345678901234567890123456789012345678901234567890123456789012345678901"
"2345678901234567890123456789012345678901234567890123456789/"
"012345678901234567890123456789012345678901234567890123456789012345678901"
"2345678901234567890123456789012345678901234567890123456789");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.Equals(in)) << "Long type/subtype accepted";
ASSERT_TRUE(out.Equals(in))
<< "Long type/subtype accepted";
}
TEST(MimeType, LongParametersAccepted) {
TEST(MimeType, LongParametersAccepted)
{
const auto in = NS_LITERAL_STRING(
"text/"
"html;"
@ -588,13 +721,16 @@ TEST(MimeType, LongParametersAccepted) {
"2345678901234567890123456789012345678901234567890123456789=x;charset="
"gbk");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.Equals(in)) << "Long parameters accepted";
ASSERT_TRUE(out.Equals(in))
<< "Long parameters accepted";
}
TEST(MimeType, AllValidCharactersAccepted1) {
TEST(MimeType, AllValidCharactersAccepted1)
{
const auto in = NS_LITERAL_STRING(
u"x/x;x=\"\t "
u"!\\\"#$%&'()*+,-./"
@ -613,23 +749,28 @@ TEST(MimeType, AllValidCharactersAccepted1) {
u"\u00EE\u00EF\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7\u00F8"
u"\u00F9\u00FA\u00FB\u00FC\u00FD\u00FE\u00FF\"");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.Equals(in)) << "All valid characters accepted #1";
ASSERT_TRUE(out.Equals(in))
<< "All valid characters accepted #1";
}
TEST(MimeType, CaseNormalization1) {
TEST(MimeType, CaseNormalization1)
{
const auto in = NS_LITERAL_STRING("TEXT/PLAIN;CHARSET=TEST");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/plain;charset=TEST"))
<< "Case normalized properly #1";
<< "Case normalized properly #1";
}
TEST(MimeType, CaseNormalization2) {
TEST(MimeType, CaseNormalization2)
{
const auto in = NS_LITERAL_STRING(
"!#$%&'*+-.^_`|~"
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz/"
@ -639,7 +780,8 @@ TEST(MimeType, CaseNormalization2) {
"%&'*+-.^_`|~"
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral(
@ -650,25 +792,29 @@ TEST(MimeType, CaseNormalization2) {
".^_`|~0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz=!#$"
"%&'*+-.^_`|~"
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"))
<< "Case normalized properly #2";
<< "Case normalized properly #2";
}
TEST(MimeType, LegacyCommentSyntax1) {
TEST(MimeType, LegacyCommentSyntax1)
{
const auto in = NS_LITERAL_STRING("text/html;charset=gbk(");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;charset=\"gbk(\""))
<< "Legacy comment syntax #1";
<< "Legacy comment syntax #1";
}
TEST(MimeType, LegacyCommentSyntax2) {
TEST(MimeType, LegacyCommentSyntax2)
{
const auto in = NS_LITERAL_STRING("text/html;x=(;charset=gbk");
UniquePtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed) << "Parsing succeeded";
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
parsed->Serialize(out);
ASSERT_TRUE(out.EqualsLiteral("text/html;x=\"(\";charset=gbk"))
<< "Legacy comment syntax #2";
<< "Legacy comment syntax #2";
}

View File

@ -18,7 +18,8 @@ void ConvertBufToPlainText(nsString &aConBuf, int aFlag) {
}
// Test for ASCII with format=flowed; delsp=yes
TEST(PlainTextSerializer, ASCIIWithFlowedDelSp) {
TEST(PlainTextSerializer, ASCIIWithFlowedDelSp)
{
nsString test;
nsString result;
@ -42,11 +43,12 @@ TEST(PlainTextSerializer, ASCIIWithFlowedDelSp) {
"Firefox \r\nFirefox Firefox Firefox\r\n");
ASSERT_TRUE(test.Equals(result))
<< "Wrong HTML to ASCII text serialization with format=flowed; delsp=yes";
<< "Wrong HTML to ASCII text serialization with format=flowed; delsp=yes";
}
// Test for CJK with format=flowed; delsp=yes
TEST(PlainTextSerializer, CJKWithFlowedDelSp) {
TEST(PlainTextSerializer, CJKWithFlowedDelSp)
{
nsString test;
nsString result;
@ -74,11 +76,12 @@ TEST(PlainTextSerializer, CJKWithFlowedDelSp) {
result.AppendLiteral("\r\n");
ASSERT_TRUE(test.Equals(result))
<< "Wrong HTML to CJK text serialization with format=flowed; delsp=yes";
<< "Wrong HTML to CJK text serialization with format=flowed; delsp=yes";
}
// Test for CJK with DisallowLineBreaking
TEST(PlainTextSerializer, CJKWithDisallowLineBreaking) {
TEST(PlainTextSerializer, CJKWithDisallowLineBreaking)
{
nsString test;
nsString result;
@ -103,11 +106,12 @@ TEST(PlainTextSerializer, CJKWithDisallowLineBreaking) {
result.AppendLiteral("\r\n");
ASSERT_TRUE(test.Equals(result))
<< "Wrong HTML to CJK text serialization with OutputDisallowLineBreaking";
<< "Wrong HTML to CJK text serialization with OutputDisallowLineBreaking";
}
// Test for ASCII with format=flowed; and quoted lines in preformatted span.
TEST(PlainTextSerializer, PreformatFlowedQuotes) {
TEST(PlainTextSerializer, PreformatFlowedQuotes)
{
nsString test;
nsString result;
@ -134,12 +138,14 @@ TEST(PlainTextSerializer, PreformatFlowedQuotes) {
">> Firefox Firefox Firefox Firefox \r\n"
">> Firefox Firefox Firefox Firefox\r\n");
ASSERT_TRUE(test.Equals(result)) << "Wrong HTML to ASCII text serialization "
"with format=flowed; and quoted "
"lines";
ASSERT_TRUE(test.Equals(result))
<< "Wrong HTML to ASCII text serialization "
"with format=flowed; and quoted "
"lines";
}
TEST(PlainTextSerializer, PrettyPrintedHtml) {
TEST(PlainTextSerializer, PrettyPrintedHtml)
{
nsString test;
test.AppendLiteral("<html>" NS_LINEBREAK "<body>" NS_LINEBREAK
" first<br>" NS_LINEBREAK " second<br>" NS_LINEBREAK
@ -147,10 +153,11 @@ TEST(PlainTextSerializer, PrettyPrintedHtml) {
ConvertBufToPlainText(test, 0);
ASSERT_TRUE(test.EqualsLiteral("first" NS_LINEBREAK "second" NS_LINEBREAK))
<< "Wrong prettyprinted html to text serialization";
<< "Wrong prettyprinted html to text serialization";
}
TEST(PlainTextSerializer, PreElement) {
TEST(PlainTextSerializer, PreElement)
{
nsString test;
test.AppendLiteral("<html>" NS_LINEBREAK "<body>" NS_LINEBREAK
"<pre>" NS_LINEBREAK " first" NS_LINEBREAK
@ -160,10 +167,11 @@ TEST(PlainTextSerializer, PreElement) {
ConvertBufToPlainText(test, 0);
ASSERT_TRUE(test.EqualsLiteral(" first" NS_LINEBREAK
" second" NS_LINEBREAK NS_LINEBREAK))
<< "Wrong prettyprinted html to text serialization";
<< "Wrong prettyprinted html to text serialization";
}
TEST(PlainTextSerializer, BlockElement) {
TEST(PlainTextSerializer, BlockElement)
{
nsString test;
test.AppendLiteral("<html>" NS_LINEBREAK "<body>" NS_LINEBREAK
"<div>" NS_LINEBREAK " first" NS_LINEBREAK
@ -173,10 +181,11 @@ TEST(PlainTextSerializer, BlockElement) {
ConvertBufToPlainText(test, 0);
ASSERT_TRUE(test.EqualsLiteral("first" NS_LINEBREAK "second" NS_LINEBREAK))
<< "Wrong prettyprinted html to text serialization";
<< "Wrong prettyprinted html to text serialization";
}
TEST(PlainTextSerializer, PreWrapElementForThunderbird) {
TEST(PlainTextSerializer, PreWrapElementForThunderbird)
{
// This test examines the magic pre-wrap setup that Thunderbird relies on.
nsString test;
test.AppendLiteral(
@ -193,15 +202,16 @@ TEST(PlainTextSerializer, PreWrapElementForThunderbird) {
" first" NS_LINEBREAK "line is" NS_LINEBREAK "too long" NS_LINEBREAK
" second" NS_LINEBREAK "line is" NS_LINEBREAK "even" NS_LINEBREAK
"loooonger" NS_LINEBREAK NS_LINEBREAK NS_LINEBREAK))
<< "Wrong prettyprinted html to text serialization";
<< "Wrong prettyprinted html to text serialization";
}
TEST(PlainTextSerializer, Simple) {
TEST(PlainTextSerializer, Simple)
{
nsString test;
test.AppendLiteral(
"<html><base>base</base><head><span>span</span></head>"
"<body>body</body></html>");
ConvertBufToPlainText(test, 0);
ASSERT_TRUE(test.EqualsLiteral("basespanbody"))
<< "Wrong html to text serialization";
<< "Wrong html to text serialization";
}

View File

@ -8,7 +8,8 @@
#include "XPathGenerator.h"
#include "nsString.h"
TEST(TestXPathGenerator, TestQuoteArgumentWithoutQuote) {
TEST(TestXPathGenerator, TestQuoteArgumentWithoutQuote)
{
nsAutoString arg;
arg.AssignLiteral(u"testing");
@ -21,7 +22,8 @@ TEST(TestXPathGenerator, TestQuoteArgumentWithoutQuote) {
ASSERT_TRUE(expectedResult.Equals(result));
}
TEST(TestXPathGenerator, TestQuoteArgumentWithSingleQuote) {
TEST(TestXPathGenerator, TestQuoteArgumentWithSingleQuote)
{
nsAutoString arg;
arg.AssignLiteral(u"\'testing\'");
@ -34,7 +36,8 @@ TEST(TestXPathGenerator, TestQuoteArgumentWithSingleQuote) {
ASSERT_TRUE(expectedResult.Equals(result));
}
TEST(TestXPathGenerator, TestQuoteArgumentWithDoubleQuote) {
TEST(TestXPathGenerator, TestQuoteArgumentWithDoubleQuote)
{
nsAutoString arg;
arg.AssignLiteral(u"\"testing\"");
@ -47,7 +50,8 @@ TEST(TestXPathGenerator, TestQuoteArgumentWithDoubleQuote) {
ASSERT_TRUE(expectedResult.Equals(result));
}
TEST(TestXPathGenerator, TestQuoteArgumentWithSingleAndDoubleQuote) {
TEST(TestXPathGenerator, TestQuoteArgumentWithSingleAndDoubleQuote)
{
nsAutoString arg;
arg.AssignLiteral(u"\'testing\"");
@ -63,7 +67,8 @@ TEST(TestXPathGenerator, TestQuoteArgumentWithSingleAndDoubleQuote) {
}
TEST(TestXPathGenerator,
TestQuoteArgumentWithDoubleQuoteAndASequenceOfSingleQuote) {
TestQuoteArgumentWithDoubleQuoteAndASequenceOfSingleQuote)
{
nsAutoString arg;
arg.AssignLiteral(u"\'\'\'\'testing\"");
@ -79,7 +84,8 @@ TEST(TestXPathGenerator,
}
TEST(TestXPathGenerator,
TestQuoteArgumentWithDoubleQuoteAndTwoSequencesOfSingleQuote) {
TestQuoteArgumentWithDoubleQuoteAndTwoSequencesOfSingleQuote)
{
nsAutoString arg;
arg.AssignLiteral(u"\'\'\'\'testing\'\'\'\'\'\'\"");
@ -96,7 +102,8 @@ TEST(TestXPathGenerator,
}
TEST(TestXPathGenerator,
TestQuoteArgumentWithDoubleQuoteAndTwoSequencesOfSingleQuoteInMiddle) {
TestQuoteArgumentWithDoubleQuoteAndTwoSequencesOfSingleQuoteInMiddle)
{
nsAutoString arg;
arg.AssignLiteral(u"t\'\'\'\'estin\'\'\'\'\'\'\"g");
@ -112,7 +119,8 @@ TEST(TestXPathGenerator,
ASSERT_TRUE(expectedResult.Equals(result));
}
TEST(TestXPathGenerator, TestEscapeNameWithNormalCharacters) {
TEST(TestXPathGenerator, TestEscapeNameWithNormalCharacters)
{
nsAutoString arg;
arg.AssignLiteral(u"testing");
@ -125,7 +133,8 @@ TEST(TestXPathGenerator, TestEscapeNameWithNormalCharacters) {
ASSERT_TRUE(expectedResult.Equals(result));
}
TEST(TestXPathGenerator, TestEscapeNameWithSpecialCharacters) {
TEST(TestXPathGenerator, TestEscapeNameWithSpecialCharacters)
{
nsAutoString arg;
arg.AssignLiteral(u"^testing!");

View File

@ -720,7 +720,8 @@ class LabData : public SimpleImage<float> {
/*
* From RGB24.
*/
TEST(ImageBitmapColorUtils, RGB24ToBGR24_) {
TEST(ImageBitmapColorUtils, RGB24ToBGR24_)
{
const RGB24Data srcData;
const BGR24Data dstData;
SimpleImage<uint8_t> result_(srcData.mWidth, srcData.mHeight,
@ -745,7 +746,8 @@ TEST(ImageBitmapColorUtils, RGB24ToBGR24_) {
}
}
TEST(ImageBitmapColorUtils, RGB24ToRGBA32) {
TEST(ImageBitmapColorUtils, RGB24ToRGBA32)
{
const RGB24Data srcData;
const RGBA32Data dstData;
SimpleImage<uint8_t> result_(srcData.mWidth, srcData.mHeight,
@ -773,7 +775,8 @@ TEST(ImageBitmapColorUtils, RGB24ToRGBA32) {
}
}
TEST(ImageBitmapColorUtils, RGB24ToBGRA32) {
TEST(ImageBitmapColorUtils, RGB24ToBGRA32)
{
const RGB24Data srcData;
const BGRA32Data dstData;
@ -845,7 +848,8 @@ TEST(ImageBitmapColorUtils, RGB24ToBGRA32) {
// gbaPixel[0], rgbaPixel[1], rgbaPixel[2], rgbaPixel[3]);
//}
TEST(ImageBitmapColorUtils, RGB24ToYUV444P) {
TEST(ImageBitmapColorUtils, RGB24ToYUV444P)
{
const RGB24Data srcData;
const YUV444PData dstData;
@ -872,7 +876,8 @@ TEST(ImageBitmapColorUtils, RGB24ToYUV444P) {
}
}
TEST(ImageBitmapColorUtils, RGB24ToYUV422P) {
TEST(ImageBitmapColorUtils, RGB24ToYUV422P)
{
const RGB24Data srcData;
const YUV422PData dstData;
@ -904,7 +909,8 @@ TEST(ImageBitmapColorUtils, RGB24ToYUV422P) {
}
}
TEST(ImageBitmapColorUtils, RGB24ToYUV420P) {
TEST(ImageBitmapColorUtils, RGB24ToYUV420P)
{
const RGB24Data srcData;
const YUV420PData dstData;
@ -937,7 +943,8 @@ TEST(ImageBitmapColorUtils, RGB24ToYUV420P) {
}
}
TEST(ImageBitmapColorUtils, RGB24ToNV12) {
TEST(ImageBitmapColorUtils, RGB24ToNV12)
{
const RGB24Data srcData;
const NV12Data dstData;
@ -968,7 +975,8 @@ TEST(ImageBitmapColorUtils, RGB24ToNV12) {
}
}
TEST(ImageBitmapColorUtils, RGB24ToNV21) {
TEST(ImageBitmapColorUtils, RGB24ToNV21)
{
const RGB24Data srcData;
const NV21Data dstData;
@ -999,7 +1007,8 @@ TEST(ImageBitmapColorUtils, RGB24ToNV21) {
}
}
TEST(ImageBitmapColorUtils, RGB24ToHSV) {
TEST(ImageBitmapColorUtils, RGB24ToHSV)
{
const RGB24Data srcData;
const HSVData dstData;
@ -1022,7 +1031,8 @@ TEST(ImageBitmapColorUtils, RGB24ToHSV) {
}
}
TEST(ImageBitmapColorUtils, RGB24ToLab) {
TEST(ImageBitmapColorUtils, RGB24ToLab)
{
const RGB24Data srcData;
const LabData dstData;
@ -1045,7 +1055,8 @@ TEST(ImageBitmapColorUtils, RGB24ToLab) {
}
}
TEST(ImageBitmapColorUtils, RGB24ToGray8) {
TEST(ImageBitmapColorUtils, RGB24ToGray8)
{
const RGB24Data srcData;
const GrayData dstData;
@ -1068,7 +1079,8 @@ TEST(ImageBitmapColorUtils, RGB24ToGray8) {
* From BGR24.
*/
TEST(ImageBitmapColorUtils, BGR24ToRGB24_) {
TEST(ImageBitmapColorUtils, BGR24ToRGB24_)
{
const BGR24Data srcData;
const RGB24Data dstData;
SimpleImage<uint8_t> result_(srcData.mWidth, srcData.mHeight,
@ -1093,7 +1105,8 @@ TEST(ImageBitmapColorUtils, BGR24ToRGB24_) {
}
}
TEST(ImageBitmapColorUtils, BGR24ToRGBA32) {
TEST(ImageBitmapColorUtils, BGR24ToRGBA32)
{
const BGR24Data srcData;
const RGBA32Data dstData;
SimpleImage<uint8_t> result_(srcData.mWidth, srcData.mHeight,
@ -1121,7 +1134,8 @@ TEST(ImageBitmapColorUtils, BGR24ToRGBA32) {
}
}
TEST(ImageBitmapColorUtils, BGR24ToBGRA32) {
TEST(ImageBitmapColorUtils, BGR24ToBGRA32)
{
const BGR24Data srcData;
const BGRA32Data dstData;
SimpleImage<uint8_t> result_(srcData.mWidth, srcData.mHeight,
@ -1149,7 +1163,8 @@ TEST(ImageBitmapColorUtils, BGR24ToBGRA32) {
}
}
TEST(ImageBitmapColorUtils, BGR24ToYUV444P) {
TEST(ImageBitmapColorUtils, BGR24ToYUV444P)
{
const BGR24Data srcData;
const YUV444PData dstData;
@ -1176,7 +1191,8 @@ TEST(ImageBitmapColorUtils, BGR24ToYUV444P) {
}
}
TEST(ImageBitmapColorUtils, BGR24ToYUV422P) {
TEST(ImageBitmapColorUtils, BGR24ToYUV422P)
{
const BGR24Data srcData;
const YUV422PData dstData;
@ -1208,7 +1224,8 @@ TEST(ImageBitmapColorUtils, BGR24ToYUV422P) {
}
}
TEST(ImageBitmapColorUtils, BGR24ToYUV420P) {
TEST(ImageBitmapColorUtils, BGR24ToYUV420P)
{
const BGR24Data srcData;
const YUV420PData dstData;
@ -1241,7 +1258,8 @@ TEST(ImageBitmapColorUtils, BGR24ToYUV420P) {
}
}
TEST(ImageBitmapColorUtils, BGR24ToNV12) {
TEST(ImageBitmapColorUtils, BGR24ToNV12)
{
const BGR24Data srcData;
const NV12Data dstData;
@ -1272,7 +1290,8 @@ TEST(ImageBitmapColorUtils, BGR24ToNV12) {
}
}
TEST(ImageBitmapColorUtils, BGR24ToNV21) {
TEST(ImageBitmapColorUtils, BGR24ToNV21)
{
const BGR24Data srcData;
const NV21Data dstData;
@ -1303,7 +1322,8 @@ TEST(ImageBitmapColorUtils, BGR24ToNV21) {
}
}
TEST(ImageBitmapColorUtils, BGR24ToHSV) {
TEST(ImageBitmapColorUtils, BGR24ToHSV)
{
const BGR24Data srcData;
const HSVData dstData;
@ -1326,7 +1346,8 @@ TEST(ImageBitmapColorUtils, BGR24ToHSV) {
}
}
TEST(ImageBitmapColorUtils, BGR24ToLab) {
TEST(ImageBitmapColorUtils, BGR24ToLab)
{
const BGR24Data srcData;
const LabData dstData;
@ -1349,7 +1370,8 @@ TEST(ImageBitmapColorUtils, BGR24ToLab) {
}
}
TEST(ImageBitmapColorUtils, BGR24ToGray8) {
TEST(ImageBitmapColorUtils, BGR24ToGray8)
{
const BGR24Data srcData;
const GrayData dstData;
@ -1371,7 +1393,8 @@ TEST(ImageBitmapColorUtils, BGR24ToGray8) {
/*
* From RGBA32.
*/
TEST(ImageBitmapColorUtils, RGBA32ToRGB24) {
TEST(ImageBitmapColorUtils, RGBA32ToRGB24)
{
const RGBA32Data srcData;
const RGB24Data dstData;
SimpleImage<uint8_t> result_(srcData.mWidth, srcData.mHeight,
@ -1396,7 +1419,8 @@ TEST(ImageBitmapColorUtils, RGBA32ToRGB24) {
}
}
TEST(ImageBitmapColorUtils, RGBA32ToBGR24) {
TEST(ImageBitmapColorUtils, RGBA32ToBGR24)
{
const RGBA32Data srcData;
const BGR24Data dstData;
SimpleImage<uint8_t> result_(srcData.mWidth, srcData.mHeight,
@ -1421,7 +1445,8 @@ TEST(ImageBitmapColorUtils, RGBA32ToBGR24) {
}
}
TEST(ImageBitmapColorUtils, RGBA32ToYUV444P) {
TEST(ImageBitmapColorUtils, RGBA32ToYUV444P)
{
const RGBA32Data srcData;
const YUV444PData dstData;
@ -1448,7 +1473,8 @@ TEST(ImageBitmapColorUtils, RGBA32ToYUV444P) {
}
}
TEST(ImageBitmapColorUtils, RGBA32ToYUV422P) {
TEST(ImageBitmapColorUtils, RGBA32ToYUV422P)
{
const RGBA32Data srcData;
const YUV422PData dstData;
@ -1480,7 +1506,8 @@ TEST(ImageBitmapColorUtils, RGBA32ToYUV422P) {
}
}
TEST(ImageBitmapColorUtils, RGBA32ToYUV420P) {
TEST(ImageBitmapColorUtils, RGBA32ToYUV420P)
{
const RGBA32Data srcData;
const YUV420PData dstData;
@ -1513,7 +1540,8 @@ TEST(ImageBitmapColorUtils, RGBA32ToYUV420P) {
}
}
TEST(ImageBitmapColorUtils, RGBA32ToNV12) {
TEST(ImageBitmapColorUtils, RGBA32ToNV12)
{
const RGBA32Data srcData;
const NV12Data dstData;
@ -1544,7 +1572,8 @@ TEST(ImageBitmapColorUtils, RGBA32ToNV12) {
}
}
TEST(ImageBitmapColorUtils, RGBA32ToNV21) {
TEST(ImageBitmapColorUtils, RGBA32ToNV21)
{
const RGBA32Data srcData;
const NV21Data dstData;
@ -1575,7 +1604,8 @@ TEST(ImageBitmapColorUtils, RGBA32ToNV21) {
}
}
TEST(ImageBitmapColorUtils, RGBA32ToHSV) {
TEST(ImageBitmapColorUtils, RGBA32ToHSV)
{
const RGBA32Data srcData;
const HSVData dstData;
@ -1598,7 +1628,8 @@ TEST(ImageBitmapColorUtils, RGBA32ToHSV) {
}
}
TEST(ImageBitmapColorUtils, RGBA32ToLab) {
TEST(ImageBitmapColorUtils, RGBA32ToLab)
{
const RGBA32Data srcData;
const LabData dstData;
@ -1621,7 +1652,8 @@ TEST(ImageBitmapColorUtils, RGBA32ToLab) {
}
}
TEST(ImageBitmapColorUtils, RGBA32ToGray8) {
TEST(ImageBitmapColorUtils, RGBA32ToGray8)
{
const RGBA32Data srcData;
const GrayData dstData;
@ -1643,7 +1675,8 @@ TEST(ImageBitmapColorUtils, RGBA32ToGray8) {
/*
* From BGRA32.
*/
TEST(ImageBitmapColorUtils, BGRA32ToRGB24) {
TEST(ImageBitmapColorUtils, BGRA32ToRGB24)
{
const BGRA32Data srcData;
const RGB24Data dstData;
SimpleImage<uint8_t> result_(srcData.mWidth, srcData.mHeight,
@ -1668,7 +1701,8 @@ TEST(ImageBitmapColorUtils, BGRA32ToRGB24) {
}
}
TEST(ImageBitmapColorUtils, BGRA32ToBGR24) {
TEST(ImageBitmapColorUtils, BGRA32ToBGR24)
{
const BGRA32Data srcData;
const BGR24Data dstData;
SimpleImage<uint8_t> result_(srcData.mWidth, srcData.mHeight,
@ -1693,7 +1727,8 @@ TEST(ImageBitmapColorUtils, BGRA32ToBGR24) {
}
}
TEST(ImageBitmapColorUtils, BGRA32ToYUV444P) {
TEST(ImageBitmapColorUtils, BGRA32ToYUV444P)
{
const BGRA32Data srcData;
const YUV444PData dstData;
@ -1720,7 +1755,8 @@ TEST(ImageBitmapColorUtils, BGRA32ToYUV444P) {
}
}
TEST(ImageBitmapColorUtils, BGRA32ToYUV422P) {
TEST(ImageBitmapColorUtils, BGRA32ToYUV422P)
{
const BGRA32Data srcData;
const YUV422PData dstData;
@ -1752,7 +1788,8 @@ TEST(ImageBitmapColorUtils, BGRA32ToYUV422P) {
}
}
TEST(ImageBitmapColorUtils, BGRA32ToYUV420P) {
TEST(ImageBitmapColorUtils, BGRA32ToYUV420P)
{
const BGRA32Data srcData;
const YUV420PData dstData;
@ -1785,7 +1822,8 @@ TEST(ImageBitmapColorUtils, BGRA32ToYUV420P) {
}
}
TEST(ImageBitmapColorUtils, BGRA32ToNV12) {
TEST(ImageBitmapColorUtils, BGRA32ToNV12)
{
const BGRA32Data srcData;
const NV12Data dstData;
@ -1816,7 +1854,8 @@ TEST(ImageBitmapColorUtils, BGRA32ToNV12) {
}
}
TEST(ImageBitmapColorUtils, BGRA32ToNV21) {
TEST(ImageBitmapColorUtils, BGRA32ToNV21)
{
const BGRA32Data srcData;
const NV21Data dstData;
@ -1847,7 +1886,8 @@ TEST(ImageBitmapColorUtils, BGRA32ToNV21) {
}
}
TEST(ImageBitmapColorUtils, BGRA32ToHSV) {
TEST(ImageBitmapColorUtils, BGRA32ToHSV)
{
const BGRA32Data srcData;
const HSVData dstData;
@ -1870,7 +1910,8 @@ TEST(ImageBitmapColorUtils, BGRA32ToHSV) {
}
}
TEST(ImageBitmapColorUtils, BGRA32ToLab) {
TEST(ImageBitmapColorUtils, BGRA32ToLab)
{
const BGRA32Data srcData;
const LabData dstData;
@ -1893,7 +1934,8 @@ TEST(ImageBitmapColorUtils, BGRA32ToLab) {
}
}
TEST(ImageBitmapColorUtils, BGRA32ToGray8) {
TEST(ImageBitmapColorUtils, BGRA32ToGray8)
{
const BGRA32Data srcData;
const GrayData dstData;
@ -1915,7 +1957,8 @@ TEST(ImageBitmapColorUtils, BGRA32ToGray8) {
/*
* From YUV444P.
*/
TEST(ImageBitmapColorUtils, YUV444PToRGB24) {
TEST(ImageBitmapColorUtils, YUV444PToRGB24)
{
const YUV444PData srcData;
const RGBA32DataFromYUV444PData dstData;
SimpleImage<uint8_t> result_(srcData.mYWidth, srcData.mYHeight, 3);
@ -1941,7 +1984,8 @@ TEST(ImageBitmapColorUtils, YUV444PToRGB24) {
}
}
TEST(ImageBitmapColorUtils, YUV444PToBGR24) {
TEST(ImageBitmapColorUtils, YUV444PToBGR24)
{
const YUV444PData srcData;
const RGBA32DataFromYUV444PData dstData;
SimpleImage<uint8_t> result_(srcData.mYWidth, srcData.mYHeight, 3);
@ -1967,7 +2011,8 @@ TEST(ImageBitmapColorUtils, YUV444PToBGR24) {
}
}
TEST(ImageBitmapColorUtils, YUV444PToRGBA32) {
TEST(ImageBitmapColorUtils, YUV444PToRGBA32)
{
const YUV444PData srcData;
const RGBA32DataFromYUV444PData dstData;
SimpleImage<uint8_t> result_(srcData.mYWidth, srcData.mYHeight,
@ -1997,7 +2042,8 @@ TEST(ImageBitmapColorUtils, YUV444PToRGBA32) {
}
}
TEST(ImageBitmapColorUtils, YUV444PToBGRA32) {
TEST(ImageBitmapColorUtils, YUV444PToBGRA32)
{
const YUV444PData srcData;
const RGBA32DataFromYUV444PData dstData;
SimpleImage<uint8_t> result_(srcData.mYWidth, srcData.mYHeight,
@ -2027,7 +2073,8 @@ TEST(ImageBitmapColorUtils, YUV444PToBGRA32) {
}
}
TEST(ImageBitmapColorUtils, YUV444PToGray8) {
TEST(ImageBitmapColorUtils, YUV444PToGray8)
{
const YUV444PData srcData;
SimpleImage<uint8_t> result_(srcData.mYWidth, srcData.mYHeight, 1);
@ -2049,7 +2096,8 @@ TEST(ImageBitmapColorUtils, YUV444PToGray8) {
/*
* From YUV422P.
*/
TEST(ImageBitmapColorUtils, YUV422PToRGB24) {
TEST(ImageBitmapColorUtils, YUV422PToRGB24)
{
const YUV422PData srcData;
const RGBA32DataFromYUV422PData dstData;
SimpleImage<uint8_t> result_(srcData.mYWidth, srcData.mYHeight, 3);
@ -2075,7 +2123,8 @@ TEST(ImageBitmapColorUtils, YUV422PToRGB24) {
}
}
TEST(ImageBitmapColorUtils, YUV422PToBGR24) {
TEST(ImageBitmapColorUtils, YUV422PToBGR24)
{
const YUV422PData srcData;
const RGBA32DataFromYUV422PData dstData;
SimpleImage<uint8_t> result_(srcData.mYWidth, srcData.mYHeight, 3);
@ -2101,7 +2150,8 @@ TEST(ImageBitmapColorUtils, YUV422PToBGR24) {
}
}
TEST(ImageBitmapColorUtils, YUV422PToRGBA32) {
TEST(ImageBitmapColorUtils, YUV422PToRGBA32)
{
const YUV422PData srcData;
const RGBA32DataFromYUV422PData dstData;
SimpleImage<uint8_t> result_(srcData.mYWidth, srcData.mYHeight,
@ -2131,7 +2181,8 @@ TEST(ImageBitmapColorUtils, YUV422PToRGBA32) {
}
}
TEST(ImageBitmapColorUtils, YUV422PToBGRA32) {
TEST(ImageBitmapColorUtils, YUV422PToBGRA32)
{
const YUV422PData srcData;
const RGBA32DataFromYUV422PData dstData;
SimpleImage<uint8_t> result_(srcData.mYWidth, srcData.mYHeight,
@ -2161,7 +2212,8 @@ TEST(ImageBitmapColorUtils, YUV422PToBGRA32) {
}
}
TEST(ImageBitmapColorUtils, YUV422PToGray8) {
TEST(ImageBitmapColorUtils, YUV422PToGray8)
{
const YUV422PData srcData;
SimpleImage<uint8_t> result_(srcData.mYWidth, srcData.mYHeight, 1);
@ -2183,7 +2235,8 @@ TEST(ImageBitmapColorUtils, YUV422PToGray8) {
/*
* From YUV420P.
*/
TEST(ImageBitmapColorUtils, YUV420PToRGB24) {
TEST(ImageBitmapColorUtils, YUV420PToRGB24)
{
const YUV420PData srcData;
const RGBA32DataFromYUV420PData dstData;
SimpleImage<uint8_t> result_(srcData.mYWidth, srcData.mYHeight, 3);
@ -2209,7 +2262,8 @@ TEST(ImageBitmapColorUtils, YUV420PToRGB24) {
}
}
TEST(ImageBitmapColorUtils, YUV420PToBGR24) {
TEST(ImageBitmapColorUtils, YUV420PToBGR24)
{
const YUV420PData srcData;
const RGBA32DataFromYUV420PData dstData;
SimpleImage<uint8_t> result_(srcData.mYWidth, srcData.mYHeight, 3);
@ -2235,7 +2289,8 @@ TEST(ImageBitmapColorUtils, YUV420PToBGR24) {
}
}
TEST(ImageBitmapColorUtils, YUV420PToRGBA32) {
TEST(ImageBitmapColorUtils, YUV420PToRGBA32)
{
const YUV420PData srcData;
const RGBA32DataFromYUV420PData dstData;
SimpleImage<uint8_t> result_(srcData.mYWidth, srcData.mYHeight,
@ -2265,7 +2320,8 @@ TEST(ImageBitmapColorUtils, YUV420PToRGBA32) {
}
}
TEST(ImageBitmapColorUtils, YUV420PToBGRA32) {
TEST(ImageBitmapColorUtils, YUV420PToBGRA32)
{
const YUV420PData srcData;
const RGBA32DataFromYUV420PData dstData;
SimpleImage<uint8_t> result_(srcData.mYWidth, srcData.mYHeight,
@ -2295,7 +2351,8 @@ TEST(ImageBitmapColorUtils, YUV420PToBGRA32) {
}
}
TEST(ImageBitmapColorUtils, YUV420PToGray8) {
TEST(ImageBitmapColorUtils, YUV420PToGray8)
{
const YUV420PData srcData;
SimpleImage<uint8_t> result_(srcData.mYWidth, srcData.mYHeight, 1);
@ -2317,7 +2374,8 @@ TEST(ImageBitmapColorUtils, YUV420PToGray8) {
/*
* From NV12.
*/
TEST(ImageBitmapColorUtils, NV12ToRGB24) {
TEST(ImageBitmapColorUtils, NV12ToRGB24)
{
const NV12Data srcData;
const RGBA32DataFromYUV420PData dstData;
SimpleImage<uint8_t> result_(srcData.mYWidth, srcData.mYHeight, 3);
@ -2342,7 +2400,8 @@ TEST(ImageBitmapColorUtils, NV12ToRGB24) {
}
}
TEST(ImageBitmapColorUtils, NV12ToBGR24) {
TEST(ImageBitmapColorUtils, NV12ToBGR24)
{
const NV12Data srcData;
const RGBA32DataFromYUV420PData dstData;
SimpleImage<uint8_t> result_(srcData.mYWidth, srcData.mYHeight, 3);
@ -2367,7 +2426,8 @@ TEST(ImageBitmapColorUtils, NV12ToBGR24) {
}
}
TEST(ImageBitmapColorUtils, NV12ToRGBA32) {
TEST(ImageBitmapColorUtils, NV12ToRGBA32)
{
const NV12Data srcData;
const RGBA32DataFromYUV420PData dstData;
SimpleImage<uint8_t> result_(srcData.mYWidth, srcData.mYHeight,
@ -2396,7 +2456,8 @@ TEST(ImageBitmapColorUtils, NV12ToRGBA32) {
}
}
TEST(ImageBitmapColorUtils, NV12ToBGRA32) {
TEST(ImageBitmapColorUtils, NV12ToBGRA32)
{
const NV12Data srcData;
const RGBA32DataFromYUV420PData dstData;
SimpleImage<uint8_t> result_(srcData.mYWidth, srcData.mYHeight,
@ -2425,7 +2486,8 @@ TEST(ImageBitmapColorUtils, NV12ToBGRA32) {
}
}
TEST(ImageBitmapColorUtils, NV12ToGray8) {
TEST(ImageBitmapColorUtils, NV12ToGray8)
{
const NV12Data srcData;
SimpleImage<uint8_t> result_(srcData.mYWidth, srcData.mYHeight, 1);
@ -2446,7 +2508,8 @@ TEST(ImageBitmapColorUtils, NV12ToGray8) {
/*
* From NV21.
*/
TEST(ImageBitmapColorUtils, NV21ToRGB24) {
TEST(ImageBitmapColorUtils, NV21ToRGB24)
{
const NV21Data srcData;
const RGBA32DataFromYUV420PData dstData;
SimpleImage<uint8_t> result_(srcData.mYWidth, srcData.mYHeight, 3);
@ -2471,7 +2534,8 @@ TEST(ImageBitmapColorUtils, NV21ToRGB24) {
}
}
TEST(ImageBitmapColorUtils, NV21ToBGR24) {
TEST(ImageBitmapColorUtils, NV21ToBGR24)
{
const NV21Data srcData;
const RGBA32DataFromYUV420PData dstData;
SimpleImage<uint8_t> result_(srcData.mYWidth, srcData.mYHeight, 3);
@ -2496,7 +2560,8 @@ TEST(ImageBitmapColorUtils, NV21ToBGR24) {
}
}
TEST(ImageBitmapColorUtils, NV21ToRGBA32) {
TEST(ImageBitmapColorUtils, NV21ToRGBA32)
{
const NV21Data srcData;
const RGBA32DataFromYUV420PData dstData;
SimpleImage<uint8_t> result_(srcData.mYWidth, srcData.mYHeight,
@ -2525,7 +2590,8 @@ TEST(ImageBitmapColorUtils, NV21ToRGBA32) {
}
}
TEST(ImageBitmapColorUtils, NV21ToBGRA32) {
TEST(ImageBitmapColorUtils, NV21ToBGRA32)
{
const NV21Data srcData;
const RGBA32DataFromYUV420PData dstData;
SimpleImage<uint8_t> result_(srcData.mYWidth, srcData.mYHeight,
@ -2554,7 +2620,8 @@ TEST(ImageBitmapColorUtils, NV21ToBGRA32) {
}
}
TEST(ImageBitmapColorUtils, NV21ToGray8) {
TEST(ImageBitmapColorUtils, NV21ToGray8)
{
const NV21Data srcData;
SimpleImage<uint8_t> result_(srcData.mYWidth, srcData.mYHeight, 1);
@ -2575,7 +2642,8 @@ TEST(ImageBitmapColorUtils, NV21ToGray8) {
/*
* From HSV.
*/
TEST(ImageBitmapColorUtils, HSVToRGB24) {
TEST(ImageBitmapColorUtils, HSVToRGB24)
{
const HSVData srcData;
const RGB24Data dstData;
SimpleImage<uint8_t> result_(srcData.mWidth, srcData.mHeight,
@ -2596,7 +2664,8 @@ TEST(ImageBitmapColorUtils, HSVToRGB24) {
}
}
TEST(ImageBitmapColorUtils, HSVToBGR24) {
TEST(ImageBitmapColorUtils, HSVToBGR24)
{
const HSVData srcData;
const BGR24Data dstData;
SimpleImage<uint8_t> result_(srcData.mWidth, srcData.mHeight,
@ -2617,7 +2686,8 @@ TEST(ImageBitmapColorUtils, HSVToBGR24) {
}
}
TEST(ImageBitmapColorUtils, HSVToRGBA32) {
TEST(ImageBitmapColorUtils, HSVToRGBA32)
{
const HSVData srcData;
const RGBA32Data dstData;
SimpleImage<uint8_t> result_(srcData.mWidth, srcData.mHeight,
@ -2638,7 +2708,8 @@ TEST(ImageBitmapColorUtils, HSVToRGBA32) {
}
}
TEST(ImageBitmapColorUtils, HSVToBGRA32) {
TEST(ImageBitmapColorUtils, HSVToBGRA32)
{
const HSVData srcData;
const BGRA32Data dstData;
SimpleImage<uint8_t> result_(srcData.mWidth, srcData.mHeight,
@ -2662,7 +2733,8 @@ TEST(ImageBitmapColorUtils, HSVToBGRA32) {
/*
* From Lab.
*/
TEST(ImageBitmapColorUtils, LabToRGB24) {
TEST(ImageBitmapColorUtils, LabToRGB24)
{
const LabData srcData;
const RGB24Data dstData;
SimpleImage<uint8_t> result_(srcData.mWidth, srcData.mHeight,
@ -2685,7 +2757,8 @@ TEST(ImageBitmapColorUtils, LabToRGB24) {
}
}
TEST(ImageBitmapColorUtils, LabToBGR24) {
TEST(ImageBitmapColorUtils, LabToBGR24)
{
const LabData srcData;
const BGR24Data dstData;
SimpleImage<uint8_t> result_(srcData.mWidth, srcData.mHeight,
@ -2708,7 +2781,8 @@ TEST(ImageBitmapColorUtils, LabToBGR24) {
}
}
TEST(ImageBitmapColorUtils, LabToRGBA32) {
TEST(ImageBitmapColorUtils, LabToRGBA32)
{
const LabData srcData;
const RGBA32Data dstData;
SimpleImage<uint8_t> result_(srcData.mWidth, srcData.mHeight,
@ -2731,7 +2805,8 @@ TEST(ImageBitmapColorUtils, LabToRGBA32) {
}
}
TEST(ImageBitmapColorUtils, LabToBGRA32) {
TEST(ImageBitmapColorUtils, LabToBGRA32)
{
const LabData srcData;
const BGRA32Data dstData;
SimpleImage<uint8_t> result_(srcData.mWidth, srcData.mHeight,

View File

@ -69,21 +69,25 @@ void CheckGeneratedOriginKey(nsIPrincipal* aPrincipal, const char* aOriginKey) {
} // namespace
TEST(LocalStorage, OriginKey) {
TEST(LocalStorage, OriginKey)
{
// Check the system principal.
nsCOMPtr<nsIScriptSecurityManager> secMan =
nsContentUtils::GetSecurityManager();
ASSERT_TRUE(secMan) << "GetSecurityManager() should not fail";
ASSERT_TRUE(secMan)
<< "GetSecurityManager() should not fail";
nsCOMPtr<nsIPrincipal> principal;
secMan->GetSystemPrincipal(getter_AddRefs(principal));
ASSERT_TRUE(principal) << "GetSystemPrincipal() should not fail";
ASSERT_TRUE(principal)
<< "GetSystemPrincipal() should not fail";
CheckGeneratedOriginKey(principal, nullptr);
// Check the null principal.
principal = NullPrincipal::CreateWithoutOriginAttributes();
ASSERT_TRUE(principal) << "CreateWithoutOriginAttributes() should not fail";
ASSERT_TRUE(principal)
<< "CreateWithoutOriginAttributes() should not fail";
CheckGeneratedOriginKey(principal, nullptr);
@ -106,7 +110,8 @@ TEST(LocalStorage, OriginKey) {
for (const auto& test : tests) {
principal = GetCodebasePrincipal(test.mSpec);
ASSERT_TRUE(principal) << "GetCodebasePrincipal() should not fail";
ASSERT_TRUE(principal)
<< "GetCodebasePrincipal() should not fail";
CheckGeneratedOriginKey(principal, test.mOriginKey);
}

View File

@ -45,7 +45,8 @@ static void TestMultiWriterQueueST(const int loops) {
}
}
TEST(MultiWriterQueue, SingleThreaded) {
TEST(MultiWriterQueue, SingleThreaded)
{
TestMultiWriterQueueST<1>(10);
TestMultiWriterQueueST<2>(10);
TestMultiWriterQueueST<4>(10);
@ -155,7 +156,8 @@ static void TestMultiWriterQueueMT(int aWriterThreads, int aReaderThreads,
q.AllocatedBuffersStats().mWatermark);
}
TEST(MultiWriterQueue, MultiWriterSingleReader) {
TEST(MultiWriterQueue, MultiWriterSingleReader)
{
// Small BufferSize, to exercize the buffer management code.
TestMultiWriterQueueMT<
MultiWriterQueue<int, 10, MultiWriterQueueReaderLocking_None>>(
@ -214,7 +216,8 @@ TEST(MultiWriterQueue, MultiWriterSingleReader) {
// MultiWriterQueueReaderLocking_None>>(64, 2, 2*1024*1024);
}
TEST(MultiWriterQueue, MultiWriterMultiReader) {
TEST(MultiWriterQueue, MultiWriterMultiReader)
{
static_assert(
mozilla::IsSame<MultiWriterQueue<int, 10>,
MultiWriterQueue<
@ -343,7 +346,8 @@ struct DequeWrapperMT : DequeWrapperMW {
}
};
TEST(MultiWriterQueue, nsDequeBenchmark) {
TEST(MultiWriterQueue, nsDequeBenchmark)
{
TestMultiWriterQueueMT<DequeWrapperST>(1, 0, 2 * 1024 * 1024,
"DequeWrapperST ");

View File

@ -14,7 +14,8 @@
using RN8 = mozilla::RollingNumber<uint8_t>;
TEST(RollingNumber, Value) {
TEST(RollingNumber, Value)
{
// Value type should reflect template argument.
static_assert(mozilla::IsSame<RN8::ValueType, uint8_t>::value, "");
@ -40,7 +41,8 @@ TEST(RollingNumber, Value) {
EXPECT_EQ(0, n42.Value());
}
TEST(RollingNumber, Operations) {
TEST(RollingNumber, Operations)
{
RN8 n;
EXPECT_EQ(0, n.Value());
@ -90,7 +92,8 @@ TEST(RollingNumber, Operations) {
EXPECT_EQ(10, n.Value());
}
TEST(RollingNumber, Comparisons) {
TEST(RollingNumber, Comparisons)
{
uint8_t i = 0;
do {
RN8 n{i};

View File

@ -42,8 +42,8 @@ void test_for_number_of_channels(const uint32_t channels) {
for (uint32_t i = 0; i < samples; i++) {
ASSERT_TRUE(fromCallback[i] == 1.0)
<< "Difference at " << i << " (" << fromCallback[i] << " != " << 1.0
<< ")\n";
<< "Difference at " << i << " (" << fromCallback[i] << " != " << 1.0
<< ")\n";
}
ASSERT_TRUE(b.Fill(other.data(), FRAMES) == 128);
@ -51,7 +51,8 @@ void test_for_number_of_channels(const uint32_t channels) {
ASSERT_TRUE(b.Empty(mBuffer) == 0);
}
TEST(AudioBuffers, Test) {
TEST(AudioBuffers, Test)
{
for (uint32_t ch = 1; ch <= 8; ++ch) {
test_for_number_of_channels(ch);
}

View File

@ -75,15 +75,20 @@ static void TestAudioCompactor(size_t aBytes) {
EXPECT_LE(slop, maxSlop) << "allowed too much allocation slop";
}
TEST(Media, AudioCompactor_4000) { TestAudioCompactor(4000); }
TEST(Media, AudioCompactor_4000)
{ TestAudioCompactor(4000); }
TEST(Media, AudioCompactor_4096) { TestAudioCompactor(4096); }
TEST(Media, AudioCompactor_4096)
{ TestAudioCompactor(4096); }
TEST(Media, AudioCompactor_5000) { TestAudioCompactor(5000); }
TEST(Media, AudioCompactor_5000)
{ TestAudioCompactor(5000); }
TEST(Media, AudioCompactor_5256) { TestAudioCompactor(5256); }
TEST(Media, AudioCompactor_5256)
{ TestAudioCompactor(5256); }
TEST(Media, AudioCompactor_NativeCopy) {
TEST(Media, AudioCompactor_NativeCopy)
{
const uint32_t channels = 2;
const size_t srcBytes = 32;
const uint32_t srcSamples = srcBytes / sizeof(AudioDataValue);

View File

@ -482,7 +482,8 @@ void AddDevices(MockCubeb* mock, uint32_t device_count,
}
#ifndef ANDROID
TEST(CubebDeviceEnumerator, EnumerateSimple) {
TEST(CubebDeviceEnumerator, EnumerateSimple)
{
// It looks like we're leaking this object, but in fact it will be freed by
// gecko sometime later: `cubeb_destroy` is called when layout statics are
// shutdown and we cast back to a MockCubeb* and call the dtor.
@ -518,7 +519,8 @@ TEST(CubebDeviceEnumerator, EnumerateSimple) {
}
#else // building for Android, which has no device enumeration support
TEST(CubebDeviceEnumerator, EnumerateAndroid) {
TEST(CubebDeviceEnumerator, EnumerateAndroid)
{
MockCubeb* mock = new MockCubeb();
mozilla::CubebUtils::ForceSetCubebContext(mock->AsCubebContext());
@ -547,7 +549,8 @@ TEST(CubebDeviceEnumerator, EnumerateAndroid) {
}
#endif
TEST(CubebDeviceEnumerator, ForceNullCubebContext) {
TEST(CubebDeviceEnumerator, ForceNullCubebContext)
{
mozilla::CubebUtils::ForceSetCubebContext(nullptr);
RefPtr<CubebDeviceEnumerator> enumerator =
CubebDeviceEnumerator::GetInstance();
@ -566,7 +569,8 @@ TEST(CubebDeviceEnumerator, ForceNullCubebContext) {
CubebDeviceEnumerator::Shutdown();
}
TEST(CubebDeviceEnumerator, DeviceInfoFromId) {
TEST(CubebDeviceEnumerator, DeviceInfoFromId)
{
MockCubeb* mock = new MockCubeb();
mozilla::CubebUtils::ForceSetCubebContext(mock->AsCubebContext());
@ -604,7 +608,8 @@ TEST(CubebDeviceEnumerator, DeviceInfoFromId) {
CubebDeviceEnumerator::Shutdown();
}
TEST(CubebDeviceEnumerator, DeviceInfoFromName) {
TEST(CubebDeviceEnumerator, DeviceInfoFromName)
{
MockCubeb* mock = new MockCubeb();
mozilla::CubebUtils::ForceSetCubebContext(mock->AsCubebContext());

View File

@ -70,7 +70,8 @@ void FillBuffer(AudioDataValue* aBuffer, uint32_t aLength,
}
}
TEST(AudioMixer, Test) {
TEST(AudioMixer, Test)
{
const uint32_t CHANNEL_LENGTH = 256;
const uint32_t AUDIO_RATE = 44100;
MixerConsumer consumer;

View File

@ -34,7 +34,7 @@ void IsSequence(std::unique_ptr<int16_t[]> aBuffer, uint32_t aSize,
uint32_t aStart = 0) {
for (uint32_t i = 0; i < aSize; i++) {
ASSERT_TRUE(aBuffer[i] == static_cast<int64_t>(aStart + i))
<< "Buffer is not a sequence at offset " << i << std::endl;
<< "Buffer is not a sequence at offset " << i << std::endl;
}
// Buffer is a sequence.
}
@ -42,13 +42,14 @@ void IsSequence(std::unique_ptr<int16_t[]> aBuffer, uint32_t aSize,
void Zero(std::unique_ptr<int16_t[]> aBuffer, uint32_t aSize) {
for (uint32_t i = 0; i < aSize; i++) {
ASSERT_TRUE(aBuffer[i] == 0)
<< "Buffer is not null at offset " << i << std::endl;
<< "Buffer is not null at offset " << i << std::endl;
}
}
double sine(uint32_t aPhase) { return sin(aPhase * 2 * M_PI * 440 / 44100); }
TEST(AudioPacketizer, Test) {
TEST(AudioPacketizer, Test)
{
for (int16_t channels = 1; channels < 2; channels++) {
// Test that the packetizer returns zero on underrun
{

View File

@ -224,7 +224,8 @@ void TestDownmixStereo() {
delete[] output;
}
TEST(AudioSegment, Test) {
TEST(AudioSegment, Test)
{
TestInterleaveAndConvert<float, float>();
TestInterleaveAndConvert<float, int16_t>();
TestInterleaveAndConvert<int16_t, float>();

View File

@ -59,7 +59,8 @@ static bool TestOpusInit(int aChannels, int aSamplingRate) {
return encoder.TestOpusRawCreation(aChannels, aSamplingRate);
}
TEST(OpusAudioTrackEncoder, InitRaw) {
TEST(OpusAudioTrackEncoder, InitRaw)
{
// Expect false with 0 or negative channels of input signal.
EXPECT_FALSE(TestOpusInit(0, 16000));
EXPECT_FALSE(TestOpusInit(-1, 16000));
@ -89,7 +90,8 @@ TEST(OpusAudioTrackEncoder, InitRaw) {
EXPECT_FALSE(TestOpusInit(2, 200000));
}
TEST(OpusAudioTrackEncoder, Init) {
TEST(OpusAudioTrackEncoder, Init)
{
{
// The encoder does not normally recieve enough info from null data to
// init. However, multiple attempts to do so, with sufficiently long
@ -175,7 +177,8 @@ static int TestOpusResampler(int aChannels, int aSamplingRate) {
return encoder.TestGetOutputSampleRate();
}
TEST(OpusAudioTrackEncoder, Resample) {
TEST(OpusAudioTrackEncoder, Resample)
{
// Sampling rates of data to be fed to Opus encoder, should remain unchanged
// if it is one of Opus supported rates (8000, 12000, 16000, 24000 and 48000
// (kHz)) at initialization.
@ -190,7 +193,8 @@ TEST(OpusAudioTrackEncoder, Resample) {
EXPECT_TRUE(TestOpusResampler(1, 44100) == 48000);
}
TEST(OpusAudioTrackEncoder, FetchMetadata) {
TEST(OpusAudioTrackEncoder, FetchMetadata)
{
const int32_t channels = 1;
const int32_t sampleRate = 44100;
TestOpusTrackEncoder encoder;
@ -204,7 +208,8 @@ TEST(OpusAudioTrackEncoder, FetchMetadata) {
EXPECT_EQ(sampleRate, opusMeta->mSamplingFrequency);
}
TEST(OpusAudioTrackEncoder, FrameEncode) {
TEST(OpusAudioTrackEncoder, FrameEncode)
{
const int32_t channels = 1;
const int32_t sampleRate = 44100;
TestOpusTrackEncoder encoder;

View File

@ -10,7 +10,8 @@
using namespace mozilla;
TEST(BitWriter, BitWriter) {
TEST(BitWriter, BitWriter)
{
RefPtr<MediaByteBuffer> test = new MediaByteBuffer();
BitWriter b(test);
b.WriteBit(false);
@ -49,7 +50,8 @@ TEST(BitWriter, BitWriter) {
EXPECT_EQ(length, BitReader::GetBitLength(test));
}
TEST(BitWriter, SPS) {
TEST(BitWriter, SPS)
{
uint8_t sps_pps[] = {0x01, 0x4d, 0x40, 0x0c, 0xff, 0xe1, 0x00, 0x1b, 0x67,
0x4d, 0x40, 0x0c, 0xe8, 0x80, 0x80, 0x9d, 0x80, 0xb5,
0x01, 0x01, 0x01, 0x40, 0x00, 0x00, 0x03, 0x00, 0x40,

View File

@ -8,7 +8,8 @@
using namespace mozilla;
TEST(BlankVideoDataCreator, ShouldNotOverflow) {
TEST(BlankVideoDataCreator, ShouldNotOverflow)
{
RefPtr<MediaRawData> mrd = new MediaRawData();
const uint32_t width = 1;
const uint32_t height = 1;
@ -17,7 +18,8 @@ TEST(BlankVideoDataCreator, ShouldNotOverflow) {
EXPECT_NE(data.get(), nullptr);
}
TEST(BlankVideoDataCreator, ShouldOverflow) {
TEST(BlankVideoDataCreator, ShouldOverflow)
{
RefPtr<MediaRawData> mrd = new MediaRawData();
const uint32_t width = UINT_MAX;
const uint32_t height = UINT_MAX;

View File

@ -6,7 +6,8 @@
#include "gtest/gtest.h"
#include "BufferReader.h"
TEST(BufferReader, ReaderCursor) {
TEST(BufferReader, ReaderCursor)
{
// Allocate a buffer and create a BufferReader.
const size_t BUFFER_SIZE = 10;
uint8_t buffer[BUFFER_SIZE] = {0};

View File

@ -1030,54 +1030,64 @@ class CDMStorageTest {
UniquePtr<CallbackProxy> mCallback;
}; // class CDMStorageTest
TEST(GeckoMediaPlugins, CDMStorageGetNodeId) {
TEST(GeckoMediaPlugins, CDMStorageGetNodeId)
{
RefPtr<CDMStorageTest> runner = new CDMStorageTest();
runner->DoTest(&CDMStorageTest::TestGetNodeId);
}
TEST(GeckoMediaPlugins, CDMStorageBasic) {
TEST(GeckoMediaPlugins, CDMStorageBasic)
{
RefPtr<CDMStorageTest> runner = new CDMStorageTest();
runner->DoTest(&CDMStorageTest::TestBasicStorage);
}
TEST(GeckoMediaPlugins, CDMStorageForgetThisSite) {
TEST(GeckoMediaPlugins, CDMStorageForgetThisSite)
{
RefPtr<CDMStorageTest> runner = new CDMStorageTest();
runner->DoTest(&CDMStorageTest::TestForgetThisSite);
}
TEST(GeckoMediaPlugins, CDMStorageClearRecentHistory1) {
TEST(GeckoMediaPlugins, CDMStorageClearRecentHistory1)
{
RefPtr<CDMStorageTest> runner = new CDMStorageTest();
runner->DoTest(&CDMStorageTest::TestClearRecentHistory1);
}
TEST(GeckoMediaPlugins, CDMStorageClearRecentHistory2) {
TEST(GeckoMediaPlugins, CDMStorageClearRecentHistory2)
{
RefPtr<CDMStorageTest> runner = new CDMStorageTest();
runner->DoTest(&CDMStorageTest::TestClearRecentHistory2);
}
TEST(GeckoMediaPlugins, CDMStorageClearRecentHistory3) {
TEST(GeckoMediaPlugins, CDMStorageClearRecentHistory3)
{
RefPtr<CDMStorageTest> runner = new CDMStorageTest();
runner->DoTest(&CDMStorageTest::TestClearRecentHistory3);
}
TEST(GeckoMediaPlugins, CDMStorageCrossOrigin) {
TEST(GeckoMediaPlugins, CDMStorageCrossOrigin)
{
RefPtr<CDMStorageTest> runner = new CDMStorageTest();
runner->DoTest(&CDMStorageTest::TestCrossOriginStorage);
}
TEST(GeckoMediaPlugins, CDMStoragePrivateBrowsing) {
TEST(GeckoMediaPlugins, CDMStoragePrivateBrowsing)
{
RefPtr<CDMStorageTest> runner = new CDMStorageTest();
runner->DoTest(&CDMStorageTest::TestPBStorage);
}
#if defined(XP_WIN)
TEST(GeckoMediaPlugins, GMPOutputProtection) {
TEST(GeckoMediaPlugins, GMPOutputProtection)
{
RefPtr<CDMStorageTest> runner = new CDMStorageTest();
runner->DoTest(&CDMStorageTest::TestOutputProtection);
}
#endif
TEST(GeckoMediaPlugins, CDMStorageLongRecordNames) {
TEST(GeckoMediaPlugins, CDMStorageLongRecordNames)
{
RefPtr<CDMStorageTest> runner = new CDMStorageTest();
runner->DoTest(&CDMStorageTest::TestLongRecordNames);
}

View File

@ -14,7 +14,8 @@ struct A {
int mValue;
};
TEST(DataMutex, Basic) {
TEST(DataMutex, Basic)
{
{
DataMutex<uint32_t> i(1, "1");
auto x = i.Lock();

View File

@ -198,14 +198,16 @@ void GMPTestRunner::DoTest(
monitor.AwaitFinished();
}
TEST(GeckoMediaPlugins, GMPTestCodec) {
TEST(GeckoMediaPlugins, GMPTestCodec)
{
RefPtr<GMPTestRunner> runner = new GMPTestRunner();
runner->DoTest(&GMPTestRunner::RunTestGMPTestCodec1);
runner->DoTest(&GMPTestRunner::RunTestGMPTestCodec2);
runner->DoTest(&GMPTestRunner::RunTestGMPTestCodec3);
}
TEST(GeckoMediaPlugins, GMPCrossOrigin) {
TEST(GeckoMediaPlugins, GMPCrossOrigin)
{
RefPtr<GMPTestRunner> runner = new GMPTestRunner();
runner->DoTest(&GMPTestRunner::RunTestGMPCrossOrigin1);
runner->DoTest(&GMPTestRunner::RunTestGMPCrossOrigin2);

View File

@ -105,7 +105,8 @@ class GMPRemoveTest : public nsIObserver, public GMPVideoDecoderCallbackProxy {
/*
* Simple test that the plugin is deleted when forcibly removed and deleted.
*/
TEST(GeckoMediaPlugins, RemoveAndDeleteForcedSimple) {
TEST(GeckoMediaPlugins, RemoveAndDeleteForcedSimple)
{
RefPtr<GMPRemoveTest> test(new GMPRemoveTest());
test->Setup();
@ -116,7 +117,8 @@ TEST(GeckoMediaPlugins, RemoveAndDeleteForcedSimple) {
/*
* Simple test that the plugin is deleted when deferred deletion is allowed.
*/
TEST(GeckoMediaPlugins, RemoveAndDeleteDeferredSimple) {
TEST(GeckoMediaPlugins, RemoveAndDeleteDeferredSimple)
{
RefPtr<GMPRemoveTest> test(new GMPRemoveTest());
test->Setup();
@ -128,7 +130,8 @@ TEST(GeckoMediaPlugins, RemoveAndDeleteDeferredSimple) {
* Test that the plugin is unavailable immediately after a forced
* RemoveAndDelete, and that the plugin is deleted afterwards.
*/
TEST(GeckoMediaPlugins, RemoveAndDeleteForcedInUse) {
TEST(GeckoMediaPlugins, RemoveAndDeleteForcedInUse)
{
RefPtr<GMPRemoveTest> test(new GMPRemoveTest());
test->Setup();
@ -152,7 +155,8 @@ TEST(GeckoMediaPlugins, RemoveAndDeleteForcedInUse) {
* Test that the plugin is still usable after a deferred RemoveAndDelete, and
* that the plugin is deleted afterwards.
*/
TEST(GeckoMediaPlugins, RemoveAndDeleteDeferredInUse) {
TEST(GeckoMediaPlugins, RemoveAndDeleteDeferredInUse)
{
RefPtr<GMPRemoveTest> test(new GMPRemoveTest());
test->Setup();

View File

@ -28,7 +28,8 @@ void TestSplitAt(const char* aInput, const char* aDelims,
}
}
TEST(GeckoMediaPlugins, TestSplitAt) {
TEST(GeckoMediaPlugins, TestSplitAt)
{
{
const char* input = "1,2,3,4";
const char* delims = ",";
@ -55,7 +56,8 @@ TEST(GeckoMediaPlugins, TestSplitAt) {
}
}
TEST(GeckoMediaPlugins, ToHexString) {
TEST(GeckoMediaPlugins, ToHexString)
{
struct Test {
nsTArray<uint8_t> bytes;
string hex;

View File

@ -90,7 +90,8 @@ RefPtr<MediaDevice> MakeSpeakerDevice(const nsString& aName,
/* Verify that when an audio input device name contains the video input device
* name the video device group id is updated to become equal to the audio
* device group id. */
TEST(TestGroupId, MatchInput_PartOfName) {
TEST(TestGroupId, MatchInput_PartOfName)
{
MediaManager::MediaDeviceSet devices;
devices.AppendElement(
@ -110,7 +111,8 @@ TEST(TestGroupId, MatchInput_PartOfName) {
/* Verify that when an audio input device name is the same as the video input
* device name the video device group id is updated to become equal to the audio
* device group id. */
TEST(TestGroupId, MatchInput_FullName) {
TEST(TestGroupId, MatchInput_FullName)
{
MediaManager::MediaDeviceSet devices;
devices.AppendElement(
@ -128,7 +130,8 @@ TEST(TestGroupId, MatchInput_FullName) {
/* Verify that when an audio input device name does not contain the video input
* device name the video device group id does not change. */
TEST(TestGroupId, NoMatchInput) {
TEST(TestGroupId, NoMatchInput)
{
MediaManager::MediaDeviceSet devices;
nsString Cam_Model_GroupId = NS_LITERAL_STRING("Cam-Model-GroupId");
@ -149,7 +152,8 @@ TEST(TestGroupId, NoMatchInput) {
/* Verify that when more that one audio input and more than one audio output
* device name contain the video input device name the video device group id
* does not change. */
TEST(TestGroupId, NoMatch_TwoIdenticalDevices) {
TEST(TestGroupId, NoMatch_TwoIdenticalDevices)
{
MediaManager::MediaDeviceSet devices;
nsString Cam_Model_GroupId = NS_LITERAL_STRING("Cam-Model-GroupId");
@ -184,7 +188,8 @@ TEST(TestGroupId, NoMatch_TwoIdenticalDevices) {
* input device name the video device group id is not updated by audio input
* device group id but it continues looking at audio output devices where it
* finds a match so video input group id is updated by audio output group id. */
TEST(TestGroupId, Match_TwoIdenticalInputsMatchOutput) {
TEST(TestGroupId, Match_TwoIdenticalInputsMatchOutput)
{
MediaManager::MediaDeviceSet devices;
nsString Cam_Model_GroupId = NS_LITERAL_STRING("Cam-Model-GroupId");
@ -211,7 +216,8 @@ TEST(TestGroupId, Match_TwoIdenticalInputsMatchOutput) {
/* Verify that when more that one audio input and more than one audio output
* device names contain the video input device name the video device group id
* does not change. */
TEST(TestGroupId, NoMatch_ThreeIdenticalDevices) {
TEST(TestGroupId, NoMatch_ThreeIdenticalDevices)
{
MediaManager::MediaDeviceSet devices;
nsString Cam_Model_GroupId = NS_LITERAL_STRING("Cam-Model-GroupId");
@ -251,7 +257,8 @@ TEST(TestGroupId, NoMatch_ThreeIdenticalDevices) {
/* Verify that when an audio output device name contains the video input device
* name the video device group id is updated to become equal to the audio
* device group id. */
TEST(TestGroupId, MatchOutput) {
TEST(TestGroupId, MatchOutput)
{
MediaManager::MediaDeviceSet devices;
devices.AppendElement(
@ -274,7 +281,8 @@ TEST(TestGroupId, MatchOutput) {
/* Verify that when an audio input device name is the same as audio output
* device and video input device name the video device group id is updated to
* become equal to the audio input device group id. */
TEST(TestGroupId, InputOutputSameName) {
TEST(TestGroupId, InputOutputSameName)
{
MediaManager::MediaDeviceSet devices;
devices.AppendElement(
@ -297,7 +305,8 @@ TEST(TestGroupId, InputOutputSameName) {
/* Verify that when an audio input device name contains the video input device
* and the audio input group id is an empty string, the video device group id
* is updated to become equal to the audio device group id. */
TEST(TestGroupId, InputEmptyGroupId) {
TEST(TestGroupId, InputEmptyGroupId)
{
MediaManager::MediaDeviceSet devices;
devices.AppendElement(
@ -316,7 +325,8 @@ TEST(TestGroupId, InputEmptyGroupId) {
/* Verify that when an audio output device name contains the video input device
* and the audio output group id is an empty string, the video device group id
* is updated to become equal to the audio output device group id. */
TEST(TestGroupId, OutputEmptyGroupId) {
TEST(TestGroupId, OutputEmptyGroupId)
{
MediaManager::MediaDeviceSet devices;
devices.AppendElement(

View File

@ -28,7 +28,8 @@ media::IntervalSet<uint8_t> CreateByteIntervalSet(int32_t aStart,
return test;
}
TEST(IntervalSet, Constructors) {
TEST(IntervalSet, Constructors)
{
const int32_t start = 1;
const int32_t end = 2;
const int32_t fuzz = 0;
@ -73,7 +74,8 @@ media::TimeIntervals CreateTimeIntervals(int32_t aStart, int32_t aEnd) {
return test;
}
TEST(IntervalSet, TimeIntervalsConstructors) {
TEST(IntervalSet, TimeIntervalsConstructors)
{
const auto start = media::TimeUnit::FromMicroseconds(1);
const auto end = media::TimeUnit::FromMicroseconds(2);
const media::TimeUnit fuzz;
@ -108,12 +110,14 @@ TEST(IntervalSet, TimeIntervalsConstructors) {
EXPECT_EQ(0u, i0.Length()); // Constructing with an empty time interval.
}
TEST(IntervalSet, Length) {
TEST(IntervalSet, Length)
{
IntInterval i(15, 25);
EXPECT_EQ(10, i.Length());
}
TEST(IntervalSet, Intersects) {
TEST(IntervalSet, Intersects)
{
EXPECT_TRUE(IntInterval(1, 5).Intersects(IntInterval(3, 4)));
EXPECT_TRUE(IntInterval(1, 5).Intersects(IntInterval(3, 7)));
EXPECT_TRUE(IntInterval(1, 5).Intersects(IntInterval(-1, 3)));
@ -129,7 +133,8 @@ TEST(IntervalSet, Intersects) {
EXPECT_FALSE(IntInterval(1, 1).Intersects(IntInterval(2, 2)));
}
TEST(IntervalSet, Intersection) {
TEST(IntervalSet, Intersection)
{
IntInterval i0(10, 20);
IntInterval i1(15, 25);
IntInterval i = i0.Intersection(i1);
@ -145,7 +150,8 @@ TEST(IntervalSet, Intersection) {
EXPECT_TRUE(k.IsEmpty());
}
TEST(IntervalSet, Equals) {
TEST(IntervalSet, Equals)
{
IntInterval i0(10, 20);
IntInterval i1(10, 20);
EXPECT_EQ(i0, i1);
@ -157,7 +163,8 @@ TEST(IntervalSet, Equals) {
EXPECT_NE(i0, i2);
}
TEST(IntervalSet, IntersectionIntervalSet) {
TEST(IntervalSet, IntersectionIntervalSet)
{
IntIntervals i0;
i0 += IntInterval(5, 10);
i0 += IntInterval(20, 25);
@ -232,7 +239,8 @@ static void GeneratePermutations(const IntIntervals& aI1,
} while (std::next_permutation(comb1.begin(), comb1.end()));
}
TEST(IntervalSet, IntersectionNormalizedIntervalSet) {
TEST(IntervalSet, IntersectionNormalizedIntervalSet)
{
IntIntervals i0;
i0 += IntInterval(5, 10);
i0 += IntInterval(20, 25);
@ -247,7 +255,8 @@ TEST(IntervalSet, IntersectionNormalizedIntervalSet) {
GeneratePermutations(i0, i1);
}
TEST(IntervalSet, IntersectionUnorderedNonNormalizedIntervalSet) {
TEST(IntervalSet, IntersectionUnorderedNonNormalizedIntervalSet)
{
IntIntervals i0;
i0 += IntInterval(5, 10);
i0 += IntInterval(8, 25);
@ -262,7 +271,8 @@ TEST(IntervalSet, IntersectionUnorderedNonNormalizedIntervalSet) {
GeneratePermutations(i0, i1);
}
TEST(IntervalSet, IntersectionNonNormalizedInterval) {
TEST(IntervalSet, IntersectionNonNormalizedInterval)
{
IntIntervals i0;
i0 += IntInterval(5, 10);
i0 += IntInterval(8, 25);
@ -275,7 +285,8 @@ TEST(IntervalSet, IntersectionNonNormalizedInterval) {
EXPECT_EQ(i0[0].mEnd, i1.mEnd);
}
TEST(IntervalSet, IntersectionUnorderedNonNormalizedInterval) {
TEST(IntervalSet, IntersectionUnorderedNonNormalizedInterval)
{
IntIntervals i0;
i0 += IntInterval(1, 3);
i0 += IntInterval(1, 10);
@ -298,7 +309,8 @@ static IntIntervals Duplicate(const IntIntervals& aValue) {
return value;
}
TEST(IntervalSet, Normalize) {
TEST(IntervalSet, Normalize)
{
IntIntervals i;
// Test IntervalSet<T> + Interval<T> operator.
i = i + IntInterval(20, 30);
@ -332,7 +344,8 @@ TEST(IntervalSet, Normalize) {
EXPECT_EQ(1u, ti.Length());
}
TEST(IntervalSet, ContainValue) {
TEST(IntervalSet, ContainValue)
{
IntIntervals i0;
i0 += IntInterval(0, 10);
i0 += IntInterval(15, 20);
@ -343,7 +356,8 @@ TEST(IntervalSet, ContainValue) {
EXPECT_FALSE(i0.Contains(25));
}
TEST(IntervalSet, ContainValueWithFuzz) {
TEST(IntervalSet, ContainValueWithFuzz)
{
IntIntervals i0;
i0 += IntInterval(0, 10);
i0 += IntInterval(15, 20, 1);
@ -355,7 +369,8 @@ TEST(IntervalSet, ContainValueWithFuzz) {
EXPECT_FALSE(i0.Contains(25));
}
TEST(IntervalSet, ContainInterval) {
TEST(IntervalSet, ContainInterval)
{
IntIntervals i0;
i0 += IntInterval(0, 10);
i0 += IntInterval(15, 20);
@ -370,7 +385,8 @@ TEST(IntervalSet, ContainInterval) {
EXPECT_FALSE(i0.Contains(IntInterval(30, 55)));
}
TEST(IntervalSet, ContainIntervalWithFuzz) {
TEST(IntervalSet, ContainIntervalWithFuzz)
{
IntIntervals i0;
i0 += IntInterval(0, 10);
i0 += IntInterval(15, 20);
@ -394,7 +410,8 @@ TEST(IntervalSet, ContainIntervalWithFuzz) {
EXPECT_TRUE(i1.Contains(IntInterval(15, 21)));
}
TEST(IntervalSet, Span) {
TEST(IntervalSet, Span)
{
IntInterval i0(0, 10);
IntInterval i1(20, 30);
IntInterval i{i0.Span(i1)};
@ -403,7 +420,8 @@ TEST(IntervalSet, Span) {
EXPECT_EQ(i.mEnd, 30);
}
TEST(IntervalSet, Union) {
TEST(IntervalSet, Union)
{
IntIntervals i0;
i0 += IntInterval(5, 10);
i0 += IntInterval(20, 25);
@ -429,7 +447,8 @@ TEST(IntervalSet, Union) {
EXPECT_EQ(60, i[2].mEnd);
}
TEST(IntervalSet, UnionNotOrdered) {
TEST(IntervalSet, UnionNotOrdered)
{
IntIntervals i0;
i0 += IntInterval(20, 25);
i0 += IntInterval(40, 60);
@ -455,7 +474,8 @@ TEST(IntervalSet, UnionNotOrdered) {
EXPECT_EQ(60, i[2].mEnd);
}
TEST(IntervalSet, NormalizeFuzz) {
TEST(IntervalSet, NormalizeFuzz)
{
IntIntervals i0;
i0 += IntInterval(11, 25, 0);
i0 += IntInterval(5, 10, 1);
@ -470,7 +490,8 @@ TEST(IntervalSet, NormalizeFuzz) {
EXPECT_EQ(60, i0[1].mEnd);
}
TEST(IntervalSet, UnionFuzz) {
TEST(IntervalSet, UnionFuzz)
{
IntIntervals i0;
i0 += IntInterval(5, 10, 1);
i0 += IntInterval(11, 25, 0);
@ -505,14 +526,16 @@ TEST(IntervalSet, UnionFuzz) {
EXPECT_EQ(60, i[1].mEnd);
}
TEST(IntervalSet, Contiguous) {
TEST(IntervalSet, Contiguous)
{
EXPECT_FALSE(IntInterval(5, 10).Contiguous(IntInterval(11, 25)));
EXPECT_TRUE(IntInterval(5, 10).Contiguous(IntInterval(10, 25)));
EXPECT_TRUE(IntInterval(5, 10, 1).Contiguous(IntInterval(11, 25)));
EXPECT_TRUE(IntInterval(5, 10).Contiguous(IntInterval(11, 25, 1)));
}
TEST(IntervalSet, TimeRangesSeconds) {
TEST(IntervalSet, TimeRangesSeconds)
{
media::TimeIntervals i0;
i0 += media::TimeInterval(media::TimeUnit::FromSeconds(20),
media::TimeUnit::FromSeconds(25));
@ -557,7 +580,8 @@ static void CheckTimeRanges(dom::TimeRanges* aTr,
}
}
TEST(IntervalSet, TimeRangesConversion) {
TEST(IntervalSet, TimeRangesConversion)
{
RefPtr<dom::TimeRanges> tr = new dom::TimeRanges();
tr->Add(20, 25);
tr->Add(40, 60);
@ -575,7 +599,8 @@ TEST(IntervalSet, TimeRangesConversion) {
CheckTimeRanges(tr2, i1);
}
TEST(IntervalSet, TimeRangesMicroseconds) {
TEST(IntervalSet, TimeRangesMicroseconds)
{
media::TimeIntervals i0;
i0 += media::TimeInterval(media::TimeUnit::FromMicroseconds(20),
@ -661,7 +686,8 @@ class Foo {
int32_t mArg3;
};
TEST(IntervalSet, FooIntervalSet) {
TEST(IntervalSet, FooIntervalSet)
{
media::Interval<Foo<int>> i(Foo<int>(), Foo<int>(4, 5, 6));
media::IntervalSet<Foo<int>> is;
is += i;
@ -674,7 +700,8 @@ TEST(IntervalSet, FooIntervalSet) {
EXPECT_EQ(Foo<int>(4, 5, 6), is[0].mEnd);
}
TEST(IntervalSet, StaticAssert) {
TEST(IntervalSet, StaticAssert)
{
media::Interval<int> i;
static_assert(
@ -687,7 +714,8 @@ TEST(IntervalSet, StaticAssert) {
"Must use copy constructor");
}
TEST(IntervalSet, Substraction) {
TEST(IntervalSet, Substraction)
{
IntIntervals i0;
i0 += IntInterval(5, 10);
i0 += IntInterval(20, 25);

View File

@ -146,7 +146,8 @@ class MP4DemuxerBinding {
virtual ~MP4DemuxerBinding() {}
};
TEST(MP4Demuxer, Seek) {
TEST(MP4Demuxer, Seek)
{
RefPtr<MP4DemuxerBinding> binding = new MP4DemuxerBinding();
binding->RunTestAndWait([binding]() {
@ -188,7 +189,8 @@ static nsCString ToCryptoString(const CryptoSample& aCrypto) {
return res;
}
TEST(MP4Demuxer, CENCFragVideo) {
TEST(MP4Demuxer, CENCFragVideo)
{
const char* video[] = {
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000000 "
"5,684 5,16980",
@ -333,7 +335,8 @@ TEST(MP4Demuxer, CENCFragVideo) {
});
}
TEST(MP4Demuxer, CENCFragAudio) {
TEST(MP4Demuxer, CENCFragAudio)
{
const char* audio[] = {
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000000 "
"0,281",
@ -547,7 +550,8 @@ TEST(MP4Demuxer, CENCFragAudio) {
});
}
TEST(MP4Demuxer, GetNextKeyframe) {
TEST(MP4Demuxer, GetNextKeyframe)
{
RefPtr<MP4DemuxerBinding> binding = new MP4DemuxerBinding("gizmo-frag.mp4");
binding->RunTestAndWait([binding]() {
@ -576,7 +580,8 @@ TEST(MP4Demuxer, GetNextKeyframe) {
});
}
TEST(MP4Demuxer, ZeroInLastMoov) {
TEST(MP4Demuxer, ZeroInLastMoov)
{
RefPtr<MP4DemuxerBinding> binding =
new MP4DemuxerBinding("short-zero-in-moov.mp4");
binding->RunTestAndWait([binding]() {
@ -585,7 +590,8 @@ TEST(MP4Demuxer, ZeroInLastMoov) {
});
}
TEST(MP4Demuxer, ZeroInMoovQuickTime) {
TEST(MP4Demuxer, ZeroInMoovQuickTime)
{
RefPtr<MP4DemuxerBinding> binding =
new MP4DemuxerBinding("short-zero-inband.mov");
binding->RunTestAndWait([binding]() {
@ -594,7 +600,8 @@ TEST(MP4Demuxer, ZeroInMoovQuickTime) {
});
}
TEST(MP4Demuxer, IgnoreMinus1Duration) {
TEST(MP4Demuxer, IgnoreMinus1Duration)
{
RefPtr<MP4DemuxerBinding> binding =
new MP4DemuxerBinding("negative_duration.mp4");
binding->RunTestAndWait([binding]() {

View File

@ -44,7 +44,8 @@ class BenchmarkRunner {
RefPtr<Benchmark> mBenchmark;
};
TEST(MediaDataDecoder, H264) {
TEST(MediaDataDecoder, H264)
{
if (!DecoderTraits::IsMP4SupportedType(
MediaContainerType(MEDIAMIMETYPE(VIDEO_MP4)),
/* DecoderDoctorDiagnostics* */ nullptr)) {
@ -59,7 +60,8 @@ TEST(MediaDataDecoder, H264) {
}
}
TEST(MediaDataDecoder, VP9) {
TEST(MediaDataDecoder, VP9)
{
if (!WebMDecoder::IsSupportedType(
MediaContainerType(MEDIAMIMETYPE(VIDEO_WEBM)))) {
EXPECT_TRUE(true);

View File

@ -16,7 +16,8 @@ using namespace mozilla;
/*
* Test if listeners receive the event data correctly.
*/
TEST(MediaEventSource, SingleListener) {
TEST(MediaEventSource, SingleListener)
{
RefPtr<TaskQueue> queue =
new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK));
@ -39,7 +40,8 @@ TEST(MediaEventSource, SingleListener) {
listener.Disconnect();
}
TEST(MediaEventSource, MultiListener) {
TEST(MediaEventSource, MultiListener)
{
RefPtr<TaskQueue> queue =
new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK));
@ -69,7 +71,8 @@ TEST(MediaEventSource, MultiListener) {
/*
* Test if disconnecting a listener prevents events from coming.
*/
TEST(MediaEventSource, DisconnectAfterNotification) {
TEST(MediaEventSource, DisconnectAfterNotification)
{
RefPtr<TaskQueue> queue =
new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK));
@ -95,7 +98,8 @@ TEST(MediaEventSource, DisconnectAfterNotification) {
EXPECT_EQ(i, 11);
}
TEST(MediaEventSource, DisconnectBeforeNotification) {
TEST(MediaEventSource, DisconnectBeforeNotification)
{
RefPtr<TaskQueue> queue =
new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK));
@ -126,7 +130,8 @@ TEST(MediaEventSource, DisconnectBeforeNotification) {
* Test we don't hit the assertion when calling Connect() and Disconnect()
* repeatedly.
*/
TEST(MediaEventSource, DisconnectAndConnect) {
TEST(MediaEventSource, DisconnectAndConnect)
{
RefPtr<TaskQueue> queue;
MediaEventProducerExc<int> source;
MediaEventListener listener = source.Connect(queue, []() {});
@ -138,7 +143,8 @@ TEST(MediaEventSource, DisconnectAndConnect) {
/*
* Test void event type.
*/
TEST(MediaEventSource, VoidEventType) {
TEST(MediaEventSource, VoidEventType)
{
RefPtr<TaskQueue> queue =
new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK));
@ -174,7 +180,8 @@ TEST(MediaEventSource, VoidEventType) {
/*
* Test listeners can take various event types (T, T&&, const T& and void).
*/
TEST(MediaEventSource, ListenerType1) {
TEST(MediaEventSource, ListenerType1)
{
RefPtr<TaskQueue> queue =
new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK));
@ -201,7 +208,8 @@ TEST(MediaEventSource, ListenerType1) {
listener3.Disconnect();
}
TEST(MediaEventSource, ListenerType2) {
TEST(MediaEventSource, ListenerType2)
{
RefPtr<TaskQueue> queue =
new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK));
@ -250,7 +258,8 @@ struct SomeEvent {
/*
* Test we don't have unnecessary copies of the event data.
*/
TEST(MediaEventSource, CopyEvent1) {
TEST(MediaEventSource, CopyEvent1)
{
RefPtr<TaskQueue> queue =
new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK));
@ -276,7 +285,8 @@ TEST(MediaEventSource, CopyEvent1) {
listener2.Disconnect();
}
TEST(MediaEventSource, CopyEvent2) {
TEST(MediaEventSource, CopyEvent2)
{
RefPtr<TaskQueue> queue =
new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK));
@ -304,7 +314,8 @@ TEST(MediaEventSource, CopyEvent2) {
/*
* Test move-only types.
*/
TEST(MediaEventSource, MoveOnly) {
TEST(MediaEventSource, MoveOnly)
{
RefPtr<TaskQueue> queue =
new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK));
@ -337,7 +348,8 @@ struct RefCounter {
* Test we should copy instead of move in NonExclusive mode
* for each listener must get a copy.
*/
TEST(MediaEventSource, NoMove) {
TEST(MediaEventSource, NoMove)
{
RefPtr<TaskQueue> queue =
new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK));
@ -361,7 +373,8 @@ TEST(MediaEventSource, NoMove) {
/*
* Rvalue lambda should be moved instead of copied.
*/
TEST(MediaEventSource, MoveLambda) {
TEST(MediaEventSource, MoveLambda)
{
RefPtr<TaskQueue> queue;
MediaEventProducer<void> source;

View File

@ -9,7 +9,8 @@
using namespace mozilla;
TEST(MediaMIMETypes, DependentMIMEType) {
TEST(MediaMIMETypes, DependentMIMEType)
{
static const struct {
const char* mString;
DependentMediaMIMEType mDependentMediaMIMEType;
@ -27,7 +28,8 @@ TEST(MediaMIMETypes, DependentMIMEType) {
}
}
TEST(MediaMIMETypes, MakeMediaMIMEType_bad) {
TEST(MediaMIMETypes, MakeMediaMIMEType_bad)
{
static const char* tests[] = {"", " ", "/", "audio",
"audio/", "mp4", "/mp4", "a/b"};
@ -38,7 +40,8 @@ TEST(MediaMIMETypes, MakeMediaMIMEType_bad) {
}
}
TEST(MediaMIMETypes, MediaMIMEType) {
TEST(MediaMIMETypes, MediaMIMEType)
{
static const struct {
const char* mTypeString;
const char* mAsString;
@ -78,7 +81,8 @@ TEST(MediaMIMETypes, MediaMIMEType) {
}
}
TEST(MediaMIMETypes, MediaCodecs) {
TEST(MediaMIMETypes, MediaCodecs)
{
MediaCodecs empty("");
EXPECT_TRUE(empty.IsEmpty());
EXPECT_TRUE(empty.AsString().EqualsLiteral(""));
@ -152,7 +156,8 @@ TEST(MediaMIMETypes, MediaCodecs) {
EXPECT_FALSE(one.ContainsAll(two));
}
TEST(MediaMIMETypes, MakeMediaExtendedMIMEType_bad) {
TEST(MediaMIMETypes, MakeMediaExtendedMIMEType_bad)
{
static const char* tests[] = {"", " ", "/", "audio",
"audio/", "mp4", "/mp4", "a/b"};
@ -163,7 +168,8 @@ TEST(MediaMIMETypes, MakeMediaExtendedMIMEType_bad) {
}
}
TEST(MediaMIMETypes, MediaExtendedMIMEType) {
TEST(MediaMIMETypes, MediaExtendedMIMEType)
{
// Some generic tests first.
static const struct {
const char* mTypeString;

View File

@ -7,7 +7,8 @@
#include "OpusParser.h"
#include <algorithm>
TEST(OpusParser, Mapping2) {
TEST(OpusParser, Mapping2)
{
uint8_t validChannels[] = {1, 3, 4, 6, 9, 11, 16, 18, 25, 27,
36, 38, 49, 51, 64, 66, 81, 83, 100, 102,
121, 123, 144, 146, 169, 171, 196, 198, 225, 227};

View File

@ -3,7 +3,8 @@
extern "C" uint8_t* test_rust();
TEST(rust, CallFromCpp) {
TEST(rust, CallFromCpp)
{
auto greeting = test_rust();
EXPECT_STREQ(reinterpret_cast<char*>(greeting), "hello from rust.");
}

View File

@ -10,7 +10,8 @@
using namespace mozilla;
TEST(TimeUnit, Rounding) {
TEST(TimeUnit, Rounding)
{
int64_t usecs = 66261715;
double seconds = media::TimeUnit::FromMicroseconds(usecs).ToSeconds();
EXPECT_EQ(media::TimeUnit::FromSeconds(seconds).ToMicroseconds(), usecs);

View File

@ -69,7 +69,8 @@ static const TestFileData testFiles[] = {
{"test_case_1224363.vp8.ivf", VPX_CODEC_CORRUPT_FRAME},
{"test_case_1224369.vp8.ivf", VPX_CODEC_CORRUPT_FRAME}};
TEST(libvpx, test_cases) {
TEST(libvpx, test_cases)
{
for (size_t test = 0; test < ArrayLength(testFiles); ++test) {
nsTArray<uint8_t> data;
ReadVPXFile(testFiles[test].mFilename, data);

View File

@ -13,7 +13,8 @@ class Image;
} // namespace layer
} // namespace mozilla
TEST(VideoSegment, TestAppendFrameForceBlack) {
TEST(VideoSegment, TestAppendFrameForceBlack)
{
RefPtr<layers::Image> testImage = nullptr;
VideoSegment segment;
@ -28,7 +29,8 @@ TEST(VideoSegment, TestAppendFrameForceBlack) {
}
}
TEST(VideoSegment, TestAppendFrameNotForceBlack) {
TEST(VideoSegment, TestAppendFrameNotForceBlack)
{
RefPtr<layers::Image> testImage = nullptr;
VideoSegment segment;

View File

@ -69,7 +69,8 @@ class TestVP8TrackEncoder : public VP8TrackEncoder {
};
// Init test
TEST(VP8VideoTrackEncoder, Initialization) {
TEST(VP8VideoTrackEncoder, Initialization)
{
InitParam params[] = {
// Failure cases.
{false, 0, 0}, // Height/ width should be larger than 1.
@ -90,7 +91,8 @@ TEST(VP8VideoTrackEncoder, Initialization) {
}
// Get MetaData test
TEST(VP8VideoTrackEncoder, FetchMetaData) {
TEST(VP8VideoTrackEncoder, FetchMetaData)
{
InitParam params[] = {
// Success cases
{true, 640, 480}, // Standard VGA
@ -113,7 +115,8 @@ TEST(VP8VideoTrackEncoder, FetchMetaData) {
}
// Encode test
TEST(VP8VideoTrackEncoder, FrameEncode) {
TEST(VP8VideoTrackEncoder, FrameEncode)
{
TestVP8TrackEncoder encoder;
TimeStamp now = TimeStamp::Now();
@ -145,7 +148,8 @@ TEST(VP8VideoTrackEncoder, FrameEncode) {
}
// Test that encoding a single frame gives useful output.
TEST(VP8VideoTrackEncoder, SingleFrameEncode) {
TEST(VP8VideoTrackEncoder, SingleFrameEncode)
{
TestVP8TrackEncoder encoder;
TimeStamp now = TimeStamp::Now();
YUVBufferGenerator generator;
@ -179,7 +183,8 @@ TEST(VP8VideoTrackEncoder, SingleFrameEncode) {
}
// Test that encoding a couple of identical images gives useful output.
TEST(VP8VideoTrackEncoder, SameFrameEncode) {
TEST(VP8VideoTrackEncoder, SameFrameEncode)
{
TestVP8TrackEncoder encoder;
TimeStamp now = TimeStamp::Now();
YUVBufferGenerator generator;
@ -214,7 +219,8 @@ TEST(VP8VideoTrackEncoder, SameFrameEncode) {
}
// Test encoding a track that has to skip frames.
TEST(VP8VideoTrackEncoder, SkippedFrames) {
TEST(VP8VideoTrackEncoder, SkippedFrames)
{
TestVP8TrackEncoder encoder;
YUVBufferGenerator generator;
generator.Init(mozilla::gfx::IntSize(640, 480));
@ -249,7 +255,8 @@ TEST(VP8VideoTrackEncoder, SkippedFrames) {
}
// Test encoding a track with frames subject to rounding errors.
TEST(VP8VideoTrackEncoder, RoundingErrorFramesEncode) {
TEST(VP8VideoTrackEncoder, RoundingErrorFramesEncode)
{
TestVP8TrackEncoder encoder;
YUVBufferGenerator generator;
generator.Init(mozilla::gfx::IntSize(640, 480));
@ -290,7 +297,8 @@ TEST(VP8VideoTrackEncoder, RoundingErrorFramesEncode) {
}
// Test that we're encoding timestamps rather than durations.
TEST(VP8VideoTrackEncoder, TimestampFrameEncode) {
TEST(VP8VideoTrackEncoder, TimestampFrameEncode)
{
TestVP8TrackEncoder encoder;
YUVBufferGenerator generator;
generator.Init(mozilla::gfx::IntSize(640, 480));
@ -332,7 +340,8 @@ TEST(VP8VideoTrackEncoder, TimestampFrameEncode) {
}
// Test that we're compensating for drift when encoding.
TEST(VP8VideoTrackEncoder, DriftingFrameEncode) {
TEST(VP8VideoTrackEncoder, DriftingFrameEncode)
{
TestVP8TrackEncoder encoder;
YUVBufferGenerator generator;
generator.Init(mozilla::gfx::IntSize(640, 480));
@ -380,7 +389,8 @@ TEST(VP8VideoTrackEncoder, DriftingFrameEncode) {
}
// Test that suspending an encoding works.
TEST(VP8VideoTrackEncoder, Suspended) {
TEST(VP8VideoTrackEncoder, Suspended)
{
TestVP8TrackEncoder encoder;
TimeStamp now = TimeStamp::Now();
YUVBufferGenerator generator;
@ -441,7 +451,8 @@ TEST(VP8VideoTrackEncoder, Suspended) {
}
// Test that ending a track while the video track encoder is suspended works.
TEST(VP8VideoTrackEncoder, SuspendedUntilEnd) {
TEST(VP8VideoTrackEncoder, SuspendedUntilEnd)
{
TestVP8TrackEncoder encoder;
YUVBufferGenerator generator;
generator.Init(mozilla::gfx::IntSize(640, 480));
@ -490,7 +501,8 @@ TEST(VP8VideoTrackEncoder, SuspendedUntilEnd) {
}
// Test that ending a track that was always suspended works.
TEST(VP8VideoTrackEncoder, AlwaysSuspended) {
TEST(VP8VideoTrackEncoder, AlwaysSuspended)
{
TestVP8TrackEncoder encoder;
YUVBufferGenerator generator;
generator.Init(mozilla::gfx::IntSize(640, 480));
@ -521,7 +533,8 @@ TEST(VP8VideoTrackEncoder, AlwaysSuspended) {
}
// Test that encoding a track that is suspended in the beginning works.
TEST(VP8VideoTrackEncoder, SuspendedBeginning) {
TEST(VP8VideoTrackEncoder, SuspendedBeginning)
{
TestVP8TrackEncoder encoder;
YUVBufferGenerator generator;
generator.Init(mozilla::gfx::IntSize(640, 480));
@ -572,7 +585,8 @@ TEST(VP8VideoTrackEncoder, SuspendedBeginning) {
// Test that suspending and resuming in the middle of already pushed data
// works.
TEST(VP8VideoTrackEncoder, SuspendedOverlap) {
TEST(VP8VideoTrackEncoder, SuspendedOverlap)
{
TestVP8TrackEncoder encoder;
YUVBufferGenerator generator;
generator.Init(mozilla::gfx::IntSize(640, 480));
@ -620,7 +634,8 @@ TEST(VP8VideoTrackEncoder, SuspendedOverlap) {
}
// Test that ending a track in the middle of already pushed data works.
TEST(VP8VideoTrackEncoder, PrematureEnding) {
TEST(VP8VideoTrackEncoder, PrematureEnding)
{
TestVP8TrackEncoder encoder;
YUVBufferGenerator generator;
generator.Init(mozilla::gfx::IntSize(640, 480));
@ -650,7 +665,8 @@ TEST(VP8VideoTrackEncoder, PrematureEnding) {
}
// Test that a track that starts at t > 0 works as expected.
TEST(VP8VideoTrackEncoder, DelayedStart) {
TEST(VP8VideoTrackEncoder, DelayedStart)
{
TestVP8TrackEncoder encoder;
YUVBufferGenerator generator;
generator.Init(mozilla::gfx::IntSize(640, 480));
@ -682,7 +698,8 @@ TEST(VP8VideoTrackEncoder, DelayedStart) {
// Test that a track that starts at t > 0 works as expected, when
// SetStartOffset comes after AppendVideoSegment.
TEST(VP8VideoTrackEncoder, DelayedStartOtherEventOrder) {
TEST(VP8VideoTrackEncoder, DelayedStartOtherEventOrder)
{
TestVP8TrackEncoder encoder;
YUVBufferGenerator generator;
generator.Init(mozilla::gfx::IntSize(640, 480));
@ -713,7 +730,8 @@ TEST(VP8VideoTrackEncoder, DelayedStartOtherEventOrder) {
}
// Test that a track that starts at t >>> 0 works as expected.
TEST(VP8VideoTrackEncoder, VeryDelayedStart) {
TEST(VP8VideoTrackEncoder, VeryDelayedStart)
{
TestVP8TrackEncoder encoder;
YUVBufferGenerator generator;
generator.Init(mozilla::gfx::IntSize(640, 480));
@ -745,7 +763,8 @@ TEST(VP8VideoTrackEncoder, VeryDelayedStart) {
// Test that a video frame that hangs around for a long time gets encoded every
// second.
TEST(VP8VideoTrackEncoder, LongFramesReEncoded) {
TEST(VP8VideoTrackEncoder, LongFramesReEncoded)
{
TestVP8TrackEncoder encoder;
YUVBufferGenerator generator;
generator.Init(mozilla::gfx::IntSize(640, 480));
@ -799,7 +818,8 @@ TEST(VP8VideoTrackEncoder, LongFramesReEncoded) {
// Test that an encoding with a defined key frame interval encodes keyframes
// as expected. Short here means shorter than the default (1s).
TEST(VP8VideoTrackEncoder, ShortKeyFrameInterval) {
TEST(VP8VideoTrackEncoder, ShortKeyFrameInterval)
{
TestVP8TrackEncoder encoder;
YUVBufferGenerator generator;
generator.Init(mozilla::gfx::IntSize(640, 480));
@ -868,7 +888,8 @@ TEST(VP8VideoTrackEncoder, ShortKeyFrameInterval) {
// Test that an encoding with a defined key frame interval encodes keyframes
// as expected. Long here means longer than the default (1s).
TEST(VP8VideoTrackEncoder, LongKeyFrameInterval) {
TEST(VP8VideoTrackEncoder, LongKeyFrameInterval)
{
TestVP8TrackEncoder encoder;
YUVBufferGenerator generator;
generator.Init(mozilla::gfx::IntSize(640, 480));
@ -937,7 +958,8 @@ TEST(VP8VideoTrackEncoder, LongKeyFrameInterval) {
// Test that an encoding with no defined key frame interval encodes keyframes
// as expected. Default interval should be 1000ms.
TEST(VP8VideoTrackEncoder, DefaultKeyFrameInterval) {
TEST(VP8VideoTrackEncoder, DefaultKeyFrameInterval)
{
TestVP8TrackEncoder encoder;
YUVBufferGenerator generator;
generator.Init(mozilla::gfx::IntSize(640, 480));
@ -1004,7 +1026,8 @@ TEST(VP8VideoTrackEncoder, DefaultKeyFrameInterval) {
// Test that an encoding where the key frame interval is updated dynamically
// encodes keyframes as expected.
TEST(VP8VideoTrackEncoder, DynamicKeyFrameIntervalChanges) {
TEST(VP8VideoTrackEncoder, DynamicKeyFrameIntervalChanges)
{
TestVP8TrackEncoder encoder;
YUVBufferGenerator generator;
generator.Init(mozilla::gfx::IntSize(640, 480));
@ -1173,7 +1196,8 @@ TEST(VP8VideoTrackEncoder, DynamicKeyFrameIntervalChanges) {
// Test that an encoding which is disabled on a frame timestamp encodes
// frames as expected.
TEST(VP8VideoTrackEncoder, DisableOnFrameTime) {
TEST(VP8VideoTrackEncoder, DisableOnFrameTime)
{
TestVP8TrackEncoder encoder;
YUVBufferGenerator generator;
generator.Init(mozilla::gfx::IntSize(640, 480));
@ -1217,7 +1241,8 @@ TEST(VP8VideoTrackEncoder, DisableOnFrameTime) {
// Test that an encoding which is disabled between two frame timestamps encodes
// frames as expected.
TEST(VP8VideoTrackEncoder, DisableBetweenFrames) {
TEST(VP8VideoTrackEncoder, DisableBetweenFrames)
{
TestVP8TrackEncoder encoder;
YUVBufferGenerator generator;
generator.Init(mozilla::gfx::IntSize(640, 480));
@ -1261,7 +1286,8 @@ TEST(VP8VideoTrackEncoder, DisableBetweenFrames) {
// Test that an encoding which is enabled on a frame timestamp encodes
// frames as expected.
TEST(VP8VideoTrackEncoder, EnableOnFrameTime) {
TEST(VP8VideoTrackEncoder, EnableOnFrameTime)
{
TestVP8TrackEncoder encoder;
YUVBufferGenerator generator;
generator.Init(mozilla::gfx::IntSize(640, 480));
@ -1307,7 +1333,8 @@ TEST(VP8VideoTrackEncoder, EnableOnFrameTime) {
// Test that an encoding which is enabled between two frame timestamps encodes
// frames as expected.
TEST(VP8VideoTrackEncoder, EnableBetweenFrames) {
TEST(VP8VideoTrackEncoder, EnableBetweenFrames)
{
TestVP8TrackEncoder encoder;
YUVBufferGenerator generator;
generator.Init(mozilla::gfx::IntSize(640, 480));
@ -1352,7 +1379,8 @@ TEST(VP8VideoTrackEncoder, EnableBetweenFrames) {
}
// Test that making time go backwards removes any future frames in the encoder.
TEST(VP8VideoTrackEncoder, BackwardsTimeResets) {
TEST(VP8VideoTrackEncoder, BackwardsTimeResets)
{
TestVP8TrackEncoder encoder;
YUVBufferGenerator generator;
generator.Init(mozilla::gfx::IntSize(640, 480));
@ -1424,7 +1452,8 @@ TEST(VP8VideoTrackEncoder, BackwardsTimeResets) {
// Test that trying to encode a null image removes any future frames in the
// encoder.
TEST(VP8VideoTrackEncoder, NullImageResets) {
TEST(VP8VideoTrackEncoder, NullImageResets)
{
TestVP8TrackEncoder encoder;
YUVBufferGenerator generator;
generator.Init(mozilla::gfx::IntSize(640, 480));
@ -1492,7 +1521,8 @@ TEST(VP8VideoTrackEncoder, NullImageResets) {
}
// EOS test
TEST(VP8VideoTrackEncoder, EncodeComplete) {
TEST(VP8VideoTrackEncoder, EncodeComplete)
{
TestVP8TrackEncoder encoder;
// track end notification.

View File

@ -10,7 +10,8 @@
using namespace mozilla;
TEST(MediaMIMETypes, IsMediaMIMEType) {
TEST(MediaMIMETypes, IsMediaMIMEType)
{
EXPECT_TRUE(IsMediaMIMEType(AUDIO_MP4));
EXPECT_TRUE(IsMediaMIMEType(VIDEO_MP4));
EXPECT_TRUE(IsMediaMIMEType("application/x-mp4"));
@ -25,7 +26,8 @@ TEST(MediaMIMETypes, IsMediaMIMEType) {
EXPECT_FALSE(IsMediaMIMEType("Video/mp4"));
}
TEST(StringListRange, MakeStringListRange) {
TEST(StringListRange, MakeStringListRange)
{
static const struct {
const char* mList;
const char* mExpectedSkipEmpties;
@ -75,7 +77,8 @@ TEST(StringListRange, MakeStringListRange) {
}
}
TEST(StringListRange, StringListContains) {
TEST(StringListRange, StringListContains)
{
static const struct {
const char* mList;
const char* mItemToSearch;

View File

@ -19,7 +19,8 @@ static const uint64_t gTimecodes[] = {66000000, 160000000, 166000000,
200000000, 233000000, 320000000};
static const int64_t gEndOffsets[] = {501, 772, 1244, 1380, 1543, 2015};
TEST(WebMBuffered, BasicTests) {
TEST(WebMBuffered, BasicTests)
{
ReentrantMonitor dummy("dummy");
WebMBufferedParser parser(0);
@ -57,7 +58,8 @@ static void ReadFile(const char* aPath, nsTArray<uint8_t>& aBuffer) {
ASSERT_EQ(r, 0);
}
TEST(WebMBuffered, RealData) {
TEST(WebMBuffered, RealData)
{
ReentrantMonitor dummy("dummy");
WebMBufferedParser parser(0);
@ -78,7 +80,8 @@ TEST(WebMBuffered, RealData) {
}
}
TEST(WebMBuffered, RealDataAppend) {
TEST(WebMBuffered, RealDataAppend)
{
ReentrantMonitor dummy("dummy");
WebMBufferedParser parser(0);
nsTArray<WebMTimeDataOffset> mapping;

View File

@ -94,7 +94,8 @@ class TestWebMWriter : public WebMWriter {
uint64_t mTimestamp;
};
TEST(WebMWriter, Metadata) {
TEST(WebMWriter, Metadata)
{
TestWebMWriter writer(ContainerWriter::CREATE_AUDIO_TRACK |
ContainerWriter::CREATE_VIDEO_TRACK);
@ -129,7 +130,8 @@ TEST(WebMWriter, Metadata) {
EXPECT_TRUE(encodedBuf.Length() > 0);
}
TEST(WebMWriter, Cluster) {
TEST(WebMWriter, Cluster)
{
TestWebMWriter writer(ContainerWriter::CREATE_AUDIO_TRACK |
ContainerWriter::CREATE_VIDEO_TRACK);
// Set opus metadata.
@ -170,7 +172,8 @@ TEST(WebMWriter, Cluster) {
EXPECT_TRUE(writer.HaveValidCluster());
}
TEST(WebMWriter, FLUSH_NEEDED) {
TEST(WebMWriter, FLUSH_NEEDED)
{
TestWebMWriter writer(ContainerWriter::CREATE_AUDIO_TRACK |
ContainerWriter::CREATE_VIDEO_TRACK);
// Set opus metadata.
@ -289,7 +292,8 @@ static int64_t webm_tell(void* aUserData) {
return ioData->offset.isValid() ? ioData->offset.value() : -1;
}
TEST(WebMWriter, bug970774_aspect_ratio) {
TEST(WebMWriter, bug970774_aspect_ratio)
{
TestWebMWriter writer(ContainerWriter::CREATE_AUDIO_TRACK |
ContainerWriter::CREATE_VIDEO_TRACK);
// Set opus metadata.

View File

@ -8,12 +8,14 @@
using mozilla::MP4Interval;
TEST(MP4Interval, Length) {
TEST(MP4Interval, Length)
{
MP4Interval<int> i(15, 25);
EXPECT_EQ(10, i.Length());
}
TEST(MP4Interval, Intersection) {
TEST(MP4Interval, Intersection)
{
MP4Interval<int> i0(10, 20);
MP4Interval<int> i1(15, 25);
MP4Interval<int> i = i0.Intersection(i1);
@ -21,7 +23,8 @@ TEST(MP4Interval, Intersection) {
EXPECT_EQ(20, i.end);
}
TEST(MP4Interval, Equals) {
TEST(MP4Interval, Equals)
{
MP4Interval<int> i0(10, 20);
MP4Interval<int> i1(10, 20);
EXPECT_EQ(i0, i1);
@ -33,7 +36,8 @@ TEST(MP4Interval, Equals) {
EXPECT_NE(i0, i2);
}
TEST(MP4Interval, IntersectionVector) {
TEST(MP4Interval, IntersectionVector)
{
nsTArray<MP4Interval<int>> i0;
i0.AppendElement(MP4Interval<int>(5, 10));
i0.AppendElement(MP4Interval<int>(20, 25));
@ -63,7 +67,8 @@ TEST(MP4Interval, IntersectionVector) {
EXPECT_EQ(57, i[3].end);
}
TEST(MP4Interval, Normalize) {
TEST(MP4Interval, Normalize)
{
nsTArray<MP4Interval<int>> i;
i.AppendElement(MP4Interval<int>(20, 30));
i.AppendElement(MP4Interval<int>(1, 8));

View File

@ -51,7 +51,8 @@ static intptr_t vector_reader(uint8_t* buffer, uintptr_t size, void* userdata) {
return length;
}
TEST(rust, MP4MetadataEmpty) {
TEST(rust, MP4MetadataEmpty)
{
Mp4parseStatus rv;
Mp4parseIo io;
@ -105,7 +106,8 @@ TEST(rust, MP4MetadataEmpty) {
mp4parse_free(context);
}
TEST(rust, MP4Metadata) {
TEST(rust, MP4Metadata)
{
FILE* f = fopen("street.mp4", "rb");
ASSERT_TRUE(f != nullptr);
// Read just the moov header to work around the parser

View File

@ -68,7 +68,8 @@ class TestStream : public ByteStream,
size_t mSize;
};
TEST(MP4Metadata, EmptyStream) {
TEST(MP4Metadata, EmptyStream)
{
RefPtr<ByteStream> stream = new TestStream(nullptr, 0);
MP4Metadata::ResultAndByteBuffer metadataBuffer =
@ -94,7 +95,8 @@ TEST(MP4Metadata, EmptyStream) {
EXPECT_FALSE(metadata.Crypto().Ref()->valid);
}
TEST(MoofParser, EmptyStream) {
TEST(MoofParser, EmptyStream)
{
RefPtr<ByteStream> stream = new TestStream(nullptr, 0);
MoofParser parser(stream, AsVariant(ParseAllTracks{}), false);
@ -248,7 +250,8 @@ static const TestFileData testFiles[] = {
300, 1, 10032000, false, 0, true, true, 2}, // Uses bad track id 0
};
TEST(MP4Metadata, test_case_mp4) {
TEST(MP4Metadata, test_case_mp4)
{
const TestFileData* tests = nullptr;
size_t length = 0;
@ -403,7 +406,8 @@ TEST(MP4Metadata, test_case_mp4_subsets) {
}
#endif
TEST(MoofParser, test_case_mp4) {
TEST(MoofParser, test_case_mp4)
{
const TestFileData* tests = nullptr;
size_t length = 0;
@ -448,7 +452,8 @@ TEST(MoofParser, test_case_mp4) {
}
}
TEST(MoofParser, test_case_sample_description_entries) {
TEST(MoofParser, test_case_sample_description_entries)
{
const TestFileData* tests = testFiles;
size_t length = ArrayLength(testFiles);
@ -495,7 +500,8 @@ TEST(MoofParser, test_case_sample_description_entries) {
// used id 0 to trigger special handling in the MoofParser to read multiple
// track metadata, but since muxers use track id 0 in the wild, we want to
// make sure they can't accidentally trigger such handling.
TEST(MoofParser, test_case_track_id_0_does_not_read_multitracks) {
TEST(MoofParser, test_case_track_id_0_does_not_read_multitracks)
{
const char* zeroTrackIdFileName =
"test_case_1519617-video-has-track_id-0.mp4";
nsTArray<uint8_t> buffer = ReadTestFile(zeroTrackIdFileName);
@ -550,7 +556,8 @@ TEST(MoofParser, test_case_track_id_0_does_not_read_multitracks) {
// if its crypto member is valid. However, even on files where the pssh isn't
// in the init segment, the MoofParser should still read the sinf, as in this
// testcase.
TEST(MoofParser, test_case_track_id_0_reads_crypto_metadata) {
TEST(MoofParser, test_case_track_id_0_reads_crypto_metadata)
{
const char* zeroTrackIdFileName =
"test_case_1519617-cenc-init-with-track_id-0.mp4";
nsTArray<uint8_t> buffer = ReadTestFile(zeroTrackIdFileName);
@ -607,7 +614,8 @@ TEST(MoofParser, test_case_track_id_0_reads_crypto_metadata) {
// should parse such fragmented media. In this test the metadata contains info
// for track ids 1 and 2, but track 2's track fragment headers (traf) have been
// over written with free space boxes (free).
TEST(MoofParser, test_case_moofs_missing_trafs) {
TEST(MoofParser, test_case_moofs_missing_trafs)
{
const char* noTrafsForTrack2MoofsFileName =
"test_case_1519617-track2-trafs-removed.mp4";
nsTArray<uint8_t> buffer = ReadTestFile(noTrafsForTrack2MoofsFileName);
@ -750,7 +758,8 @@ uint8_t media_gtest_video_init_mp4[] = {
const uint32_t media_gtest_video_init_mp4_len = 745;
TEST(MP4Metadata, EmptyCTTS) {
TEST(MP4Metadata, EmptyCTTS)
{
RefPtr<MediaByteBuffer> buffer =
new MediaByteBuffer(media_gtest_video_init_mp4_len);
buffer->AppendElements(media_gtest_video_init_mp4,
@ -845,7 +854,7 @@ TEST_F(MP4MetadataTelemetryFixture, Telemetry) {
"MEDIA_MP4_PARSE_SAMPLE_DESCRIPTION_ENTRIES_HAVE_MULTIPLE_CODECS",
snapshot, &multipleCodecsHistogram);
ASSERT_TRUE(multipleCodecsHistogram.isObject())
<< "Multiple codecs histogram should exist!";
<< "Multiple codecs histogram should exist!";
TelemetryTestHelpers::GetProperty(cx.GetJSContext(), "values",
multipleCodecsHistogram, &values);
@ -870,7 +879,7 @@ TEST_F(MP4MetadataTelemetryFixture, Telemetry) {
"MEDIA_MP4_PARSE_SAMPLE_DESCRIPTION_ENTRIES_HAVE_MULTIPLE_CRYPTO",
snapshot, &multipleCryptoHistogram);
ASSERT_TRUE(multipleCryptoHistogram.isObject())
<< "Multiple crypto histogram should exist!";
<< "Multiple crypto histogram should exist!";
TelemetryTestHelpers::GetProperty(cx.GetJSContext(), "values",
multipleCryptoHistogram, &values);
@ -893,7 +902,7 @@ TEST_F(MP4MetadataTelemetryFixture, Telemetry) {
cx.GetJSContext(), "MEDIA_MP4_PARSE_NUM_SAMPLE_DESCRIPTION_ENTRIES",
snapshot, &numSamplesHistogram);
ASSERT_TRUE(numSamplesHistogram.isObject())
<< "Num sample description entries histogram should exist!";
<< "Num sample description entries histogram should exist!";
TelemetryTestHelpers::GetProperty(cx.GetJSContext(), "values",
numSamplesHistogram, &values);

View File

@ -12,7 +12,8 @@
using namespace mozilla;
TEST(ContainerParser, MIMETypes) {
TEST(ContainerParser, MIMETypes)
{
const char* containerTypes[] = {"video/webm", "audio/webm", "video/mp4",
"audio/mp4", "audio/aac"};
nsAutoPtr<ContainerParser> parser;
@ -32,7 +33,8 @@ already_AddRefed<MediaByteBuffer> make_adts_header() {
return buffer.forget();
}
TEST(ContainerParser, ADTSHeader) {
TEST(ContainerParser, ADTSHeader)
{
nsAutoPtr<ContainerParser> parser;
parser = ContainerParser::CreateForMIMEType(
MediaContainerType(MEDIAMIMETYPE("audio/aac")));
@ -97,7 +99,8 @@ TEST(ContainerParser, ADTSHeader) {
EXPECT_EQ(parser->MediaSegmentRange(), MediaByteRange());
}
TEST(ContainerParser, ADTSBlankMedia) {
TEST(ContainerParser, ADTSBlankMedia)
{
nsAutoPtr<ContainerParser> parser;
parser = ContainerParser::CreateForMIMEType(
MediaContainerType(MEDIAMIMETYPE("audio/aac")));

View File

@ -15,7 +15,8 @@ struct TestData {
const bool mExpectedValue;
};
TEST(ExtractVPXCodecDetails, TestDataLength) {
TEST(ExtractVPXCodecDetails, TestDataLength)
{
TestData tests[] = {
{u"vp09.00.11.08", true}, // valid case
{u"vp09.00.11.08.00", true}, // valid case, have extra optional field
@ -38,7 +39,8 @@ TEST(ExtractVPXCodecDetails, TestDataLength) {
}
}
TEST(ExtractVPXCodecDetails, TestInputData) {
TEST(ExtractVPXCodecDetails, TestInputData)
{
TestData tests[] = {
{u"vp09.02..08", false}, // malformed
{u"vp9.02.10.08", false}, // invalid 4CC
@ -74,7 +76,8 @@ TEST(ExtractVPXCodecDetails, TestInputData) {
}
}
TEST(ExtractVPXCodecDetails, TestParsingOutput) {
TEST(ExtractVPXCodecDetails, TestParsingOutput)
{
uint8_t profile = 0;
uint8_t level = 0;
uint8_t bitDepth = 0;

View File

@ -14,7 +14,8 @@
#include "mprio.h"
TEST(PrioEncoder, BadPublicKeys) {
TEST(PrioEncoder, BadPublicKeys)
{
mozilla::dom::AutoJSAPI jsAPI;
ASSERT_TRUE(jsAPI.Init(xpc::PrivilegedJunkScope()));
JSContext* cx = jsAPI.cx();
@ -46,7 +47,8 @@ TEST(PrioEncoder, BadPublicKeys) {
rv = mozilla::ErrorResult();
}
TEST(PrioEncoder, BooleanLimitExceeded) {
TEST(PrioEncoder, BooleanLimitExceeded)
{
mozilla::dom::AutoJSAPI jsAPI;
ASSERT_TRUE(jsAPI.Init(xpc::PrivilegedJunkScope()));
JSContext* cx = jsAPI.cx();
@ -81,7 +83,8 @@ TEST(PrioEncoder, BooleanLimitExceeded) {
rv = mozilla::ErrorResult();
}
TEST(PrioEncoder, VerifyFull) {
TEST(PrioEncoder, VerifyFull)
{
SECStatus prioRv = SECSuccess;
PublicKey pkA = nullptr;

View File

@ -27,7 +27,8 @@ void CheckOriginScopeMatchesOrigin(const OriginScope& aOriginScope,
} // namespace
TEST(QuotaManager, OriginScope) {
TEST(QuotaManager, OriginScope)
{
OriginScope originScope;
// Sanity checks.

View File

@ -12,7 +12,8 @@
using namespace mozilla;
using namespace mozilla::dom;
TEST(ReportToParser, Basic) {
TEST(ReportToParser, Basic)
{
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_NewURI(getter_AddRefs(uri), "https://example.com");

View File

@ -32,7 +32,8 @@ void CheckParser(const nsAString& aInput, bool aExpectedResults,
parsedFeatures.SwapElements(aParsedFeatures);
}
TEST(FeaturePolicyParser, Basic) {
TEST(FeaturePolicyParser, Basic)
{
nsCOMPtr<nsIPrincipal> selfPrincipal =
mozilla::BasePrincipal::CreateCodebasePrincipal(URL_SELF);
nsCOMPtr<nsIPrincipal> exampleComPrincipal =

View File

@ -176,7 +176,8 @@ nsresult runTestSuite(const PolicyTest* aPolicies, uint32_t aPolicyCount,
// ============================= TestDirectives ========================
TEST(CSPParser, Directives) {
TEST(CSPParser, Directives)
{
static const PolicyTest policies[] = {
// clang-format off
{ "connect-src xn--mnchen-3ya.de",
@ -228,7 +229,8 @@ TEST(CSPParser, Directives) {
// ============================= TestKeywords ========================
TEST(CSPParser, Keywords) {
TEST(CSPParser, Keywords)
{
static const PolicyTest policies[] = {
// clang-format off
{ "script-src 'self'",
@ -252,7 +254,8 @@ TEST(CSPParser, Keywords) {
// =================== TestIgnoreUpperLowerCasePolicies ==============
TEST(CSPParser, IgnoreUpperLowerCasePolicies) {
TEST(CSPParser, IgnoreUpperLowerCasePolicies)
{
static const PolicyTest policies[] = {
// clang-format off
{ "script-src 'SELF'",
@ -294,7 +297,8 @@ TEST(CSPParser, IgnoreUpperLowerCasePolicies) {
// ========================= TestPaths ===============================
TEST(CSPParser, Paths) {
TEST(CSPParser, Paths)
{
static const PolicyTest policies[] = {
// clang-format off
{ "script-src http://www.example.com",
@ -392,7 +396,8 @@ TEST(CSPParser, Paths) {
// ======================== TestSimplePolicies =======================
TEST(CSPParser, SimplePolicies) {
TEST(CSPParser, SimplePolicies)
{
static const PolicyTest policies[] = {
// clang-format off
{ "default-src *",
@ -468,7 +473,8 @@ TEST(CSPParser, SimplePolicies) {
// =================== TestPoliciesWithInvalidSrc ====================
TEST(CSPParser, PoliciesWithInvalidSrc) {
TEST(CSPParser, PoliciesWithInvalidSrc)
{
static const PolicyTest policies[] = {
// clang-format off
{ "script-src 'self'; SCRIPT-SRC http://www.example.com",
@ -561,7 +567,8 @@ TEST(CSPParser, PoliciesWithInvalidSrc) {
// ============================= TestBadPolicies =======================
TEST(CSPParser, BadPolicies) {
TEST(CSPParser, BadPolicies)
{
static const PolicyTest policies[] = {
// clang-format off
{ "script-sr 'self", "" },
@ -583,7 +590,8 @@ TEST(CSPParser, BadPolicies) {
// ======================= TestGoodGeneratedPolicies =================
TEST(CSPParser, GoodGeneratedPolicies) {
TEST(CSPParser, GoodGeneratedPolicies)
{
static const PolicyTest policies[] = {
// clang-format off
{ "default-src 'self'; img-src *",
@ -811,7 +819,8 @@ TEST(CSPParser, GoodGeneratedPolicies) {
// ==================== TestBadGeneratedPolicies ====================
TEST(CSPParser, BadGeneratedPolicies) {
TEST(CSPParser, BadGeneratedPolicies)
{
static const PolicyTest policies[] = {
// clang-format off
{ "foo.*.bar", ""},
@ -837,7 +846,8 @@ TEST(CSPParser, BadGeneratedPolicies) {
// ============ TestGoodGeneratedPoliciesForPathHandling =============
TEST(CSPParser, GoodGeneratedPoliciesForPathHandling) {
TEST(CSPParser, GoodGeneratedPoliciesForPathHandling)
{
// Once bug 808292 (Implement path-level host-source matching to CSP)
// lands we have to update the expected output to include the parsed path
@ -960,7 +970,8 @@ TEST(CSPParser, GoodGeneratedPoliciesForPathHandling) {
// ============== TestBadGeneratedPoliciesForPathHandling ============
TEST(CSPParser, BadGeneratedPoliciesForPathHandling) {
TEST(CSPParser, BadGeneratedPoliciesForPathHandling)
{
static const PolicyTest policies[] = {
// clang-format off
{ "img-src test1.example.com:88path-1/",
@ -989,7 +1000,8 @@ TEST(CSPParser, BadGeneratedPoliciesForPathHandling) {
// Use a policy, eliminate one character at a time,
// and feed it as input to the parser.
TEST(CSPParser, ShorteningPolicies) {
TEST(CSPParser, ShorteningPolicies)
{
char pol[] =
"default-src http://www.sub1.sub2.example.com:88/path1/path2/ "
"'unsafe-inline' 'none'";
@ -1016,7 +1028,8 @@ TEST(CSPParser, ShorteningPolicies) {
#if RUN_OFFLINE_TESTS
TEST(CSPParser, FuzzyPolicies) {
TEST(CSPParser, FuzzyPolicies)
{
// init srand with 0 so we get same results
srand(0);
@ -1048,7 +1061,8 @@ TEST(CSPParser, FuzzyPolicies) {
#if RUN_OFFLINE_TESTS
TEST(CSPParser, FuzzyPoliciesIncDir) {
TEST(CSPParser, FuzzyPoliciesIncDir)
{
// init srand with 0 so we get same results
srand(0);
@ -1086,7 +1100,8 @@ TEST(CSPParser, FuzzyPoliciesIncDir) {
#if RUN_OFFLINE_TESTS
TEST(CSPParser, FuzzyPoliciesIncDirLimASCII) {
TEST(CSPParser, FuzzyPoliciesIncDirLimASCII)
{
char input[] =
"1234567890"
"abcdefghijklmnopqrstuvwxyz"

View File

@ -26,7 +26,8 @@ struct TestExpectations {
// ============================= TestDirectives ========================
TEST(SecureContext, IsOriginPotentiallyTrustworthyWithCodeBasePrincipal) {
TEST(SecureContext, IsOriginPotentiallyTrustworthyWithCodeBasePrincipal)
{
// boolean isOriginPotentiallyTrustworthy(in nsIPrincipal aPrincipal);
static const TestExpectations uris[] = {
@ -68,7 +69,8 @@ TEST(SecureContext, IsOriginPotentiallyTrustworthyWithCodeBasePrincipal) {
}
}
TEST(SecureContext, IsOriginPotentiallyTrustworthyWithSystemPrincipal) {
TEST(SecureContext, IsOriginPotentiallyTrustworthyWithSystemPrincipal)
{
RefPtr<nsScriptSecurityManager> ssManager =
nsScriptSecurityManager::GetScriptSecurityManager();
ASSERT_TRUE(!!ssManager);
@ -84,7 +86,8 @@ TEST(SecureContext, IsOriginPotentiallyTrustworthyWithSystemPrincipal) {
ASSERT_TRUE(isPotentiallyTrustworthy);
}
TEST(SecureContext, IsOriginPotentiallyTrustworthyWithNullPrincipal) {
TEST(SecureContext, IsOriginPotentiallyTrustworthyWithNullPrincipal)
{
RefPtr<nsScriptSecurityManager> ssManager =
nsScriptSecurityManager::GetScriptSecurityManager();
ASSERT_TRUE(!!ssManager);

View File

@ -81,9 +81,11 @@ bool CreateFile(const nsACString& aData) {
return true;
}
TEST(ServiceWorkerRegistrar, TestNoFile) {
TEST(ServiceWorkerRegistrar, TestNoFile)
{
nsCOMPtr<nsIFile> file = GetFile();
ASSERT_TRUE(file) << "GetFile must return a nsIFIle";
ASSERT_TRUE(file)
<< "GetFile must return a nsIFIle";
bool exists;
nsresult rv = file->Exists(&exists);
@ -104,8 +106,10 @@ TEST(ServiceWorkerRegistrar, TestNoFile) {
<< "No data should be found in an empty file";
}
TEST(ServiceWorkerRegistrar, TestEmptyFile) {
ASSERT_TRUE(CreateFile(EmptyCString())) << "CreateFile should not fail";
TEST(ServiceWorkerRegistrar, TestEmptyFile)
{
ASSERT_TRUE(CreateFile(EmptyCString()))
<< "CreateFile should not fail";
RefPtr<ServiceWorkerRegistrarTest> swr = new ServiceWorkerRegistrarTest;
@ -117,10 +121,11 @@ TEST(ServiceWorkerRegistrar, TestEmptyFile) {
<< "No data should be found in an empty file";
}
TEST(ServiceWorkerRegistrar, TestRightVersionFile) {
TEST(ServiceWorkerRegistrar, TestRightVersionFile)
{
ASSERT_TRUE(
CreateFile(NS_LITERAL_CSTRING(SERVICEWORKERREGISTRAR_VERSION "\n")))
<< "CreateFile should not fail";
<< "CreateFile should not fail";
RefPtr<ServiceWorkerRegistrarTest> swr = new ServiceWorkerRegistrarTest;
@ -133,10 +138,11 @@ TEST(ServiceWorkerRegistrar, TestRightVersionFile) {
<< "No data should be found in an empty file";
}
TEST(ServiceWorkerRegistrar, TestWrongVersionFile) {
TEST(ServiceWorkerRegistrar, TestWrongVersionFile)
{
ASSERT_TRUE(
CreateFile(NS_LITERAL_CSTRING(SERVICEWORKERREGISTRAR_VERSION "bla\n")))
<< "CreateFile should not fail";
<< "CreateFile should not fail";
RefPtr<ServiceWorkerRegistrarTest> swr = new ServiceWorkerRegistrarTest;
@ -149,7 +155,8 @@ TEST(ServiceWorkerRegistrar, TestWrongVersionFile) {
<< "No data should be found in an empty file";
}
TEST(ServiceWorkerRegistrar, TestReadData) {
TEST(ServiceWorkerRegistrar, TestReadData)
{
nsAutoCString buffer(SERVICEWORKERREGISTRAR_VERSION "\n");
buffer.AppendLiteral("^appId=123&inBrowser=1\n");
@ -182,7 +189,8 @@ TEST(ServiceWorkerRegistrar, TestReadData) {
buffer.AppendLiteral("\n");
buffer.Append(SERVICEWORKERREGISTRAR_TERMINATOR "\n");
ASSERT_TRUE(CreateFile(buffer)) << "CreateFile should not fail";
ASSERT_TRUE(CreateFile(buffer))
<< "CreateFile should not fail";
RefPtr<ServiceWorkerRegistrarTest> swr = new ServiceWorkerRegistrarTest;
@ -233,9 +241,10 @@ TEST(ServiceWorkerRegistrar, TestReadData) {
ASSERT_EQ((int64_t)ts, data[1].lastUpdateTime());
}
TEST(ServiceWorkerRegistrar, TestDeleteData) {
TEST(ServiceWorkerRegistrar, TestDeleteData)
{
ASSERT_TRUE(CreateFile(NS_LITERAL_CSTRING("Foobar")))
<< "CreateFile should not fail";
<< "CreateFile should not fail";
RefPtr<ServiceWorkerRegistrarTest> swr = new ServiceWorkerRegistrarTest;
@ -247,10 +256,12 @@ TEST(ServiceWorkerRegistrar, TestDeleteData) {
nsresult rv = file->Exists(&exists);
ASSERT_EQ(NS_OK, rv) << "nsIFile::Exists cannot fail";
ASSERT_FALSE(exists) << "The file should not exist after a DeleteData().";
ASSERT_FALSE(exists)
<< "The file should not exist after a DeleteData().";
}
TEST(ServiceWorkerRegistrar, TestWriteData) {
TEST(ServiceWorkerRegistrar, TestWriteData)
{
{
RefPtr<ServiceWorkerRegistrarTest> swr = new ServiceWorkerRegistrarTest;
@ -332,7 +343,8 @@ TEST(ServiceWorkerRegistrar, TestWriteData) {
}
}
TEST(ServiceWorkerRegistrar, TestVersion2Migration) {
TEST(ServiceWorkerRegistrar, TestVersion2Migration)
{
nsAutoCString buffer(
"2"
"\n");
@ -349,7 +361,8 @@ TEST(ServiceWorkerRegistrar, TestVersion2Migration) {
"1\nactiveCache 1\nwaitingCache 1\n");
buffer.AppendLiteral(SERVICEWORKERREGISTRAR_TERMINATOR "\n");
ASSERT_TRUE(CreateFile(buffer)) << "CreateFile should not fail";
ASSERT_TRUE(CreateFile(buffer))
<< "CreateFile should not fail";
RefPtr<ServiceWorkerRegistrarTest> swr = new ServiceWorkerRegistrarTest;
@ -402,7 +415,8 @@ TEST(ServiceWorkerRegistrar, TestVersion2Migration) {
ASSERT_EQ((int64_t)0, data[1].lastUpdateTime());
}
TEST(ServiceWorkerRegistrar, TestVersion3Migration) {
TEST(ServiceWorkerRegistrar, TestVersion3Migration)
{
nsAutoCString buffer(
"3"
"\n");
@ -417,7 +431,8 @@ TEST(ServiceWorkerRegistrar, TestVersion3Migration) {
"spec 1\nhttps://scope_1.org\ncurrentWorkerURL 1\ncacheName 1\n");
buffer.AppendLiteral(SERVICEWORKERREGISTRAR_TERMINATOR "\n");
ASSERT_TRUE(CreateFile(buffer)) << "CreateFile should not fail";
ASSERT_TRUE(CreateFile(buffer))
<< "CreateFile should not fail";
RefPtr<ServiceWorkerRegistrarTest> swr = new ServiceWorkerRegistrarTest;
@ -468,7 +483,8 @@ TEST(ServiceWorkerRegistrar, TestVersion3Migration) {
ASSERT_EQ((int64_t)0, data[1].lastUpdateTime());
}
TEST(ServiceWorkerRegistrar, TestVersion4Migration) {
TEST(ServiceWorkerRegistrar, TestVersion4Migration)
{
nsAutoCString buffer(
"4"
"\n");
@ -483,7 +499,8 @@ TEST(ServiceWorkerRegistrar, TestVersion4Migration) {
"https://scope_1.org\ncurrentWorkerURL 1\ncacheName 1\n");
buffer.AppendLiteral(SERVICEWORKERREGISTRAR_TERMINATOR "\n");
ASSERT_TRUE(CreateFile(buffer)) << "CreateFile should not fail";
ASSERT_TRUE(CreateFile(buffer))
<< "CreateFile should not fail";
RefPtr<ServiceWorkerRegistrarTest> swr = new ServiceWorkerRegistrarTest;
@ -536,7 +553,8 @@ TEST(ServiceWorkerRegistrar, TestVersion4Migration) {
ASSERT_EQ((int64_t)0, data[1].lastUpdateTime());
}
TEST(ServiceWorkerRegistrar, TestVersion5Migration) {
TEST(ServiceWorkerRegistrar, TestVersion5Migration)
{
nsAutoCString buffer(
"5"
"\n");
@ -553,7 +571,8 @@ TEST(ServiceWorkerRegistrar, TestVersion5Migration) {
buffer.AppendLiteral("cacheName 1\n");
buffer.AppendLiteral(SERVICEWORKERREGISTRAR_TERMINATOR "\n");
ASSERT_TRUE(CreateFile(buffer)) << "CreateFile should not fail";
ASSERT_TRUE(CreateFile(buffer))
<< "CreateFile should not fail";
RefPtr<ServiceWorkerRegistrarTest> swr = new ServiceWorkerRegistrarTest;
@ -604,7 +623,8 @@ TEST(ServiceWorkerRegistrar, TestVersion5Migration) {
ASSERT_EQ((int64_t)0, data[1].lastUpdateTime());
}
TEST(ServiceWorkerRegistrar, TestVersion6Migration) {
TEST(ServiceWorkerRegistrar, TestVersion6Migration)
{
nsAutoCString buffer(
"6"
"\n");
@ -625,7 +645,8 @@ TEST(ServiceWorkerRegistrar, TestVersion6Migration) {
buffer.AppendLiteral("\n");
buffer.AppendLiteral(SERVICEWORKERREGISTRAR_TERMINATOR "\n");
ASSERT_TRUE(CreateFile(buffer)) << "CreateFile should not fail";
ASSERT_TRUE(CreateFile(buffer))
<< "CreateFile should not fail";
RefPtr<ServiceWorkerRegistrarTest> swr = new ServiceWorkerRegistrarTest;
@ -676,7 +697,8 @@ TEST(ServiceWorkerRegistrar, TestVersion6Migration) {
ASSERT_EQ((int64_t)0, data[1].lastUpdateTime());
}
TEST(ServiceWorkerRegistrar, TestVersion7Migration) {
TEST(ServiceWorkerRegistrar, TestVersion7Migration)
{
nsAutoCString buffer(
"7"
"\n");
@ -710,7 +732,8 @@ TEST(ServiceWorkerRegistrar, TestVersion7Migration) {
buffer.AppendLiteral("\n");
buffer.AppendLiteral(SERVICEWORKERREGISTRAR_TERMINATOR "\n");
ASSERT_TRUE(CreateFile(buffer)) << "CreateFile should not fail";
ASSERT_TRUE(CreateFile(buffer))
<< "CreateFile should not fail";
RefPtr<ServiceWorkerRegistrarTest> swr = new ServiceWorkerRegistrarTest;
@ -761,7 +784,8 @@ TEST(ServiceWorkerRegistrar, TestVersion7Migration) {
ASSERT_EQ((int64_t)ts, data[1].lastUpdateTime());
}
TEST(ServiceWorkerRegistrar, TestDedupeRead) {
TEST(ServiceWorkerRegistrar, TestDedupeRead)
{
nsAutoCString buffer(
"3"
"\n");
@ -793,7 +817,8 @@ TEST(ServiceWorkerRegistrar, TestDedupeRead) {
"spec 3\nhttps://scope_1.org\ncurrentWorkerURL 1\ncacheName 1\n");
buffer.AppendLiteral(SERVICEWORKERREGISTRAR_TERMINATOR "\n");
ASSERT_TRUE(CreateFile(buffer)) << "CreateFile should not fail";
ASSERT_TRUE(CreateFile(buffer))
<< "CreateFile should not fail";
RefPtr<ServiceWorkerRegistrarTest> swr = new ServiceWorkerRegistrarTest;
@ -844,7 +869,8 @@ TEST(ServiceWorkerRegistrar, TestDedupeRead) {
ASSERT_EQ((int64_t)0, data[1].lastUpdateTime());
}
TEST(ServiceWorkerRegistrar, TestDedupeWrite) {
TEST(ServiceWorkerRegistrar, TestDedupeWrite)
{
{
RefPtr<ServiceWorkerRegistrarTest> swr = new ServiceWorkerRegistrarTest;

View File

@ -1179,7 +1179,8 @@ void quick_test(TestTransactionFactory *factory) {
EXPECT_TRUE(NS_SUCCEEDED(rv));
}
TEST(TestTXMgr, SimpleTest) {
TEST(TestTXMgr, SimpleTest)
{
/*******************************************************************
*
* Initialize globals for test.
@ -1201,7 +1202,8 @@ TEST(TestTXMgr, SimpleTest) {
quick_test(&factory);
}
TEST(TestTXMgr, AggregationTest) {
TEST(TestTXMgr, AggregationTest)
{
/*******************************************************************
*
* Initialize globals for test.
@ -1806,7 +1808,8 @@ void quick_batch_test(TestTransactionFactory *factory) {
EXPECT_TRUE(NS_SUCCEEDED(rv));
}
TEST(TestTXMgr, SimpleBatchTest) {
TEST(TestTXMgr, SimpleBatchTest)
{
/*******************************************************************
*
* Initialize globals for test.
@ -1827,7 +1830,8 @@ TEST(TestTXMgr, SimpleBatchTest) {
quick_batch_test(&factory);
}
TEST(TestTXMgr, AggregationBatchTest) {
TEST(TestTXMgr, AggregationBatchTest)
{
/*******************************************************************
*
* Initialize globals for test.
@ -1919,7 +1923,8 @@ void stress_test(TestTransactionFactory *factory, int32_t iterations) {
EXPECT_TRUE(NS_SUCCEEDED(rv));
}
TEST(TestTXMgr, SimpleStressTest) {
TEST(TestTXMgr, SimpleStressTest)
{
/*******************************************************************
*
* Initialize globals for test.
@ -1949,7 +1954,8 @@ TEST(TestTXMgr, SimpleStressTest) {
stress_test(&factory, iterations);
}
TEST(TestTXMgr, AggregationStressTest) {
TEST(TestTXMgr, AggregationStressTest)
{
/*******************************************************************
*
* Initialize globals for test.
@ -1979,7 +1985,8 @@ TEST(TestTXMgr, AggregationStressTest) {
stress_test(&factory, iterations);
}
TEST(TestTXMgr, AggregationBatchStressTest) {
TEST(TestTXMgr, AggregationBatchStressTest)
{
/*******************************************************************
*
* Initialize globals for test.

View File

@ -27,7 +27,8 @@ static void TryCircle(double centerX, double centerY, double radius) {
cairo_destroy(cairo);
}
TEST(Cairo, Simple) {
TEST(Cairo, Simple)
{
TryCircle(0.0, 0.0, 14.0);
TryCircle(0.0, 1.0, 22.4);
TryCircle(1.0, 0.0, 1422.4);
@ -35,7 +36,8 @@ TEST(Cairo, Simple) {
TryCircle(-10.0, 1.0, -2);
}
TEST(Cairo, Bug825721) {
TEST(Cairo, Bug825721)
{
// OK:
TryCircle(0.0, 0.0, 8761126469220696064.0);
TryCircle(0.0, 1.0, 8761126469220696064.0);
@ -50,7 +52,8 @@ TEST(Cairo, Bug825721) {
TryCircle(0.0, 1.0, 5761126469220696064.0);
}
TEST(Cairo, Bug1063486) {
TEST(Cairo, Bug1063486)
{
double x1, y1, x2, y2;
const double epsilon = .01;

View File

@ -84,7 +84,8 @@ bool operator==(const MozPolygon& lhs, const MozPolygon& rhs) {
} // namespace gfx
} // namespace mozilla
TEST(PolygonTestUtils, TestSanity) {
TEST(PolygonTestUtils, TestSanity)
{
EXPECT_TRUE(FuzzyEquals(Point4D(0.0f, 0.0f, 0.0f, 1.0f),
Point4D(0.0f, 0.0f, 0.0f, 1.0f)));

View File

@ -156,12 +156,14 @@ static void TestArenaLimit(IterableArena::ArenaType aType,
using namespace test_arena;
TEST(Moz2D, FixedArena) {
TEST(Moz2D, FixedArena)
{
TestArenaAlloc(IterableArena::FIXED_SIZE);
TestArenaLimit(IterableArena::FIXED_SIZE, true);
}
TEST(Moz2D, GrowableArena) {
TEST(Moz2D, GrowableArena)
{
TestArenaAlloc(IterableArena::GROWABLE);
TestArenaLimit(IterableArena::GROWABLE, false);

View File

@ -11,7 +11,8 @@
using namespace mozilla::gfx;
TEST(Gfx, ArrayView) {
TEST(Gfx, ArrayView)
{
nsTArray<int> p = {5, 6};
ArrayView<int> pv(p);
ASSERT_EQ(pv[1], 6);

View File

@ -38,7 +38,8 @@ static void RunTest(std::deque<MozPolygon> aPolygons,
} // namespace
TEST(BSPTree, SameNode) {
TEST(BSPTree, SameNode)
{
const std::deque<MozPolygon> polygons{
MozPolygon{
Point4D(0.0f, 0.0f, 0.0f, 1.0f), Point4D(1.0f, 0.0f, 0.0f, 1.0f),
@ -50,7 +51,8 @@ TEST(BSPTree, SameNode) {
::RunTest(polygons, polygons);
}
TEST(BSPTree, OneChild) {
TEST(BSPTree, OneChild)
{
const MozPolygon p1{
Point4D(0.0f, 0.0f, 0.0f, 1.0f), Point4D(1.0f, 0.0f, 0.0f, 1.0f),
Point4D(1.0f, 1.0f, 0.0f, 1.0f), Point4D(0.0f, 1.0f, 0.0f, 1.0f)};
@ -63,7 +65,8 @@ TEST(BSPTree, OneChild) {
::RunTest({p2, p1}, {p1, p2});
}
TEST(BSPTree, SharedEdge1) {
TEST(BSPTree, SharedEdge1)
{
MozPolygon p1{
Point4D(1.0f, 0.0f, 1.0f, 1.0f), Point4D(0.0f, 0.0f, 1.0f, 1.0f),
Point4D(0.0f, 1.0f, 1.0f, 1.0f), Point4D(1.0f, 1.0f, 1.0f, 1.0f)};
@ -75,7 +78,8 @@ TEST(BSPTree, SharedEdge1) {
::RunTest({p1, p2}, {p1, p2});
}
TEST(BSPTree, SharedEdge2) {
TEST(BSPTree, SharedEdge2)
{
MozPolygon p1{
Point4D(1.0f, 0.0f, 1.0f, 1.0f), Point4D(0.0f, 0.0f, 1.0f, 1.0f),
Point4D(0.0f, 1.0f, 1.0f, 1.0f), Point4D(1.0f, 1.0f, 1.0f, 1.0f)};
@ -87,7 +91,8 @@ TEST(BSPTree, SharedEdge2) {
::RunTest({p1, p2}, {p2, p1});
}
TEST(BSPTree, SplitSharedEdge) {
TEST(BSPTree, SplitSharedEdge)
{
MozPolygon p1{
Point4D(1.0f, 0.0f, 1.0f, 1.0f), Point4D(0.0f, 0.0f, 1.0f, 1.0f),
Point4D(0.0f, 1.0f, 1.0f, 1.0f), Point4D(1.0f, 1.0f, 1.0f, 1.0f)};
@ -110,7 +115,8 @@ TEST(BSPTree, SplitSharedEdge) {
::RunTest({p1, p2}, expected);
}
TEST(BSPTree, SplitSimple1) {
TEST(BSPTree, SplitSimple1)
{
MozPolygon p1{
Point4D(0.0f, 0.0f, 1.0f, 1.0f), Point4D(1.0f, 0.0f, 1.0f, 1.0f),
Point4D(1.0f, 1.0f, 1.0f, 1.0f), Point4D(0.0f, 1.0f, 1.0f, 1.0f)};
@ -131,7 +137,8 @@ TEST(BSPTree, SplitSimple1) {
::RunTest({p1, p2}, expected);
}
TEST(BSPTree, SplitSimple2) {
TEST(BSPTree, SplitSimple2)
{
const std::deque<MozPolygon> polygons{
MozPolygon{Point4D(-5.00000f, -5.00000f, 0.00000f, 1.0f),
Point4D(-5.00000f, 5.00000f, 0.00000f, 1.0f),
@ -158,7 +165,8 @@ TEST(BSPTree, SplitSimple2) {
::RunTest(polygons, expected);
}
TEST(BSPTree, NoSplit1) {
TEST(BSPTree, NoSplit1)
{
const std::deque<MozPolygon> polygons{
MozPolygon{Point4D(0.00000f, 10.00000f, 0.00000f, 1.0f),
Point4D(0.00000f, 0.00000f, 0.00000f, 1.0f),
@ -189,7 +197,8 @@ TEST(BSPTree, NoSplit1) {
::RunTest(polygons, expected);
}
TEST(BSPTree, NoSplit2) {
TEST(BSPTree, NoSplit2)
{
const std::deque<MozPolygon> polygons{
MozPolygon{Point4D(-5.00000f, -5.00000f, 0.00000f, 1.0f),
Point4D(-5.00000f, 5.00000f, 0.00000f, 1.0f),
@ -212,7 +221,8 @@ TEST(BSPTree, NoSplit2) {
::RunTest(polygons, expected);
}
TEST(BSPTree, TwoPlaneIntersectRotate0degrees) {
TEST(BSPTree, TwoPlaneIntersectRotate0degrees)
{
const std::deque<MozPolygon> polygons{
MozPolygon{Point4D(-0.00000f, 2.00000f, 2.00000f, 1.0f),
Point4D(-0.00000f, -2.00000f, 2.00000f, 1.0f),
@ -235,7 +245,8 @@ TEST(BSPTree, TwoPlaneIntersectRotate0degrees) {
::RunTest(polygons, expected);
}
TEST(BSPTree, TwoPlaneIntersectRotate20degrees) {
TEST(BSPTree, TwoPlaneIntersectRotate20degrees)
{
const std::deque<MozPolygon> polygons{
MozPolygon{Point4D(-0.00000f, 1.19540f, 2.56350f, 1.0f),
Point4D(-0.00000f, -2.56340f, 1.19540f, 1.0f),
@ -258,7 +269,8 @@ TEST(BSPTree, TwoPlaneIntersectRotate20degrees) {
::RunTest(polygons, expected);
}
TEST(BSPTree, TwoPlaneIntersectRotate40degrees) {
TEST(BSPTree, TwoPlaneIntersectRotate40degrees)
{
const std::deque<MozPolygon> polygons{
MozPolygon{Point4D(-0.00000f, -0.73200f, 2.73210f, 1.0f),
Point4D(-0.00000f, -2.73200f, -0.73200f, 1.0f),
@ -281,7 +293,8 @@ TEST(BSPTree, TwoPlaneIntersectRotate40degrees) {
::RunTest(polygons, expected);
}
TEST(BSPTree, TwoPlaneIntersectRotate60degrees) {
TEST(BSPTree, TwoPlaneIntersectRotate60degrees)
{
const std::deque<MozPolygon> polygons{
MozPolygon{Point4D(-0.00000f, -2.73200f, 0.73210f, 1.0f),
Point4D(-0.00000f, -0.73200f, -2.73200f, 1.0f),
@ -308,7 +321,8 @@ TEST(BSPTree, TwoPlaneIntersectRotate60degrees) {
::RunTest(polygons, expected);
}
TEST(BSPTree, TwoPlaneIntersectRotate80degrees) {
TEST(BSPTree, TwoPlaneIntersectRotate80degrees)
{
const std::deque<MozPolygon> polygons{
MozPolygon{Point4D(-0.00000f, -1.19530f, -2.56340f, 1.0f),
Point4D(-0.00000f, 2.56350f, -1.19530f, 1.0f),
@ -331,7 +345,8 @@ TEST(BSPTree, TwoPlaneIntersectRotate80degrees) {
::RunTest(polygons, expected);
}
TEST(BSPTree, TwoPlaneIntersectRotate100degrees) {
TEST(BSPTree, TwoPlaneIntersectRotate100degrees)
{
const std::deque<MozPolygon> polygons{
MozPolygon{Point4D(-0.00000f, 2.73210f, -0.73200f, 1.0f),
Point4D(-0.00000f, 0.73210f, 2.73210f, 1.0f),
@ -358,7 +373,8 @@ TEST(BSPTree, TwoPlaneIntersectRotate100degrees) {
::RunTest(polygons, expected);
}
TEST(BSPTree, TwoPlaneIntersectRotate120degrees) {
TEST(BSPTree, TwoPlaneIntersectRotate120degrees)
{
const std::deque<MozPolygon> polygons{
MozPolygon{Point4D(-0.00000f, -0.73200f, 2.73210f, 1.0f),
Point4D(-0.00000f, -2.73200f, -0.73200f, 1.0f),
@ -381,7 +397,8 @@ TEST(BSPTree, TwoPlaneIntersectRotate120degrees) {
::RunTest(polygons, expected);
}
TEST(BSPTree, TwoPlaneIntersectRotate140degrees) {
TEST(BSPTree, TwoPlaneIntersectRotate140degrees)
{
const std::deque<MozPolygon> polygons{
MozPolygon{Point4D(-0.00000f, -1.19530f, -2.56340f, 1.0f),
Point4D(-0.00000f, 2.56350f, -1.19530f, 1.0f),
@ -404,7 +421,8 @@ TEST(BSPTree, TwoPlaneIntersectRotate140degrees) {
::RunTest(polygons, expected);
}
TEST(BSPTree, TwoPlaneIntersectRotate160degrees) {
TEST(BSPTree, TwoPlaneIntersectRotate160degrees)
{
const std::deque<MozPolygon> polygons{
MozPolygon{Point4D(-0.00000f, 2.00000f, 2.00000f, 1.0f),
Point4D(-0.00000f, -2.00000f, 2.00000f, 1.0f),
@ -427,7 +445,8 @@ TEST(BSPTree, TwoPlaneIntersectRotate160degrees) {
::RunTest(polygons, expected);
}
TEST(BSPTree, TwoPlaneIntersectRotate180degrees) {
TEST(BSPTree, TwoPlaneIntersectRotate180degrees)
{
const std::deque<MozPolygon> polygons{
MozPolygon{Point4D(-0.00000f, -2.00000f, -2.00000f, 1.0f),
Point4D(-0.00000f, 2.00000f, -2.00000f, 1.0f),
@ -450,7 +469,8 @@ TEST(BSPTree, TwoPlaneIntersectRotate180degrees) {
::RunTest(polygons, expected);
}
TEST(BSPTree, TwoPlaneIntersectRotate200degrees) {
TEST(BSPTree, TwoPlaneIntersectRotate200degrees)
{
const std::deque<MozPolygon> polygons{
MozPolygon{Point4D(-0.00000f, 1.19540f, 2.56350f, 1.0f),
Point4D(-0.00000f, -2.56340f, 1.19540f, 1.0f),
@ -473,7 +493,8 @@ TEST(BSPTree, TwoPlaneIntersectRotate200degrees) {
::RunTest(polygons, expected);
}
TEST(BSPTree, TwoPlaneIntersectRotate220degrees) {
TEST(BSPTree, TwoPlaneIntersectRotate220degrees)
{
const std::deque<MozPolygon> polygons{
MozPolygon{Point4D(-0.00000f, 0.73210f, -2.73200f, 1.0f),
Point4D(-0.00000f, 2.73210f, 0.73210f, 1.0f),
@ -496,7 +517,8 @@ TEST(BSPTree, TwoPlaneIntersectRotate220degrees) {
::RunTest(polygons, expected);
}
TEST(BSPTree, TwoPlaneIntersectRotate240degrees) {
TEST(BSPTree, TwoPlaneIntersectRotate240degrees)
{
const std::deque<MozPolygon> polygons{
MozPolygon{Point4D(-0.00000f, -2.73200f, 0.73210f, 1.0f),
Point4D(-0.00000f, -0.73200f, -2.73200f, 1.0f),
@ -523,7 +545,8 @@ TEST(BSPTree, TwoPlaneIntersectRotate240degrees) {
::RunTest(polygons, expected);
}
TEST(BSPTree, TwoPlaneIntersectRotate260degrees) {
TEST(BSPTree, TwoPlaneIntersectRotate260degrees)
{
const std::deque<MozPolygon> polygons{
MozPolygon{Point4D(-0.00000f, 1.19540f, 2.56350f, 1.0f),
Point4D(-0.00000f, -2.56340f, 1.19540f, 1.0f),
@ -546,7 +569,8 @@ TEST(BSPTree, TwoPlaneIntersectRotate260degrees) {
::RunTest(polygons, expected);
}
TEST(BSPTree, TwoPlaneIntersectRotate280degrees) {
TEST(BSPTree, TwoPlaneIntersectRotate280degrees)
{
const std::deque<MozPolygon> polygons{
MozPolygon{Point4D(-0.00000f, 2.73210f, -0.73200f, 1.0f),
Point4D(-0.00000f, 0.73210f, 2.73210f, 1.0f),
@ -573,7 +597,8 @@ TEST(BSPTree, TwoPlaneIntersectRotate280degrees) {
::RunTest(polygons, expected);
}
TEST(BSPTree, TwoPlaneIntersectRotate300degrees) {
TEST(BSPTree, TwoPlaneIntersectRotate300degrees)
{
const std::deque<MozPolygon> polygons{
MozPolygon{Point4D(-0.00000f, 0.73210f, -2.73200f, 1.0f),
Point4D(-0.00000f, 2.73210f, 0.73210f, 1.0f),
@ -596,7 +621,8 @@ TEST(BSPTree, TwoPlaneIntersectRotate300degrees) {
::RunTest(polygons, expected);
}
TEST(BSPTree, TwoPlaneIntersectRotate320degrees) {
TEST(BSPTree, TwoPlaneIntersectRotate320degrees)
{
const std::deque<MozPolygon> polygons{
MozPolygon{Point4D(-0.00000f, -1.19530f, -2.56340f, 1.0f),
Point4D(-0.00000f, 2.56350f, -1.19530f, 1.0f),
@ -619,7 +645,8 @@ TEST(BSPTree, TwoPlaneIntersectRotate320degrees) {
::RunTest(polygons, expected);
}
TEST(BSPTree, TwoPlaneIntersectRotate340degrees) {
TEST(BSPTree, TwoPlaneIntersectRotate340degrees)
{
const std::deque<MozPolygon> polygons{
MozPolygon{Point4D(-0.00000f, -2.00000f, -2.00000f, 1.0f),
Point4D(-0.00000f, 2.00000f, -2.00000f, 1.0f),
@ -642,7 +669,8 @@ TEST(BSPTree, TwoPlaneIntersectRotate340degrees) {
::RunTest(polygons, expected);
}
TEST(BSPTree, TwoPlaneIntersectRotate360degrees) {
TEST(BSPTree, TwoPlaneIntersectRotate360degrees)
{
const std::deque<MozPolygon> polygons{
MozPolygon{Point4D(-0.00000f, -2.00000f, -2.00000f, 1.0f),
Point4D(-0.00000f, 2.00000f, -2.00000f, 1.0f),

View File

@ -43,7 +43,8 @@ static bool CheckBuffer(unsigned char* buffer, int bytesPerPixel, int width,
return true;
}
TEST(Gfx, BufferUnrotateHorizontal) {
TEST(Gfx, BufferUnrotateHorizontal)
{
const int NUM_OF_TESTS = 8;
int bytesPerPixelList[2] = {2, 4};
int width[NUM_OF_TESTS] = {100, 100, 99, 99, 100, 100, 99, 99};
@ -69,7 +70,8 @@ TEST(Gfx, BufferUnrotateHorizontal) {
}
}
TEST(Gfx, BufferUnrotateVertical) {
TEST(Gfx, BufferUnrotateVertical)
{
const int NUM_OF_TESTS = 8;
int bytesPerPixelList[2] = {2, 4};
int width[NUM_OF_TESTS] = {100, 100, 99, 99, 100, 100, 99, 99};
@ -95,7 +97,8 @@ TEST(Gfx, BufferUnrotateVertical) {
}
}
TEST(Gfx, BufferUnrotateBoth) {
TEST(Gfx, BufferUnrotateBoth)
{
const int NUM_OF_TESTS = 16;
int bytesPerPixelList[2] = {2, 4};
int width[NUM_OF_TESTS] = {100, 100, 99, 99, 100, 100, 99, 99,
@ -125,7 +128,8 @@ TEST(Gfx, BufferUnrotateBoth) {
}
}
TEST(Gfx, BufferUnrotateUneven) {
TEST(Gfx, BufferUnrotateUneven)
{
const int NUM_OF_TESTS = 16;
int bytesPerPixelList[2] = {2, 4};
int width[NUM_OF_TESTS] = {10, 100, 99, 39, 100, 40, 99, 39,

View File

@ -44,18 +44,16 @@ static void RunColorTests() {
// Check that color lookup by name gets the right rgb value
ASSERT_TRUE(NS_ColorNameToRGB(NS_ConvertASCIItoUTF16(tagName), &rgb))
<< "can't find '" << tagName.get() << "'";
<< "can't find '" << tagName.get() << "'";
ASSERT_TRUE((rgb == kColors[index]))
<< "failed at index " << index << " out of "
<< ArrayLength(kColorNames);
<< "failed at index " << index << " out of " << ArrayLength(kColorNames);
// fiddle with the case to make sure we can still find it
tagName.SetCharAt(tagName.CharAt(0) - 32, 0);
ASSERT_TRUE(NS_ColorNameToRGB(NS_ConvertASCIItoUTF16(tagName), &rgb))
<< "can't find '" << tagName.get() << "'";
<< "can't find '" << tagName.get() << "'";
ASSERT_TRUE((rgb == kColors[index]))
<< "failed at index " << index << " out of "
<< ArrayLength(kColorNames);
<< "failed at index " << index << " out of " << ArrayLength(kColorNames);
// Check that parsing an RGB value in hex gets the right values
uint8_t r = NS_GET_R(rgb);
@ -71,7 +69,7 @@ static void RunColorTests() {
nscolor hexrgb;
ASSERT_TRUE(NS_HexToRGBA(NS_ConvertASCIItoUTF16(cbuf),
nsHexColorType::AllowAlpha, &hexrgb))
<< "hex conversion to color of '" << cbuf << "'";
<< "hex conversion to color of '" << cbuf << "'";
ASSERT_TRUE(hexrgb == rgb);
}
}
@ -82,10 +80,12 @@ static void RunJunkColorTests() {
for (uint32_t i = 0; i < ArrayLength(kJunkNames); i++) {
nsCString tag(kJunkNames[i]);
ASSERT_FALSE(NS_ColorNameToRGB(NS_ConvertASCIItoUTF16(tag), &rgb))
<< "Failed at junk color " << kJunkNames[i];
<< "Failed at junk color " << kJunkNames[i];
}
}
TEST(Gfx, ColorNames) { RunColorTests(); }
TEST(Gfx, ColorNames)
{ RunColorTests(); }
TEST(Gfx, JunkColorNames) { RunJunkColorTests(); }
TEST(Gfx, JunkColorNames)
{ RunJunkColorTests(); }

View File

@ -161,11 +161,11 @@ static bool CompositeAndCompare(RefPtr<LayerManagerComposite> layerManager,
return true;
}
TEST(Gfx, CompositorConstruct) {
auto layerManagers = GetLayerManagers(GetPlatformBackends());
}
TEST(Gfx, CompositorConstruct)
{ auto layerManagers = GetLayerManagers(GetPlatformBackends()); }
TEST(Gfx, CompositorSimpleTree) {
TEST(Gfx, CompositorSimpleTree)
{
auto layerManagers = GetLayerManagers(GetPlatformBackends());
for (size_t i = 0; i < layerManagers.size(); i++) {
RefPtr<LayerManagerComposite> layerManager = layerManagers[i].mLayerManager;

View File

@ -16,12 +16,14 @@
// a particular value to make sure we receive the correct
// result through this API.
TEST(GfxPrefs, Singleton) {
TEST(GfxPrefs, Singleton)
{
gfxPrefs::GetSingleton();
ASSERT_TRUE(gfxPrefs::SingletonExists());
}
TEST(GfxPrefs, LiveValues) {
TEST(GfxPrefs, LiveValues)
{
gfxPrefs::GetSingleton();
ASSERT_TRUE(gfxPrefs::SingletonExists());
@ -35,7 +37,8 @@ TEST(GfxPrefs, LiveValues) {
ASSERT_TRUE(gfxPrefs::MSAALevel() == 2);
}
TEST(GfxPrefs, OnceValues) {
TEST(GfxPrefs, OnceValues)
{
gfxPrefs::GetSingleton();
ASSERT_TRUE(gfxPrefs::SingletonExists());
@ -52,7 +55,8 @@ TEST(GfxPrefs, OnceValues) {
ASSERT_TRUE(gfxPrefs::APZMaxVelocity() == -1.0f);
}
TEST(GfxPrefs, Set) {
TEST(GfxPrefs, Set)
{
gfxPrefs::GetSingleton();
ASSERT_TRUE(gfxPrefs::SingletonExists());
@ -80,7 +84,8 @@ TEST(GfxPrefs, Set) {
// Randomly test the function we use in nsExceptionHandler.cpp here:
extern bool SimpleNoCLibDtoA(double aValue, char* aBuffer, int aBufferLength);
TEST(GfxPrefs, StringUtility) {
TEST(GfxPrefs, StringUtility)
{
char testBuffer[64];
double testVal[] = {
13.4,

View File

@ -10,7 +10,8 @@
using namespace mozilla::widget;
TEST(GfxWidgets, Split) {
TEST(GfxWidgets, Split)
{
char aStr[8], bStr[8], cStr[8], dStr[8];
ASSERT_TRUE(SplitDriverVersion("33.4.3.22", aStr, bStr, cStr, dStr));
@ -75,7 +76,8 @@ TEST(GfxWidgets, Split) {
atoi(dStr) == 0);
}
TEST(GfxWidgets, Versioning) {
TEST(GfxWidgets, Versioning)
{
ASSERT_TRUE(mozilla::Version("0") < mozilla::Version("41.0a1"));
ASSERT_TRUE(mozilla::Version("39.0.5b7") < mozilla::Version("41.0a1"));
ASSERT_TRUE(mozilla::Version("18.0.5b7") < mozilla::Version("18.2"));

View File

@ -198,7 +198,8 @@ static void TestSchedulerChain(uint32_t aNumThreads, uint32_t aNumCmdBuffers) {
} // namespace test_scheduler
#if !defined(MOZ_CODE_COVERAGE) || !defined(XP_WIN)
TEST(Moz2D, JobScheduler_Shutdown) {
TEST(Moz2D, JobScheduler_Shutdown)
{
srand(time(nullptr));
for (uint32_t threads = 1; threads < 16; ++threads) {
for (uint32_t i = 1; i < 1000; ++i) {
@ -209,7 +210,8 @@ TEST(Moz2D, JobScheduler_Shutdown) {
}
#endif
TEST(Moz2D, JobScheduler_Join) {
TEST(Moz2D, JobScheduler_Join)
{
srand(time(nullptr));
for (uint32_t threads = 1; threads < 8; ++threads) {
for (uint32_t queues = 1; queues < threads; ++queues) {
@ -222,7 +224,8 @@ TEST(Moz2D, JobScheduler_Join) {
}
}
TEST(Moz2D, JobScheduler_Chain) {
TEST(Moz2D, JobScheduler_Chain)
{
srand(time(nullptr));
for (uint32_t threads = 1; threads < 8; ++threads) {
for (uint32_t queues = 1; queues < threads; ++queues) {

View File

@ -85,9 +85,11 @@ class TestUserData : public LayerUserData {
virtual ~TestUserData() { Die(); }
};
TEST(Layers, LayerConstructor) { TestContainerLayer layer(nullptr); }
TEST(Layers, LayerConstructor)
{ TestContainerLayer layer(nullptr); }
TEST(Layers, Defaults) {
TEST(Layers, Defaults)
{
TestContainerLayer layer(nullptr);
ASSERT_EQ(1.0, layer.GetOpacity());
ASSERT_EQ(1.0f, layer.GetPostXScale());
@ -99,7 +101,8 @@ TEST(Layers, Defaults) {
ASSERT_EQ(nullptr, layer.GetLastChild());
}
TEST(Layers, Transform) {
TEST(Layers, Transform)
{
TestContainerLayer layer(nullptr);
Matrix4x4 identity;
@ -108,14 +111,16 @@ TEST(Layers, Transform) {
ASSERT_EQ(identity, layer.GetTransform());
}
TEST(Layers, Type) {
TEST(Layers, Type)
{
TestContainerLayer layer(nullptr);
ASSERT_EQ(nullptr, layer.AsPaintedLayer());
ASSERT_EQ(nullptr, layer.AsRefLayer());
ASSERT_EQ(nullptr, layer.AsColorLayer());
}
TEST(Layers, UserData) {
TEST(Layers, UserData)
{
UniquePtr<TestContainerLayer> layerPtr(new TestContainerLayer(nullptr));
TestContainerLayer& layer = *layerPtr;
@ -235,7 +240,8 @@ already_AddRefed<Layer> CreateLayerTree(const char* aLayerTreeDescription,
return rootLayer.forget();
}
TEST(Layers, LayerTree) {
TEST(Layers, LayerTree)
{
const char* layerTreeSyntax = "c(c(tt))";
nsIntRegion layerVisibleRegion[] = {
nsIntRegion(IntRect(0, 0, 100, 100)),
@ -289,7 +295,8 @@ static void ValidateTreePointers(nsTArray<RefPtr<Layer> >& aLayers) {
}
}
TEST(Layers, RepositionChild) {
TEST(Layers, RepositionChild)
{
const char* layerTreeSyntax = "c(ttt)";
nsTArray<RefPtr<Layer> > layers;

View File

@ -10,7 +10,8 @@
#include "TestScaling.h"
#include "TestBugs.h"
TEST(Moz2D, Bugs) {
TEST(Moz2D, Bugs)
{
TestBugs* test = new TestBugs();
int failures = 0;
test->RunTests(&failures);
@ -19,7 +20,8 @@ TEST(Moz2D, Bugs) {
ASSERT_EQ(failures, 0);
}
TEST(Moz2D, Point) {
TEST(Moz2D, Point)
{
TestBase* test = new TestPoint();
int failures = 0;
test->RunTests(&failures);
@ -28,7 +30,8 @@ TEST(Moz2D, Point) {
ASSERT_EQ(failures, 0);
}
TEST(Moz2D, Scaling) {
TEST(Moz2D, Scaling)
{
TestBase* test = new TestScaling();
int failures = 0;
test->RunTests(&failures);

View File

@ -16,7 +16,8 @@
using namespace mozilla::gfx;
typedef mozilla::gfx::Polygon MozPolygon;
TEST(MozPolygon, TriangulateRectangle) {
TEST(MozPolygon, TriangulateRectangle)
{
const MozPolygon p{
Point4D(0.0f, 0.0f, 1.0f, 1.0f), Point4D(0.0f, 1.0f, 1.0f, 1.0f),
Point4D(1.0f, 1.0f, 1.0f, 1.0f), Point4D(1.0f, 0.0f, 1.0f, 1.0f)};
@ -29,7 +30,8 @@ TEST(MozPolygon, TriangulateRectangle) {
AssertArrayEQ(triangles, expected);
}
TEST(MozPolygon, TriangulatePentagon) {
TEST(MozPolygon, TriangulatePentagon)
{
const MozPolygon p{
Point4D(0.0f, 0.0f, 1.0f, 1.0f), Point4D(0.0f, 1.0f, 1.0f, 1.0f),
Point4D(0.5f, 1.5f, 1.0f, 1.0f), Point4D(1.0f, 1.0f, 1.0f, 1.0f),
@ -50,7 +52,8 @@ static void TestClipRect(const MozPolygon& aPolygon,
EXPECT_TRUE(res == aExpected);
}
TEST(MozPolygon, ClipRectangle) {
TEST(MozPolygon, ClipRectangle)
{
MozPolygon polygon{
Point4D(0.0f, 0.0f, 0.0f, 1.0f), Point4D(0.0f, 1.0f, 0.0f, 1.0f),
Point4D(1.0f, 1.0f, 0.0f, 1.0f), Point4D(1.0f, 0.0f, 0.0f, 1.0f)};
@ -72,7 +75,8 @@ TEST(MozPolygon, ClipRectangle) {
TestClipRect(polygon, expected, Rect(0.2f, 0.2f, 0.6f, 0.6f));
}
TEST(MozPolygon, ClipTriangle) {
TEST(MozPolygon, ClipTriangle)
{
MozPolygon clipped, expected;
const MozPolygon polygon{Point4D(0.0f, 0.0f, 0.0f, 1.0f),
Point4D(0.0f, 1.0f, 0.0f, 1.0f),

View File

@ -29,7 +29,8 @@ static unsigned char* createAllGB() {
return buff;
}
TEST(GfxQcms, Identity) {
TEST(GfxQcms, Identity)
{
// XXX: This means that we can't have qcms v2 unit test
// without changing the qcms API.
qcms_enable_iccv4();
@ -60,7 +61,8 @@ TEST(GfxQcms, Identity) {
free(data_out);
}
TEST(GfxQcms, LutInverseCrash) {
TEST(GfxQcms, LutInverseCrash)
{
uint16_t lutTable1[] = {
0x0000, 0x0000, 0x0000, 0x8000, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
@ -103,7 +105,8 @@ TEST(GfxQcms, LutInverseCrash) {
(int)mozilla::ArrayLength(lutTable2));
}
TEST(GfxQcms, LutInverse) {
TEST(GfxQcms, LutInverse)
{
// mimic sRGB_v4_ICC mBA Output
//
// XXXX
@ -144,7 +147,8 @@ TEST(GfxQcms, LutInverse) {
EXPECT_LT(value, 201 * 256);
}
TEST(GfxQcms, LutInverseNonMonotonic) {
TEST(GfxQcms, LutInverseNonMonotonic)
{
// Make sure we behave sanely for non monotic functions
// X X X
// X X X

View File

@ -552,7 +552,8 @@ static void TestIntersectionLogical(nscoord x1, nscoord y1, nscoord w1,
isNonEmpty);
}
TEST(Gfx, Logical) {
TEST(Gfx, Logical)
{
TestIntersectionLogical(578, 0, 2650, 1152, 1036, 0, 2312, 1, 1036, 0, 2192,
1, true);
TestIntersectionLogical(0, 0, 1000, 1000, 500, 500, 1000, 1000, 500, 500, 500,
@ -563,7 +564,8 @@ TEST(Gfx, Logical) {
false);
}
TEST(Gfx, nsRect) {
TEST(Gfx, nsRect)
{
TestConstructors<nsRect>();
TestEqualityOperator<nsRect>();
TestContainment<nsRect>();
@ -575,7 +577,8 @@ TEST(Gfx, nsRect) {
TestSwap<nsRect>();
}
TEST(Gfx, nsIntRect) {
TEST(Gfx, nsIntRect)
{
TestConstructors<nsIntRect>();
TestEqualityOperator<nsIntRect>();
TestContainment<nsIntRect>();
@ -587,7 +590,8 @@ TEST(Gfx, nsIntRect) {
TestSwap<nsIntRect>();
}
TEST(Gfx, gfxRect) {
TEST(Gfx, gfxRect)
{
TestConstructors<gfxRect>();
// Skip TestEqualityOperator<gfxRect>(); as gfxRect::operator== is private
TestContainment<gfxRect>();
@ -620,7 +624,8 @@ static void TestMoveInsideAndClamp(IntRect aSrc, IntRect aTarget,
<< absExpected << " AbsActual " << absResult;
}
TEST(Gfx, MoveInsideAndClamp) {
TEST(Gfx, MoveInsideAndClamp)
{
TestMoveInsideAndClamp(IntRect(0, 0, 10, 10), IntRect(1, -1, 10, 10),
IntRect(1, -1, 10, 10));
TestMoveInsideAndClamp(IntRect(0, 0, 10, 10), IntRect(-1, -1, 12, 5),

View File

@ -114,7 +114,8 @@ class TestLargestRegion {
}
};
TEST(Gfx, RegionSingleRect) {
TEST(Gfx, RegionSingleRect)
{
TestLargestRegion::TestSingleRect(nsRect(0, 52, 720, 480));
TestLargestRegion::TestSingleRect(nsRect(-20, 40, 50, 20));
TestLargestRegion::TestSingleRect(nsRect(-20, 40, 10, 8));
@ -122,19 +123,20 @@ TEST(Gfx, RegionSingleRect) {
TestLargestRegion::TestSingleRect(nsRect(-10, -10, 20, 20));
}
TEST(Gfx, RegionNonRectangular) { TestLargestRegion::TestNonRectangular(); }
TEST(Gfx, RegionNonRectangular)
{ TestLargestRegion::TestNonRectangular(); }
TEST(Gfx, RegionTwoRectTest) { TestLargestRegion::TwoRectTest(); }
TEST(Gfx, RegionTwoRectTest)
{ TestLargestRegion::TwoRectTest(); }
TEST(Gfx, RegionContainsSpecifiedRect) {
TestLargestRegion::TestContainsSpecifiedRect();
}
TEST(Gfx, RegionContainsSpecifiedRect)
{ TestLargestRegion::TestContainsSpecifiedRect(); }
TEST(Gfx, RegionTestContainsSpecifiedOverflowingRect) {
TestLargestRegion::TestContainsSpecifiedOverflowingRect();
}
TEST(Gfx, RegionTestContainsSpecifiedOverflowingRect)
{ TestLargestRegion::TestContainsSpecifiedOverflowingRect(); }
TEST(Gfx, RegionScaleToInside) {
TEST(Gfx, RegionScaleToInside)
{
{ // no rectangles
nsRegion r;
@ -176,7 +178,8 @@ TEST(Gfx, RegionScaleToInside) {
}
}
TEST(Gfx, RegionIsEqual) {
TEST(Gfx, RegionIsEqual)
{
{
nsRegion r(nsRect(0, 0, 50, 50));
EXPECT_FALSE(nsRegion().IsEqual(r));
@ -215,7 +218,8 @@ TEST(Gfx, RegionIsEqual) {
}
}
TEST(Gfx, RegionOrWith) {
TEST(Gfx, RegionOrWith)
{
PR_Sleep(PR_SecondsToInterval(10));
{
nsRegion r(nsRect(11840, 11840, 4640, -10880));
@ -333,7 +337,8 @@ TEST(Gfx, RegionOrWith) {
#endif
}
TEST(Gfx, RegionSubWith) {
TEST(Gfx, RegionSubWith)
{
{
nsRegion r1(nsRect(0, 0, 100, 50));
r1.OrWith(nsRect(50, 50, 50, 50));
@ -588,7 +593,8 @@ TEST(Gfx, RegionSubWith) {
}
#endif
}
TEST(Gfx, RegionSub) {
TEST(Gfx, RegionSub)
{
{
nsRegion r1(nsRect(0, 0, 100, 50));
r1.OrWith(nsRect(50, 50, 50, 50));
@ -784,7 +790,8 @@ TEST(Gfx, RegionSub) {
#endif
}
TEST(Gfx, RegionAndWith) {
TEST(Gfx, RegionAndWith)
{
{
nsRegion r(nsRect(20, 0, 20, 20));
r.OrWith(nsRect(0, 20, 40, 20));
@ -865,7 +872,8 @@ TEST(Gfx, RegionAndWith) {
#endif
}
TEST(Gfx, RegionAnd) {
TEST(Gfx, RegionAnd)
{
{
nsRegion r(nsRect(20, 0, 20, 20));
r.OrWith(nsRect(0, 20, 40, 20));
@ -963,7 +971,8 @@ TEST(Gfx, RegionAnd) {
#endif
}
TEST(Gfx, RegionSimplify) {
TEST(Gfx, RegionSimplify)
{
{ // ensure simplify works on a single rect
nsRegion r(nsRect(0, 100, 200, 100));
@ -1065,7 +1074,8 @@ TEST(Gfx, RegionSimplify) {
}
}
TEST(Gfx, RegionContains) {
TEST(Gfx, RegionContains)
{
{ // ensure Contains works on a simple region
nsRegion r(nsRect(0, 0, 100, 100));
@ -1235,7 +1245,8 @@ static void TestVisit(nsRegion &r) {
res.compare(ref);
}
TEST(Gfx, RegionVisitEdges) {
TEST(Gfx, RegionVisitEdges)
{
{ // visit edges
nsRegion r(nsRect(20, 20, 100, 100));
r.Or(r, nsRect(20, 120, 200, 100));
@ -1340,7 +1351,8 @@ TEST(Gfx, RegionVisitEdges) {
// The TiledRegion tests use nsIntRect / IntRegion because nsRect doesn't have
// InflateToMultiple which is required by TiledRegion.
TEST(Gfx, TiledRegionNoSimplification2Rects) {
TEST(Gfx, TiledRegionNoSimplification2Rects)
{
// Add two rectangles, both rectangles are completely inside
// different tiles.
nsIntRegion region;
@ -1355,7 +1367,8 @@ TEST(Gfx, TiledRegionNoSimplification2Rects) {
EXPECT_TRUE(region.IsEqual(tiledRegion.GetRegion()));
}
TEST(Gfx, TiledRegionNoSimplification1Region) {
TEST(Gfx, TiledRegionNoSimplification1Region)
{
// Add two rectangles, both rectangles are completely inside
// different tiles.
nsIntRegion region;
@ -1369,7 +1382,8 @@ TEST(Gfx, TiledRegionNoSimplification1Region) {
EXPECT_TRUE(region.IsEqual(tiledRegion.GetRegion()));
}
TEST(Gfx, TiledRegionWithSimplification3Rects) {
TEST(Gfx, TiledRegionWithSimplification3Rects)
{
// Add three rectangles. The first two rectangles are completely inside
// different tiles, but the third rectangle intersects both tiles.
TiledIntRegion tiledRegion;
@ -1382,7 +1396,8 @@ TEST(Gfx, TiledRegionWithSimplification3Rects) {
EXPECT_TRUE(tiledRegion.GetRegion().IsEqual(nsIntRect(50, 50, 300, 50)));
}
TEST(Gfx, TiledRegionWithSimplification1Region) {
TEST(Gfx, TiledRegionWithSimplification1Region)
{
// Add three rectangles. The first two rectangles are completely inside
// different tiles, but the third rectangle intersects both tiles.
nsIntRegion region;
@ -1398,7 +1413,8 @@ TEST(Gfx, TiledRegionWithSimplification1Region) {
EXPECT_TRUE(tiledRegion.GetRegion().IsEqual(nsIntRect(50, 50, 300, 50)));
}
TEST(Gfx, TiledRegionContains) {
TEST(Gfx, TiledRegionContains)
{
// Add three rectangles. The first two rectangles are completely inside
// different tiles, but the third rectangle intersects both tiles.
TiledIntRegion tiledRegion;
@ -1413,7 +1429,8 @@ TEST(Gfx, TiledRegionContains) {
EXPECT_FALSE(tiledRegion.Contains(nsIntRect(50, 50, 301, 50)));
}
TEST(Gfx, TiledRegionIntersects) {
TEST(Gfx, TiledRegionIntersects)
{
// Add three rectangles. The first two rectangles are completely inside
// different tiles, but the third rectangle intersects both tiles.
TiledIntRegion tiledRegion;
@ -1429,7 +1446,8 @@ TEST(Gfx, TiledRegionIntersects) {
EXPECT_FALSE(tiledRegion.Intersects(nsIntRect(0, 0, 50, 500)));
}
TEST(Gfx, TiledRegionBoundaryConditions1) {
TEST(Gfx, TiledRegionBoundaryConditions1)
{
TiledIntRegion tiledRegion;
// This one works fine
tiledRegion.Add(nsIntRegion(nsIntRect(INT_MIN, INT_MIN, 1, 1)));
@ -1444,7 +1462,8 @@ TEST(Gfx, TiledRegionBoundaryConditions1) {
EXPECT_FALSE(tiledRegion.Contains(nsIntRect(0, 0, 1, 1)));
}
TEST(Gfx, TiledRegionBoundaryConditions2) {
TEST(Gfx, TiledRegionBoundaryConditions2)
{
TiledIntRegion tiledRegion;
// This one works fine
tiledRegion.Add(nsIntRegion(nsIntRect(INT_MAX - 1, INT_MIN, 1, 1)));
@ -1457,7 +1476,8 @@ TEST(Gfx, TiledRegionBoundaryConditions2) {
EXPECT_FALSE(tiledRegion.Contains(nsIntRect(0, 0, 1, 1)));
}
TEST(Gfx, TiledRegionBigRects) {
TEST(Gfx, TiledRegionBigRects)
{
TiledIntRegion tiledRegion;
// Super wide region, forces simplification into bounds mode
tiledRegion.Add(nsIntRegion(nsIntRect(INT_MIN, INT_MIN, INT_MAX, 100)));
@ -1474,7 +1494,8 @@ TEST(Gfx, TiledRegionBigRects) {
EXPECT_FALSE(tiledRegion.Contains(nsIntRect(-2, INT_MIN + 201, 1, 1)));
}
TEST(Gfx, TiledRegionBoundaryOverflow) {
TEST(Gfx, TiledRegionBoundaryOverflow)
{
TiledIntRegion tiledRegion;
tiledRegion.Add(nsIntRegion(nsIntRect(100, 100, 1, 1)));
EXPECT_TRUE(tiledRegion.Contains(nsIntRect(100, 100, 1, 1)));
@ -1495,7 +1516,8 @@ TEST(Gfx, TiledRegionBoundaryOverflow) {
EXPECT_FALSE(tiledRegion.Contains(nsIntRect(0, 0, 1, 1)));
}
TEST(Gfx, TiledRegionNegativeRect) {
TEST(Gfx, TiledRegionNegativeRect)
{
TiledIntRegion tiledRegion;
// The next region is invalid, so it gets ignored
tiledRegion.Add(nsIntRegion(nsIntRect(0, 0, -500, -500)));

View File

@ -148,7 +148,8 @@ static bool TestIterator() {
return true;
}
TEST(Gfx, gfxSkipChars) {
TEST(Gfx, gfxSkipChars)
{
TestConstructor();
TestLength();
TestIterator();

View File

@ -11,7 +11,8 @@
using namespace mozilla;
using namespace mozilla::gfx;
TEST(Moz2D, PremultiplyData) {
TEST(Moz2D, PremultiplyData)
{
const uint8_t in_bgra[5 * 4] = {
255, 255, 0, 255, // verify 255 alpha leaves RGB unchanged
0, 0, 255, 255,
@ -44,7 +45,8 @@ TEST(Moz2D, PremultiplyData) {
EXPECT_TRUE(ArrayEqual(out, check_argb));
}
TEST(Moz2D, UnpremultiplyData) {
TEST(Moz2D, UnpremultiplyData)
{
const uint8_t in_bgra[5 * 4] = {
255, 255, 0, 255, // verify 255 alpha leaves RGB unchanged
0, 0, 255, 255, 0, 0, 0, 0, // verify 0 alpha leaves RGB at 0
@ -77,7 +79,8 @@ TEST(Moz2D, UnpremultiplyData) {
EXPECT_TRUE(ArrayEqual(out, check_argb));
}
TEST(Moz2D, SwizzleData) {
TEST(Moz2D, SwizzleData)
{
const uint8_t in_bgra[5 * 4] = {
253, 254, 0, 255, 0, 0, 255, 255, 0, 0, 0, 0, 1, 2, 3, 64, 127, 0, 9, 128,

View File

@ -107,7 +107,8 @@ static void CheckCompatibilityWithBasicCompositor(
}
}
TEST(Gfx, TestTextureCompatibility) {
TEST(Gfx, TestTextureCompatibility)
{
nsTArray<LayersBackend> backendHints;
RefPtr<TestSurfaceAllocator> deallocator = new TestSurfaceAllocator();

View File

@ -213,7 +213,8 @@ void TestTextureClientYCbCr(TextureClient* client, PlanarYCbCrData& ycbcrData) {
} // namespace layers
} // namespace mozilla
TEST(Layers, TextureSerialization) {
TEST(Layers, TextureSerialization)
{
// the test is run on all the following image formats
gfxImageFormat formats[3] = {
SurfaceFormat::A8R8G8B8_UINT32,
@ -242,7 +243,8 @@ TEST(Layers, TextureSerialization) {
}
}
TEST(Layers, TextureYCbCrSerialization) {
TEST(Layers, TextureYCbCrSerialization)
{
RefPtr<gfxImageSurface> ySurface =
new gfxImageSurface(IntSize(400, 300), SurfaceFormat::A8);
RefPtr<gfxImageSurface> cbSurface =

View File

@ -238,7 +238,8 @@ typedef TestNodeReverse<ForEachNodeType> ForEachTestNodeReverse;
typedef TestNodeForward<SearchNodeType> SearchTestNodeForward;
typedef TestNodeForward<ForEachNodeType> ForEachTestNodeForward;
TEST(TreeTraversal, DepthFirstSearchNull) {
TEST(TreeTraversal, DepthFirstSearchNull)
{
RefPtr<SearchTestNodeReverse> nullNode;
RefPtr<SearchTestNodeReverse> result =
DepthFirstSearch<layers::ReverseIterator>(
@ -249,7 +250,8 @@ TEST(TreeTraversal, DepthFirstSearchNull) {
<< "Null root did not return null search result.";
}
TEST(TreeTraversal, DepthFirstSearchValueExists) {
TEST(TreeTraversal, DepthFirstSearchValueExists)
{
int visitCount = 0;
size_t expectedNeedleTraversalRank = 7;
RefPtr<SearchTestNodeForward> needleNode;
@ -297,7 +299,8 @@ TEST(TreeTraversal, DepthFirstSearchValueExists) {
"happened).";
}
TEST(TreeTraversal, DepthFirstSearchValueExistsReverse) {
TEST(TreeTraversal, DepthFirstSearchValueExistsReverse)
{
int visitCount = 0;
size_t expectedNeedleTraversalRank = 7;
RefPtr<SearchTestNodeReverse> needleNode;
@ -345,7 +348,8 @@ TEST(TreeTraversal, DepthFirstSearchValueExistsReverse) {
"happened).";
}
TEST(TreeTraversal, DepthFirstSearchRootIsNeedle) {
TEST(TreeTraversal, DepthFirstSearchRootIsNeedle)
{
RefPtr<SearchTestNodeReverse> root =
new SearchTestNodeReverse(SearchNodeType::Needle, 0);
RefPtr<SearchTestNodeReverse> childNode1 =
@ -371,7 +375,8 @@ TEST(TreeTraversal, DepthFirstSearchRootIsNeedle) {
<< "Search starting at needle continued past needle.";
}
TEST(TreeTraversal, DepthFirstSearchValueDoesNotExist) {
TEST(TreeTraversal, DepthFirstSearchValueDoesNotExist)
{
int visitCount = 0;
std::vector<RefPtr<SearchTestNodeForward>> nodeList;
nodeList.reserve(10);
@ -408,7 +413,8 @@ TEST(TreeTraversal, DepthFirstSearchValueDoesNotExist) {
<< "Search found something that should not exist.";
}
TEST(TreeTraversal, DepthFirstSearchValueDoesNotExistReverse) {
TEST(TreeTraversal, DepthFirstSearchValueDoesNotExistReverse)
{
int visitCount = 0;
std::vector<RefPtr<SearchTestNodeReverse>> nodeList;
nodeList.reserve(10);
@ -445,7 +451,8 @@ TEST(TreeTraversal, DepthFirstSearchValueDoesNotExistReverse) {
<< "Search found something that should not exist.";
}
TEST(TreeTraversal, DepthFirstSearchPostOrderNull) {
TEST(TreeTraversal, DepthFirstSearchPostOrderNull)
{
RefPtr<SearchTestNodeReverse> nullNode;
RefPtr<SearchTestNodeReverse> result =
DepthFirstSearchPostOrder<layers::ReverseIterator>(
@ -456,7 +463,8 @@ TEST(TreeTraversal, DepthFirstSearchPostOrderNull) {
<< "Null root did not return null search result.";
}
TEST(TreeTraversal, DepthFirstSearchPostOrderValueExists) {
TEST(TreeTraversal, DepthFirstSearchPostOrderValueExists)
{
int visitCount = 0;
size_t expectedNeedleTraversalRank = 7;
RefPtr<SearchTestNodeForward> needleNode;
@ -503,7 +511,8 @@ TEST(TreeTraversal, DepthFirstSearchPostOrderValueExists) {
"happened).";
}
TEST(TreeTraversal, DepthFirstSearchPostOrderValueExistsReverse) {
TEST(TreeTraversal, DepthFirstSearchPostOrderValueExistsReverse)
{
int visitCount = 0;
size_t expectedNeedleTraversalRank = 7;
RefPtr<SearchTestNodeReverse> needleNode;
@ -550,7 +559,8 @@ TEST(TreeTraversal, DepthFirstSearchPostOrderValueExistsReverse) {
"happened).";
}
TEST(TreeTraversal, DepthFirstSearchPostOrderRootIsNeedle) {
TEST(TreeTraversal, DepthFirstSearchPostOrderRootIsNeedle)
{
RefPtr<SearchTestNodeReverse> root =
new SearchTestNodeReverse(SearchNodeType::Needle, 0);
RefPtr<SearchTestNodeReverse> childNode1 =
@ -576,7 +586,8 @@ TEST(TreeTraversal, DepthFirstSearchPostOrderRootIsNeedle) {
<< "Search starting at needle continued past needle.";
}
TEST(TreeTraversal, DepthFirstSearchPostOrderValueDoesNotExist) {
TEST(TreeTraversal, DepthFirstSearchPostOrderValueDoesNotExist)
{
int visitCount = 0;
std::vector<RefPtr<SearchTestNodeForward>> nodeList;
nodeList.reserve(10);
@ -613,7 +624,8 @@ TEST(TreeTraversal, DepthFirstSearchPostOrderValueDoesNotExist) {
<< "Search found something that should not exist.";
}
TEST(TreeTraversal, DepthFirstSearchPostOrderValueDoesNotExistReverse) {
TEST(TreeTraversal, DepthFirstSearchPostOrderValueDoesNotExistReverse)
{
int visitCount = 0;
std::vector<RefPtr<SearchTestNodeReverse>> nodeList;
nodeList.reserve(10);
@ -650,7 +662,8 @@ TEST(TreeTraversal, DepthFirstSearchPostOrderValueDoesNotExistReverse) {
<< "Search found something that should not exist.";
}
TEST(TreeTraversal, BreadthFirstSearchNull) {
TEST(TreeTraversal, BreadthFirstSearchNull)
{
RefPtr<SearchTestNodeReverse> nullNode;
RefPtr<SearchTestNodeReverse> result =
BreadthFirstSearch<layers::ReverseIterator>(
@ -661,7 +674,8 @@ TEST(TreeTraversal, BreadthFirstSearchNull) {
<< "Null root did not return null search result.";
}
TEST(TreeTraversal, BreadthFirstSearchRootIsNeedle) {
TEST(TreeTraversal, BreadthFirstSearchRootIsNeedle)
{
RefPtr<SearchTestNodeReverse> root =
new SearchTestNodeReverse(SearchNodeType::Needle, 0);
RefPtr<SearchTestNodeReverse> childNode1 =
@ -687,7 +701,8 @@ TEST(TreeTraversal, BreadthFirstSearchRootIsNeedle) {
<< "Search starting at needle continued past needle.";
}
TEST(TreeTraversal, BreadthFirstSearchValueExists) {
TEST(TreeTraversal, BreadthFirstSearchValueExists)
{
int visitCount = 0;
size_t expectedNeedleTraversalRank = 7;
RefPtr<SearchTestNodeForward> needleNode;
@ -735,7 +750,8 @@ TEST(TreeTraversal, BreadthFirstSearchValueExists) {
"happened).";
}
TEST(TreeTraversal, BreadthFirstSearchValueExistsReverse) {
TEST(TreeTraversal, BreadthFirstSearchValueExistsReverse)
{
int visitCount = 0;
size_t expectedNeedleTraversalRank = 7;
RefPtr<SearchTestNodeReverse> needleNode;
@ -783,7 +799,8 @@ TEST(TreeTraversal, BreadthFirstSearchValueExistsReverse) {
"happened).";
}
TEST(TreeTraversal, BreadthFirstSearchValueDoesNotExist) {
TEST(TreeTraversal, BreadthFirstSearchValueDoesNotExist)
{
int visitCount = 0;
std::vector<RefPtr<SearchTestNodeForward>> nodeList;
nodeList.reserve(10);
@ -820,7 +837,8 @@ TEST(TreeTraversal, BreadthFirstSearchValueDoesNotExist) {
<< "Search found something that should not exist.";
}
TEST(TreeTraversal, BreadthFirstSearchValueDoesNotExistReverse) {
TEST(TreeTraversal, BreadthFirstSearchValueDoesNotExistReverse)
{
int visitCount = 0;
std::vector<RefPtr<SearchTestNodeReverse>> nodeList;
nodeList.reserve(10);
@ -857,14 +875,16 @@ TEST(TreeTraversal, BreadthFirstSearchValueDoesNotExistReverse) {
<< "Search found something that should not exist.";
}
TEST(TreeTraversal, ForEachNodeNullStillRuns) {
TEST(TreeTraversal, ForEachNodeNullStillRuns)
{
RefPtr<ForEachTestNodeReverse> nullNode;
ForEachNode<layers::ReverseIterator>(
nullNode.get(),
[](ForEachTestNodeReverse* aNode) { return TraversalFlag::Continue; });
}
TEST(TreeTraversal, ForEachNodeAllEligible) {
TEST(TreeTraversal, ForEachNodeAllEligible)
{
std::vector<RefPtr<ForEachTestNodeForward>> nodeList;
int visitCount = 0;
nodeList.reserve(10);
@ -900,7 +920,8 @@ TEST(TreeTraversal, ForEachNodeAllEligible) {
}
}
TEST(TreeTraversal, ForEachNodeAllEligibleReverse) {
TEST(TreeTraversal, ForEachNodeAllEligibleReverse)
{
std::vector<RefPtr<ForEachTestNodeReverse>> nodeList;
int visitCount = 0;
nodeList.reserve(10);
@ -936,7 +957,8 @@ TEST(TreeTraversal, ForEachNodeAllEligibleReverse) {
}
}
TEST(TreeTraversal, ForEachNodeSomeIneligibleNodes) {
TEST(TreeTraversal, ForEachNodeSomeIneligibleNodes)
{
std::vector<RefPtr<ForEachTestNodeForward>> expectedVisitedNodeList;
std::vector<RefPtr<ForEachTestNodeForward>> expectedSkippedNodeList;
int visitCount = 0;
@ -990,7 +1012,8 @@ TEST(TreeTraversal, ForEachNodeSomeIneligibleNodes) {
}
}
TEST(TreeTraversal, ForEachNodeSomeIneligibleNodesReverse) {
TEST(TreeTraversal, ForEachNodeSomeIneligibleNodesReverse)
{
std::vector<RefPtr<ForEachTestNodeReverse>> expectedVisitedNodeList;
std::vector<RefPtr<ForEachTestNodeReverse>> expectedSkippedNodeList;
int visitCount = 0;
@ -1044,7 +1067,8 @@ TEST(TreeTraversal, ForEachNodeSomeIneligibleNodesReverse) {
}
}
TEST(TreeTraversal, ForEachNodeIneligibleRoot) {
TEST(TreeTraversal, ForEachNodeIneligibleRoot)
{
int visitCount = 0;
RefPtr<ForEachTestNodeReverse> root =
@ -1073,7 +1097,8 @@ TEST(TreeTraversal, ForEachNodeIneligibleRoot) {
<< "Ineligible child was still hit.";
}
TEST(TreeTraversal, ForEachNodeLeavesIneligible) {
TEST(TreeTraversal, ForEachNodeLeavesIneligible)
{
std::vector<RefPtr<ForEachTestNodeForward>> nodeList;
nodeList.reserve(10);
int visitCount = 0;
@ -1113,7 +1138,8 @@ TEST(TreeTraversal, ForEachNodeLeavesIneligible) {
}
}
TEST(TreeTraversal, ForEachNodeLeavesIneligibleReverse) {
TEST(TreeTraversal, ForEachNodeLeavesIneligibleReverse)
{
std::vector<RefPtr<ForEachTestNodeReverse>> nodeList;
nodeList.reserve(10);
int visitCount = 0;
@ -1153,7 +1179,8 @@ TEST(TreeTraversal, ForEachNodeLeavesIneligibleReverse) {
}
}
TEST(TreeTraversal, ForEachNodeLambdaReturnsVoid) {
TEST(TreeTraversal, ForEachNodeLambdaReturnsVoid)
{
std::vector<RefPtr<ForEachTestNodeReverse>> nodeList;
nodeList.reserve(10);
int visitCount = 0;

View File

@ -141,7 +141,8 @@ static int TestExistingSurface() {
return failures;
}
TEST(Gfx, SurfaceRefCount) {
TEST(Gfx, SurfaceRefCount)
{
int fail;
fail = TestNewSurface();

View File

@ -430,51 +430,41 @@ void CheckADAM7InterpolatingWritePixels(const IntSize& aSize) {
});
}
TEST(ImageADAM7InterpolatingFilter, WritePixels100_100) {
CheckADAM7InterpolatingWritePixels(IntSize(100, 100));
}
TEST(ImageADAM7InterpolatingFilter, WritePixels100_100)
{ CheckADAM7InterpolatingWritePixels(IntSize(100, 100)); }
TEST(ImageADAM7InterpolatingFilter, WritePixels99_99) {
CheckADAM7InterpolatingWritePixels(IntSize(99, 99));
}
TEST(ImageADAM7InterpolatingFilter, WritePixels99_99)
{ CheckADAM7InterpolatingWritePixels(IntSize(99, 99)); }
TEST(ImageADAM7InterpolatingFilter, WritePixels66_33) {
CheckADAM7InterpolatingWritePixels(IntSize(66, 33));
}
TEST(ImageADAM7InterpolatingFilter, WritePixels66_33)
{ CheckADAM7InterpolatingWritePixels(IntSize(66, 33)); }
TEST(ImageADAM7InterpolatingFilter, WritePixels33_66) {
CheckADAM7InterpolatingWritePixels(IntSize(33, 66));
}
TEST(ImageADAM7InterpolatingFilter, WritePixels33_66)
{ CheckADAM7InterpolatingWritePixels(IntSize(33, 66)); }
TEST(ImageADAM7InterpolatingFilter, WritePixels15_15) {
CheckADAM7InterpolatingWritePixels(IntSize(15, 15));
}
TEST(ImageADAM7InterpolatingFilter, WritePixels15_15)
{ CheckADAM7InterpolatingWritePixels(IntSize(15, 15)); }
TEST(ImageADAM7InterpolatingFilter, WritePixels9_9) {
CheckADAM7InterpolatingWritePixels(IntSize(9, 9));
}
TEST(ImageADAM7InterpolatingFilter, WritePixels9_9)
{ CheckADAM7InterpolatingWritePixels(IntSize(9, 9)); }
TEST(ImageADAM7InterpolatingFilter, WritePixels8_8) {
CheckADAM7InterpolatingWritePixels(IntSize(8, 8));
}
TEST(ImageADAM7InterpolatingFilter, WritePixels8_8)
{ CheckADAM7InterpolatingWritePixels(IntSize(8, 8)); }
TEST(ImageADAM7InterpolatingFilter, WritePixels7_7) {
CheckADAM7InterpolatingWritePixels(IntSize(7, 7));
}
TEST(ImageADAM7InterpolatingFilter, WritePixels7_7)
{ CheckADAM7InterpolatingWritePixels(IntSize(7, 7)); }
TEST(ImageADAM7InterpolatingFilter, WritePixels3_3) {
CheckADAM7InterpolatingWritePixels(IntSize(3, 3));
}
TEST(ImageADAM7InterpolatingFilter, WritePixels3_3)
{ CheckADAM7InterpolatingWritePixels(IntSize(3, 3)); }
TEST(ImageADAM7InterpolatingFilter, WritePixels1_1) {
CheckADAM7InterpolatingWritePixels(IntSize(1, 1));
}
TEST(ImageADAM7InterpolatingFilter, WritePixels1_1)
{ CheckADAM7InterpolatingWritePixels(IntSize(1, 1)); }
TEST(ImageADAM7InterpolatingFilter, TrivialInterpolation48_48) {
CheckInterpolation(IntSize(48, 48), {BGRAColor::Green()});
}
TEST(ImageADAM7InterpolatingFilter, TrivialInterpolation48_48)
{ CheckInterpolation(IntSize(48, 48), {BGRAColor::Green()}); }
TEST(ImageADAM7InterpolatingFilter, InterpolationOutput33_17) {
TEST(ImageADAM7InterpolatingFilter, InterpolationOutput33_17)
{
// We check interpolation using irregular patterns to make sure that the
// interpolation will look different for different passes.
CheckInterpolation(
@ -492,7 +482,8 @@ TEST(ImageADAM7InterpolatingFilter, InterpolationOutput33_17) {
BGRAColor::Red(), BGRAColor::Blue()});
}
TEST(ImageADAM7InterpolatingFilter, InterpolationOutput32_16) {
TEST(ImageADAM7InterpolatingFilter, InterpolationOutput32_16)
{
CheckInterpolation(
IntSize(32, 16),
{BGRAColor::Green(), BGRAColor::Red(), BGRAColor::Green(),
@ -508,7 +499,8 @@ TEST(ImageADAM7InterpolatingFilter, InterpolationOutput32_16) {
BGRAColor::Red(), BGRAColor::Blue()});
}
TEST(ImageADAM7InterpolatingFilter, InterpolationOutput31_15) {
TEST(ImageADAM7InterpolatingFilter, InterpolationOutput31_15)
{
CheckInterpolation(
IntSize(31, 15),
{BGRAColor::Green(), BGRAColor::Red(), BGRAColor::Green(),
@ -524,7 +516,8 @@ TEST(ImageADAM7InterpolatingFilter, InterpolationOutput31_15) {
BGRAColor::Red(), BGRAColor::Blue()});
}
TEST(ImageADAM7InterpolatingFilter, InterpolationOutput17_33) {
TEST(ImageADAM7InterpolatingFilter, InterpolationOutput17_33)
{
CheckInterpolation(IntSize(17, 33),
{BGRAColor::Green(), BGRAColor::Red(), BGRAColor::Green(),
BGRAColor::Blue(), BGRAColor::Red(), BGRAColor::Green(),
@ -534,7 +527,8 @@ TEST(ImageADAM7InterpolatingFilter, InterpolationOutput17_33) {
BGRAColor::Blue()});
}
TEST(ImageADAM7InterpolatingFilter, InterpolationOutput16_32) {
TEST(ImageADAM7InterpolatingFilter, InterpolationOutput16_32)
{
CheckInterpolation(IntSize(16, 32),
{BGRAColor::Green(), BGRAColor::Red(), BGRAColor::Green(),
BGRAColor::Blue(), BGRAColor::Red(), BGRAColor::Green(),
@ -544,7 +538,8 @@ TEST(ImageADAM7InterpolatingFilter, InterpolationOutput16_32) {
BGRAColor::Blue()});
}
TEST(ImageADAM7InterpolatingFilter, InterpolationOutput15_31) {
TEST(ImageADAM7InterpolatingFilter, InterpolationOutput15_31)
{
CheckInterpolation(IntSize(15, 31),
{BGRAColor::Green(), BGRAColor::Red(), BGRAColor::Green(),
BGRAColor::Blue(), BGRAColor::Red(), BGRAColor::Green(),
@ -554,42 +549,47 @@ TEST(ImageADAM7InterpolatingFilter, InterpolationOutput15_31) {
BGRAColor::Blue()});
}
TEST(ImageADAM7InterpolatingFilter, InterpolationOutput9_9) {
TEST(ImageADAM7InterpolatingFilter, InterpolationOutput9_9)
{
CheckInterpolation(IntSize(9, 9),
{BGRAColor::Blue(), BGRAColor::Blue(), BGRAColor::Red(),
BGRAColor::Green(), BGRAColor::Green(), BGRAColor::Red(),
BGRAColor::Red(), BGRAColor::Blue()});
}
TEST(ImageADAM7InterpolatingFilter, InterpolationOutput8_8) {
TEST(ImageADAM7InterpolatingFilter, InterpolationOutput8_8)
{
CheckInterpolation(IntSize(8, 8),
{BGRAColor::Blue(), BGRAColor::Blue(), BGRAColor::Red(),
BGRAColor::Green(), BGRAColor::Green(), BGRAColor::Red(),
BGRAColor::Red(), BGRAColor::Blue()});
}
TEST(ImageADAM7InterpolatingFilter, InterpolationOutput7_7) {
TEST(ImageADAM7InterpolatingFilter, InterpolationOutput7_7)
{
CheckInterpolation(IntSize(7, 7),
{BGRAColor::Blue(), BGRAColor::Blue(), BGRAColor::Red(),
BGRAColor::Green(), BGRAColor::Green(), BGRAColor::Red(),
BGRAColor::Red(), BGRAColor::Blue()});
}
TEST(ImageADAM7InterpolatingFilter, InterpolationOutput3_3) {
TEST(ImageADAM7InterpolatingFilter, InterpolationOutput3_3)
{
CheckInterpolation(IntSize(3, 3), {BGRAColor::Green(), BGRAColor::Red(),
BGRAColor::Blue(), BGRAColor::Red()});
}
TEST(ImageADAM7InterpolatingFilter, InterpolationOutput1_1) {
CheckInterpolation(IntSize(1, 1), {BGRAColor::Blue()});
}
TEST(ImageADAM7InterpolatingFilter, InterpolationOutput1_1)
{ CheckInterpolation(IntSize(1, 1), {BGRAColor::Blue()}); }
TEST(ImageADAM7InterpolatingFilter, ADAM7InterpolationFailsFor0_0) {
TEST(ImageADAM7InterpolatingFilter, ADAM7InterpolationFailsFor0_0)
{
// A 0x0 input size is invalid, so configuration should fail.
AssertConfiguringADAM7InterpolatingFilterFails(IntSize(0, 0));
}
TEST(ImageADAM7InterpolatingFilter, ADAM7InterpolationFailsForMinus1_Minus1) {
TEST(ImageADAM7InterpolatingFilter, ADAM7InterpolationFailsForMinus1_Minus1)
{
// A negative input size is invalid, so configuration should fail.
AssertConfiguringADAM7InterpolatingFilterFails(IntSize(-1, -1));
}

View File

@ -71,13 +71,15 @@ void AssertConfiguringBlendAnimationFilterFails(const IntRect& aFrameRect,
AssertConfiguringPipelineFails(decoder, blendAnim, surfaceSink);
}
TEST(ImageBlendAnimationFilter, BlendFailsForNegativeFrameRect) {
TEST(ImageBlendAnimationFilter, BlendFailsForNegativeFrameRect)
{
// A negative frame rect size is disallowed.
AssertConfiguringBlendAnimationFilterFails(
IntRect(IntPoint(0, 0), IntSize(-1, -1)), IntSize(100, 100));
}
TEST(ImageBlendAnimationFilter, WriteFullFirstFrame) {
TEST(ImageBlendAnimationFilter, WriteFullFirstFrame)
{
RefPtr<Decoder> decoder = CreateTrivialBlendingDecoder();
ASSERT_TRUE(decoder != nullptr);
@ -92,7 +94,8 @@ TEST(ImageBlendAnimationFilter, WriteFullFirstFrame) {
EXPECT_EQ(IntRect(0, 0, 100, 100), frame0->GetDirtyRect());
}
TEST(ImageBlendAnimationFilter, WritePartialFirstFrame) {
TEST(ImageBlendAnimationFilter, WritePartialFirstFrame)
{
RefPtr<Decoder> decoder = CreateTrivialBlendingDecoder();
ASSERT_TRUE(decoder != nullptr);
@ -164,15 +167,14 @@ static void TestWithBlendAnimationFilterClear(BlendMethod aBlendMethod) {
EXPECT_TRUE(RowsAreSolidColor(surface, 70, 30, BGRAColor::Green()));
}
TEST(ImageBlendAnimationFilter, ClearWithOver) {
TestWithBlendAnimationFilterClear(BlendMethod::OVER);
}
TEST(ImageBlendAnimationFilter, ClearWithOver)
{ TestWithBlendAnimationFilterClear(BlendMethod::OVER); }
TEST(ImageBlendAnimationFilter, ClearWithSource) {
TestWithBlendAnimationFilterClear(BlendMethod::SOURCE);
}
TEST(ImageBlendAnimationFilter, ClearWithSource)
{ TestWithBlendAnimationFilterClear(BlendMethod::SOURCE); }
TEST(ImageBlendAnimationFilter, KeepWithSource) {
TEST(ImageBlendAnimationFilter, KeepWithSource)
{
RefPtr<Decoder> decoder = CreateTrivialBlendingDecoder();
ASSERT_TRUE(decoder != nullptr);
@ -208,7 +210,8 @@ TEST(ImageBlendAnimationFilter, KeepWithSource) {
EXPECT_TRUE(RowsAreSolidColor(surface, 60, 40, BGRAColor::Green()));
}
TEST(ImageBlendAnimationFilter, KeepWithOver) {
TEST(ImageBlendAnimationFilter, KeepWithOver)
{
RefPtr<Decoder> decoder = CreateTrivialBlendingDecoder();
ASSERT_TRUE(decoder != nullptr);
@ -250,7 +253,8 @@ TEST(ImageBlendAnimationFilter, KeepWithOver) {
EXPECT_TRUE(RowsAreSolidColor(surface, 60, 40, frameColor0));
}
TEST(ImageBlendAnimationFilter, RestorePreviousWithOver) {
TEST(ImageBlendAnimationFilter, RestorePreviousWithOver)
{
RefPtr<Decoder> decoder = CreateTrivialBlendingDecoder();
ASSERT_TRUE(decoder != nullptr);
@ -305,7 +309,8 @@ TEST(ImageBlendAnimationFilter, RestorePreviousWithOver) {
EXPECT_TRUE(RowsAreSolidColor(surface, 60, 40, frameColor0));
}
TEST(ImageBlendAnimationFilter, RestorePreviousWithSource) {
TEST(ImageBlendAnimationFilter, RestorePreviousWithSource)
{
RefPtr<Decoder> decoder = CreateTrivialBlendingDecoder();
ASSERT_TRUE(decoder != nullptr);
@ -356,7 +361,8 @@ TEST(ImageBlendAnimationFilter, RestorePreviousWithSource) {
EXPECT_TRUE(RowsAreSolidColor(surface, 60, 40, frameColor0));
}
TEST(ImageBlendAnimationFilter, RestorePreviousClearWithSource) {
TEST(ImageBlendAnimationFilter, RestorePreviousClearWithSource)
{
RefPtr<Decoder> decoder = CreateTrivialBlendingDecoder();
ASSERT_TRUE(decoder != nullptr);
@ -421,7 +427,8 @@ TEST(ImageBlendAnimationFilter, RestorePreviousClearWithSource) {
EXPECT_TRUE(RowsAreSolidColor(surface, 60, 40, frameColor0));
}
TEST(ImageBlendAnimationFilter, PartialOverlapFrameRect) {
TEST(ImageBlendAnimationFilter, PartialOverlapFrameRect)
{
RefPtr<Decoder> decoder = CreateTrivialBlendingDecoder();
ASSERT_TRUE(decoder != nullptr);

View File

@ -41,7 +41,8 @@ struct Value {
int32_t mSerial;
};
TEST(ImageCopyOnWrite, Read) {
TEST(ImageCopyOnWrite, Read)
{
ValueStats stats;
{
@ -74,7 +75,8 @@ TEST(ImageCopyOnWrite, Read) {
EXPECT_EQ(1, stats.mFrees);
}
TEST(ImageCopyOnWrite, RecursiveRead) {
TEST(ImageCopyOnWrite, RecursiveRead)
{
ValueStats stats;
{
@ -121,7 +123,8 @@ TEST(ImageCopyOnWrite, RecursiveRead) {
EXPECT_EQ(1, stats.mFrees);
}
TEST(ImageCopyOnWrite, Write) {
TEST(ImageCopyOnWrite, Write)
{
ValueStats stats;
{
@ -155,7 +158,8 @@ TEST(ImageCopyOnWrite, Write) {
EXPECT_EQ(1, stats.mFrees);
}
TEST(ImageCopyOnWrite, WriteRecursive) {
TEST(ImageCopyOnWrite, WriteRecursive)
{
ValueStats stats;
{

View File

@ -40,7 +40,8 @@ void AssertConfiguringDownscalingFilterFails(const IntSize& aInputSize,
SurfaceConfig{decoder, aOutputSize, SurfaceFormat::B8G8R8A8, false});
}
TEST(ImageDownscalingFilter, WritePixels100_100to99_99) {
TEST(ImageDownscalingFilter, WritePixels100_100to99_99)
{
WithDownscalingFilter(IntSize(100, 100), IntSize(99, 99),
[](Decoder* aDecoder, SurfaceFilter* aFilter) {
CheckWritePixels(
@ -49,7 +50,8 @@ TEST(ImageDownscalingFilter, WritePixels100_100to99_99) {
});
}
TEST(ImageDownscalingFilter, WritePixels100_100to33_33) {
TEST(ImageDownscalingFilter, WritePixels100_100to33_33)
{
WithDownscalingFilter(IntSize(100, 100), IntSize(33, 33),
[](Decoder* aDecoder, SurfaceFilter* aFilter) {
CheckWritePixels(
@ -58,7 +60,8 @@ TEST(ImageDownscalingFilter, WritePixels100_100to33_33) {
});
}
TEST(ImageDownscalingFilter, WritePixels100_100to1_1) {
TEST(ImageDownscalingFilter, WritePixels100_100to1_1)
{
WithDownscalingFilter(IntSize(100, 100), IntSize(1, 1),
[](Decoder* aDecoder, SurfaceFilter* aFilter) {
CheckWritePixels(
@ -67,7 +70,8 @@ TEST(ImageDownscalingFilter, WritePixels100_100to1_1) {
});
}
TEST(ImageDownscalingFilter, WritePixels100_100to33_99) {
TEST(ImageDownscalingFilter, WritePixels100_100to33_99)
{
WithDownscalingFilter(IntSize(100, 100), IntSize(33, 99),
[](Decoder* aDecoder, SurfaceFilter* aFilter) {
CheckWritePixels(
@ -76,7 +80,8 @@ TEST(ImageDownscalingFilter, WritePixels100_100to33_99) {
});
}
TEST(ImageDownscalingFilter, WritePixels100_100to99_33) {
TEST(ImageDownscalingFilter, WritePixels100_100to99_33)
{
WithDownscalingFilter(IntSize(100, 100), IntSize(99, 33),
[](Decoder* aDecoder, SurfaceFilter* aFilter) {
CheckWritePixels(
@ -85,7 +90,8 @@ TEST(ImageDownscalingFilter, WritePixels100_100to99_33) {
});
}
TEST(ImageDownscalingFilter, WritePixels100_100to99_1) {
TEST(ImageDownscalingFilter, WritePixels100_100to99_1)
{
WithDownscalingFilter(IntSize(100, 100), IntSize(99, 1),
[](Decoder* aDecoder, SurfaceFilter* aFilter) {
CheckWritePixels(
@ -94,7 +100,8 @@ TEST(ImageDownscalingFilter, WritePixels100_100to99_1) {
});
}
TEST(ImageDownscalingFilter, WritePixels100_100to1_99) {
TEST(ImageDownscalingFilter, WritePixels100_100to1_99)
{
WithDownscalingFilter(IntSize(100, 100), IntSize(1, 99),
[](Decoder* aDecoder, SurfaceFilter* aFilter) {
CheckWritePixels(
@ -103,37 +110,44 @@ TEST(ImageDownscalingFilter, WritePixels100_100to1_99) {
});
}
TEST(ImageDownscalingFilter, DownscalingFailsFor100_100to101_101) {
TEST(ImageDownscalingFilter, DownscalingFailsFor100_100to101_101)
{
// Upscaling is disallowed.
AssertConfiguringDownscalingFilterFails(IntSize(100, 100), IntSize(101, 101));
}
TEST(ImageDownscalingFilter, DownscalingFailsFor100_100to100_100) {
TEST(ImageDownscalingFilter, DownscalingFailsFor100_100to100_100)
{
// "Scaling" to the same size is disallowed.
AssertConfiguringDownscalingFilterFails(IntSize(100, 100), IntSize(100, 100));
}
TEST(ImageDownscalingFilter, DownscalingFailsFor0_0toMinus1_Minus1) {
TEST(ImageDownscalingFilter, DownscalingFailsFor0_0toMinus1_Minus1)
{
// A 0x0 input size is disallowed.
AssertConfiguringDownscalingFilterFails(IntSize(0, 0), IntSize(-1, -1));
}
TEST(ImageDownscalingFilter, DownscalingFailsForMinus1_Minus1toMinus2_Minus2) {
TEST(ImageDownscalingFilter, DownscalingFailsForMinus1_Minus1toMinus2_Minus2)
{
// A negative input size is disallowed.
AssertConfiguringDownscalingFilterFails(IntSize(-1, -1), IntSize(-2, -2));
}
TEST(ImageDownscalingFilter, DownscalingFailsFor100_100to0_0) {
TEST(ImageDownscalingFilter, DownscalingFailsFor100_100to0_0)
{
// A 0x0 output size is disallowed.
AssertConfiguringDownscalingFilterFails(IntSize(100, 100), IntSize(0, 0));
}
TEST(ImageDownscalingFilter, DownscalingFailsFor100_100toMinus1_Minus1) {
TEST(ImageDownscalingFilter, DownscalingFailsFor100_100toMinus1_Minus1)
{
// A negative output size is disallowed.
AssertConfiguringDownscalingFilterFails(IntSize(100, 100), IntSize(-1, -1));
}
TEST(ImageDownscalingFilter, WritePixelsOutput100_100to20_20) {
TEST(ImageDownscalingFilter, WritePixelsOutput100_100to20_20)
{
WithDownscalingFilter(
IntSize(100, 100), IntSize(20, 20),
[](Decoder* aDecoder, SurfaceFilter* aFilter) {
@ -174,7 +188,8 @@ TEST(ImageDownscalingFilter, WritePixelsOutput100_100to20_20) {
});
}
TEST(ImageDownscalingFilter, WritePixelsOutput100_100to10_20) {
TEST(ImageDownscalingFilter, WritePixelsOutput100_100to10_20)
{
WithDownscalingFilter(
IntSize(100, 100), IntSize(10, 20),
[](Decoder* aDecoder, SurfaceFilter* aFilter) {

View File

@ -43,7 +43,8 @@ using namespace mozilla;
using namespace mozilla::gfx;
using namespace mozilla::image;
TEST(ImageDownscalingFilter, NoSkia) {
TEST(ImageDownscalingFilter, NoSkia)
{
RefPtr<Decoder> decoder = CreateTrivialDecoder();
ASSERT_TRUE(bool(decoder));

View File

@ -39,7 +39,8 @@ void AssertConfiguringRemoveFrameRectFilterFails(const IntSize& aSize,
SurfaceConfig{decoder, aSize, SurfaceFormat::B8G8R8A8, false});
}
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_0_0_100_100) {
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_0_0_100_100)
{
WithRemoveFrameRectFilter(
IntSize(100, 100), IntRect(0, 0, 100, 100),
[](Decoder* aDecoder, SurfaceFilter* aFilter) {
@ -50,7 +51,8 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_0_0_100_100) {
});
}
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_0_0_0_0) {
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_0_0_0_0)
{
WithRemoveFrameRectFilter(
IntSize(100, 100), IntRect(0, 0, 0, 0),
[](Decoder* aDecoder, SurfaceFilter* aFilter) {
@ -62,7 +64,8 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_0_0_0_0) {
});
}
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_Minus50_50_0_0) {
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_Minus50_50_0_0)
{
WithRemoveFrameRectFilter(
IntSize(100, 100), IntRect(-50, 50, 0, 0),
[](Decoder* aDecoder, SurfaceFilter* aFilter) {
@ -74,7 +77,8 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_Minus50_50_0_0) {
});
}
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_50_Minus50_0_0) {
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_50_Minus50_0_0)
{
WithRemoveFrameRectFilter(
IntSize(100, 100), IntRect(50, -50, 0, 0),
[](Decoder* aDecoder, SurfaceFilter* aFilter) {
@ -86,7 +90,8 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_50_Minus50_0_0) {
});
}
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_150_50_0_0) {
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_150_50_0_0)
{
WithRemoveFrameRectFilter(
IntSize(100, 100), IntRect(150, 50, 0, 0),
[](Decoder* aDecoder, SurfaceFilter* aFilter) {
@ -98,7 +103,8 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_150_50_0_0) {
});
}
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_50_150_0_0) {
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_50_150_0_0)
{
WithRemoveFrameRectFilter(
IntSize(100, 100), IntRect(50, 150, 0, 0),
[](Decoder* aDecoder, SurfaceFilter* aFilter) {
@ -110,7 +116,8 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_50_150_0_0) {
});
}
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_200_200_100_100) {
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_200_200_100_100)
{
WithRemoveFrameRectFilter(
IntSize(100, 100), IntRect(200, 200, 100, 100),
[](Decoder* aDecoder, SurfaceFilter* aFilter) {
@ -125,7 +132,8 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_200_200_100_100) {
});
}
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_Minus200_25_100_100) {
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_Minus200_25_100_100)
{
WithRemoveFrameRectFilter(
IntSize(100, 100), IntRect(-200, 25, 100, 100),
[](Decoder* aDecoder, SurfaceFilter* aFilter) {
@ -140,7 +148,8 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_Minus200_25_100_100) {
});
}
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_25_Minus200_100_100) {
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_25_Minus200_100_100)
{
WithRemoveFrameRectFilter(
IntSize(100, 100), IntRect(25, -200, 100, 100),
[](Decoder* aDecoder, SurfaceFilter* aFilter) {
@ -155,7 +164,8 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_25_Minus200_100_100) {
});
}
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_200_25_100_100) {
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_200_25_100_100)
{
WithRemoveFrameRectFilter(
IntSize(100, 100), IntRect(200, 25, 100, 100),
[](Decoder* aDecoder, SurfaceFilter* aFilter) {
@ -170,7 +180,8 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_200_25_100_100) {
});
}
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_25_200_100_100) {
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_25_200_100_100)
{
WithRemoveFrameRectFilter(
IntSize(100, 100), IntRect(25, 200, 100, 100),
[](Decoder* aDecoder, SurfaceFilter* aFilter) {
@ -186,7 +197,8 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_25_200_100_100) {
}
TEST(ImageRemoveFrameRectFilter,
WritePixels100_100_to_Minus200_Minus200_100_100) {
WritePixels100_100_to_Minus200_Minus200_100_100)
{
WithRemoveFrameRectFilter(
IntSize(100, 100), IntRect(-200, -200, 100, 100),
[](Decoder* aDecoder, SurfaceFilter* aFilter) {
@ -198,8 +210,8 @@ TEST(ImageRemoveFrameRectFilter,
});
}
TEST(ImageRemoveFrameRectFilter,
WritePixels100_100_to_Minus50_Minus50_100_100) {
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_Minus50_Minus50_100_100)
{
WithRemoveFrameRectFilter(
IntSize(100, 100), IntRect(-50, -50, 100, 100),
[](Decoder* aDecoder, SurfaceFilter* aFilter) {
@ -211,7 +223,8 @@ TEST(ImageRemoveFrameRectFilter,
});
}
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_Minus50_25_100_50) {
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_Minus50_25_100_50)
{
WithRemoveFrameRectFilter(
IntSize(100, 100), IntRect(-50, 25, 100, 50),
[](Decoder* aDecoder, SurfaceFilter* aFilter) {
@ -223,7 +236,8 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_Minus50_25_100_50) {
});
}
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_25_Minus50_50_100) {
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_25_Minus50_50_100)
{
WithRemoveFrameRectFilter(
IntSize(100, 100), IntRect(25, -50, 50, 100),
[](Decoder* aDecoder, SurfaceFilter* aFilter) {
@ -235,7 +249,8 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_25_Minus50_50_100) {
});
}
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_50_25_100_50) {
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_50_25_100_50)
{
WithRemoveFrameRectFilter(
IntSize(100, 100), IntRect(50, 25, 100, 50),
[](Decoder* aDecoder, SurfaceFilter* aFilter) {
@ -248,7 +263,8 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_50_25_100_50) {
});
}
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_25_50_50_100) {
TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_25_50_50_100)
{
WithRemoveFrameRectFilter(
IntSize(100, 100), IntRect(25, 50, 50, 100),
[](Decoder* aDecoder, SurfaceFilter* aFilter) {
@ -264,27 +280,31 @@ TEST(ImageRemoveFrameRectFilter, WritePixels100_100_to_25_50_50_100) {
});
}
TEST(ImageRemoveFrameRectFilter, RemoveFrameRectFailsFor0_0_to_0_0_100_100) {
TEST(ImageRemoveFrameRectFilter, RemoveFrameRectFailsFor0_0_to_0_0_100_100)
{
// A zero-size image is disallowed.
AssertConfiguringRemoveFrameRectFilterFails(IntSize(0, 0),
IntRect(0, 0, 100, 100));
}
TEST(ImageRemoveFrameRectFilter,
RemoveFrameRectFailsForMinus1_Minus1_to_0_0_100_100) {
RemoveFrameRectFailsForMinus1_Minus1_to_0_0_100_100)
{
// A negative-size image is disallowed.
AssertConfiguringRemoveFrameRectFilterFails(IntSize(-1, -1),
IntRect(0, 0, 100, 100));
}
TEST(ImageRemoveFrameRectFilter, RemoveFrameRectFailsFor100_100_to_0_0_0_0) {
TEST(ImageRemoveFrameRectFilter, RemoveFrameRectFailsFor100_100_to_0_0_0_0)
{
// A zero size frame rect is disallowed.
AssertConfiguringRemoveFrameRectFilterFails(IntSize(100, 100),
IntRect(0, 0, -1, -1));
}
TEST(ImageRemoveFrameRectFilter,
RemoveFrameRectFailsFor100_100_to_0_0_Minus1_Minus1) {
RemoveFrameRectFailsFor100_100_to_0_0_Minus1_Minus1)
{
// A negative size frame rect is disallowed.
AssertConfiguringRemoveFrameRectFilterFails(IntSize(100, 100),
IntRect(0, 0, -1, -1));

View File

@ -84,7 +84,8 @@ void CheckIterativeWrite(Decoder* aDecoder, SurfaceSink* aSink,
[&] { CheckGeneratedImage(aDecoder, aOutputRect); });
}
TEST(ImageSurfaceSink, SurfaceSinkInitialization) {
TEST(ImageSurfaceSink, SurfaceSinkInitialization)
{
WithSurfaceSink<Orient::NORMAL>([](Decoder* aDecoder, SurfaceSink* aSink) {
// Check initial state.
EXPECT_FALSE(aSink->IsSurfaceFinished());
@ -100,13 +101,15 @@ TEST(ImageSurfaceSink, SurfaceSinkInitialization) {
});
}
TEST(ImageSurfaceSink, SurfaceSinkWritePixels) {
TEST(ImageSurfaceSink, SurfaceSinkWritePixels)
{
WithSurfaceSink<Orient::NORMAL>([](Decoder* aDecoder, SurfaceSink* aSink) {
CheckWritePixels(aDecoder, aSink);
});
}
TEST(ImageSurfaceSink, SurfaceSinkWritePixelsFinish) {
TEST(ImageSurfaceSink, SurfaceSinkWritePixelsFinish)
{
WithSurfaceSink<Orient::NORMAL>([](Decoder* aDecoder, SurfaceSink* aSink) {
// Write nothing into the surface; just finish immediately.
uint32_t count = 0;
@ -137,7 +140,8 @@ TEST(ImageSurfaceSink, SurfaceSinkWritePixelsFinish) {
});
}
TEST(ImageSurfaceSink, SurfaceSinkWritePixelsEarlyExit) {
TEST(ImageSurfaceSink, SurfaceSinkWritePixelsEarlyExit)
{
auto checkEarlyExit = [](Decoder* aDecoder, SurfaceSink* aSink,
WriteState aState) {
// Write half a row of green pixels and then exit early with |aState|. If
@ -210,7 +214,8 @@ TEST(ImageSurfaceSink, SurfaceSinkWritePixelsEarlyExit) {
});
}
TEST(ImageSurfaceSink, SurfaceSinkWritePixelsToRow) {
TEST(ImageSurfaceSink, SurfaceSinkWritePixelsToRow)
{
WithSurfaceSink<Orient::NORMAL>([](Decoder* aDecoder, SurfaceSink* aSink) {
// Write the first 99 rows of our 100x100 surface and verify that even
// though our lambda will yield pixels forever, only one row is written per
@ -268,7 +273,8 @@ TEST(ImageSurfaceSink, SurfaceSinkWritePixelsToRow) {
});
}
TEST(ImageSurfaceSink, SurfaceSinkWritePixelsToRowEarlyExit) {
TEST(ImageSurfaceSink, SurfaceSinkWritePixelsToRowEarlyExit)
{
auto checkEarlyExit = [](Decoder* aDecoder, SurfaceSink* aSink,
WriteState aState) {
// Write half a row of green pixels and then exit early with |aState|. If
@ -339,7 +345,8 @@ TEST(ImageSurfaceSink, SurfaceSinkWritePixelsToRowEarlyExit) {
});
}
TEST(ImageSurfaceSink, SurfaceSinkWriteBuffer) {
TEST(ImageSurfaceSink, SurfaceSinkWriteBuffer)
{
WithSurfaceSink<Orient::NORMAL>([](Decoder* aDecoder, SurfaceSink* aSink) {
// Create a green buffer the same size as one row of the surface (which is
// 100x100), containing 60 pixels of green in the middle and 20 transparent
@ -354,7 +361,8 @@ TEST(ImageSurfaceSink, SurfaceSinkWriteBuffer) {
});
}
TEST(ImageSurfaceSink, SurfaceSinkWriteBufferPartialRow) {
TEST(ImageSurfaceSink, SurfaceSinkWriteBufferPartialRow)
{
WithSurfaceSink<Orient::NORMAL>([](Decoder* aDecoder, SurfaceSink* aSink) {
// Create a buffer the same size as one row of the surface, containing all
// green pixels.
@ -370,7 +378,8 @@ TEST(ImageSurfaceSink, SurfaceSinkWriteBufferPartialRow) {
});
}
TEST(ImageSurfaceSink, SurfaceSinkWriteBufferPartialRowStartColOverflow) {
TEST(ImageSurfaceSink, SurfaceSinkWriteBufferPartialRowStartColOverflow)
{
WithSurfaceSink<Orient::NORMAL>([](Decoder* aDecoder, SurfaceSink* aSink) {
// Create a buffer the same size as one row of the surface, containing all
// green pixels.
@ -402,7 +411,8 @@ TEST(ImageSurfaceSink, SurfaceSinkWriteBufferPartialRowStartColOverflow) {
});
}
TEST(ImageSurfaceSink, SurfaceSinkWriteBufferPartialRowBufferOverflow) {
TEST(ImageSurfaceSink, SurfaceSinkWriteBufferPartialRowBufferOverflow)
{
WithSurfaceSink<Orient::NORMAL>([](Decoder* aDecoder, SurfaceSink* aSink) {
// Create a buffer twice as large as a row of the surface. The first half
// (which is as large as a row of the image) will contain green pixels,
@ -438,7 +448,8 @@ TEST(ImageSurfaceSink, SurfaceSinkWriteBufferPartialRowBufferOverflow) {
});
}
TEST(ImageSurfaceSink, SurfaceSinkWriteBufferFromNullSource) {
TEST(ImageSurfaceSink, SurfaceSinkWriteBufferFromNullSource)
{
WithSurfaceSink<Orient::NORMAL>([](Decoder* aDecoder, SurfaceSink* aSink) {
// Calling WriteBuffer() with a null pointer should fail without making any
// changes to the surface.
@ -455,7 +466,8 @@ TEST(ImageSurfaceSink, SurfaceSinkWriteBufferFromNullSource) {
});
}
TEST(ImageSurfaceSink, SurfaceSinkWriteEmptyRow) {
TEST(ImageSurfaceSink, SurfaceSinkWriteEmptyRow)
{
WithSurfaceSink<Orient::NORMAL>([](Decoder* aDecoder, SurfaceSink* aSink) {
{
// Write an empty row to each row of the surface. We check that the
@ -525,7 +537,8 @@ TEST(ImageSurfaceSink, SurfaceSinkWriteEmptyRow) {
});
}
TEST(ImageSurfaceSink, SurfaceSinkWriteUnsafeComputedRow) {
TEST(ImageSurfaceSink, SurfaceSinkWriteUnsafeComputedRow)
{
WithSurfaceSink<Orient::NORMAL>([](Decoder* aDecoder, SurfaceSink* aSink) {
// Create a green buffer the same size as one row of the surface.
uint32_t buffer[100];
@ -547,7 +560,8 @@ TEST(ImageSurfaceSink, SurfaceSinkWriteUnsafeComputedRow) {
});
}
TEST(ImageSurfaceSink, SurfaceSinkWritePixelBlocks) {
TEST(ImageSurfaceSink, SurfaceSinkWritePixelBlocks)
{
WithSurfaceSink<Orient::NORMAL>([](Decoder* aDecoder, SurfaceSink* aSink) {
// Create a green buffer the same size as one row of the surface (which is
// 100x100), containing 60 pixels of green in the middle and 20 transparent
@ -593,7 +607,8 @@ TEST(ImageSurfaceSink, SurfaceSinkWritePixelBlocks) {
});
}
TEST(ImageSurfaceSink, SurfaceSinkWritePixelBlocksPartialRow) {
TEST(ImageSurfaceSink, SurfaceSinkWritePixelBlocksPartialRow)
{
WithSurfaceSink<Orient::NORMAL>([](Decoder* aDecoder, SurfaceSink* aSink) {
// Create a green buffer the same size as one row of the surface (which is
// 100x100), containing 60 pixels of green in the middle and 20 transparent
@ -685,7 +700,8 @@ TEST(ImageSurfaceSink, SurfaceSinkWritePixelBlocksPartialRow) {
});
}
TEST(ImageSurfaceSink, SurfaceSinkProgressivePasses) {
TEST(ImageSurfaceSink, SurfaceSinkProgressivePasses)
{
WithSurfaceSink<Orient::NORMAL>([](Decoder* aDecoder, SurfaceSink* aSink) {
{
// Fill the image with a first pass of red.
@ -736,7 +752,8 @@ TEST(ImageSurfaceSink, SurfaceSinkProgressivePasses) {
});
}
TEST(ImageSurfaceSink, SurfaceSinkInvalidRect) {
TEST(ImageSurfaceSink, SurfaceSinkInvalidRect)
{
WithSurfaceSink<Orient::NORMAL>([](Decoder* aDecoder, SurfaceSink* aSink) {
{
// Write one row.
@ -859,7 +876,8 @@ TEST(ImageSurfaceSink, SurfaceSinkInvalidRect) {
});
}
TEST(ImageSurfaceSink, SurfaceSinkFlipVertically) {
TEST(ImageSurfaceSink, SurfaceSinkFlipVertically)
{
WithSurfaceSink<Orient::FLIP_VERTICALLY>([](Decoder* aDecoder,
SurfaceSink* aSink) {
{

View File

@ -10,7 +10,8 @@
#include "nsICollation.h"
#include "nsString.h"
TEST(Collation, AllocateRowSortKey) {
TEST(Collation, AllocateRowSortKey)
{
nsCOMPtr<nsICollationFactory> colFactory =
do_CreateInstance(NS_COLLATIONFACTORY_CONTRACTID);
ASSERT_TRUE(colFactory);

View File

@ -25,7 +25,8 @@ static nsAutoCString nt(nsAutoCString aDatetime) {
return datetime;
}
TEST(DateTimeFormat, FormatPRExplodedTime) {
TEST(DateTimeFormat, FormatPRExplodedTime)
{
PRTime prTime = 0;
PRExplodedTime prExplodedTime;
PR_ExplodeTime(prTime, PR_GMTParameters, &prExplodedTime);
@ -87,7 +88,8 @@ TEST(DateTimeFormat, FormatPRExplodedTime) {
nt(NS_ConvertUTF16toUTF8(formattedTime)).get());
}
TEST(DateTimeFormat, DateFormatSelectors) {
TEST(DateTimeFormat, DateFormatSelectors)
{
PRTime prTime = 0;
PRExplodedTime prExplodedTime;
PR_ExplodeTime(prTime, PR_GMTParameters, &prExplodedTime);
@ -158,7 +160,8 @@ static nsAutoCString ntd(nsAutoCString aDatetime) {
return datetime;
}
TEST(DateTimeFormat, FormatPRExplodedTimeForeign) {
TEST(DateTimeFormat, FormatPRExplodedTimeForeign)
{
PRTime prTime = 0;
PRExplodedTime prExplodedTime;
PR_ExplodeTime(prTime, PR_GMTParameters, &prExplodedTime);
@ -220,7 +223,8 @@ TEST(DateTimeFormat, FormatPRExplodedTimeForeign) {
ntd(NS_ConvertUTF16toUTF8(formattedTime)).get());
}
TEST(DateTimeFormat, DateFormatSelectorsForeign) {
TEST(DateTimeFormat, DateFormatSelectorsForeign)
{
PRTime prTime = 0;
PRExplodedTime prExplodedTime;
PR_ExplodeTime(prTime, PR_GMTParameters, &prExplodedTime);

View File

@ -11,21 +11,24 @@
using namespace mozilla::intl;
TEST(Intl_Locale_LocaleService, GetAppLocalesAsBCP47) {
TEST(Intl_Locale_LocaleService, GetAppLocalesAsBCP47)
{
nsTArray<nsCString> appLocales;
LocaleService::GetInstance()->GetAppLocalesAsBCP47(appLocales);
ASSERT_FALSE(appLocales.IsEmpty());
}
TEST(Intl_Locale_LocaleService, GetAppLocalesAsLangTags) {
TEST(Intl_Locale_LocaleService, GetAppLocalesAsLangTags)
{
nsTArray<nsCString> appLocales;
LocaleService::GetInstance()->GetAppLocalesAsLangTags(appLocales);
ASSERT_FALSE(appLocales.IsEmpty());
}
TEST(Intl_Locale_LocaleService, GetAppLocalesAsLangTags_lastIsEnUS) {
TEST(Intl_Locale_LocaleService, GetAppLocalesAsLangTags_lastIsEnUS)
{
nsAutoCString lastFallbackLocale;
LocaleService::GetInstance()->GetLastFallbackLocale(lastFallbackLocale);
@ -36,7 +39,8 @@ TEST(Intl_Locale_LocaleService, GetAppLocalesAsLangTags_lastIsEnUS) {
ASSERT_TRUE(appLocales[len - 1].Equals(lastFallbackLocale));
}
TEST(Intl_Locale_LocaleService, GetAppLocaleAsLangTag) {
TEST(Intl_Locale_LocaleService, GetAppLocaleAsLangTag)
{
nsTArray<nsCString> appLocales;
LocaleService::GetInstance()->GetAppLocalesAsLangTags(appLocales);
@ -46,7 +50,8 @@ TEST(Intl_Locale_LocaleService, GetAppLocaleAsLangTag) {
ASSERT_TRUE(appLocales[0] == locale);
}
TEST(Intl_Locale_LocaleService, GetRegionalPrefsLocales) {
TEST(Intl_Locale_LocaleService, GetRegionalPrefsLocales)
{
nsTArray<nsCString> rpLocales;
LocaleService::GetInstance()->GetRegionalPrefsLocales(rpLocales);
@ -54,7 +59,8 @@ TEST(Intl_Locale_LocaleService, GetRegionalPrefsLocales) {
ASSERT_TRUE(len > 0);
}
TEST(Intl_Locale_LocaleService, GetWebExposedLocales) {
TEST(Intl_Locale_LocaleService, GetWebExposedLocales)
{
const nsTArray<nsCString> spoofLocale{NS_LITERAL_CSTRING("de")};
LocaleService::GetInstance()->SetAvailableLocales(spoofLocale);
LocaleService::GetInstance()->SetRequestedLocales(spoofLocale);
@ -77,7 +83,8 @@ TEST(Intl_Locale_LocaleService, GetWebExposedLocales) {
ASSERT_TRUE(pvLocales[0].Equals(NS_LITERAL_CSTRING("en-US")));
}
TEST(Intl_Locale_LocaleService, GetRequestedLocales) {
TEST(Intl_Locale_LocaleService, GetRequestedLocales)
{
nsTArray<nsCString> reqLocales;
LocaleService::GetInstance()->GetRequestedLocales(reqLocales);
@ -85,7 +92,8 @@ TEST(Intl_Locale_LocaleService, GetRequestedLocales) {
ASSERT_TRUE(len > 0);
}
TEST(Intl_Locale_LocaleService, GetAvailableLocales) {
TEST(Intl_Locale_LocaleService, GetAvailableLocales)
{
nsTArray<nsCString> availableLocales;
LocaleService::GetInstance()->GetAvailableLocales(availableLocales);
@ -93,7 +101,8 @@ TEST(Intl_Locale_LocaleService, GetAvailableLocales) {
ASSERT_TRUE(len > 0);
}
TEST(Intl_Locale_LocaleService, GetPackagedLocales) {
TEST(Intl_Locale_LocaleService, GetPackagedLocales)
{
nsTArray<nsCString> packagedLocales;
LocaleService::GetInstance()->GetPackagedLocales(packagedLocales);
@ -101,7 +110,8 @@ TEST(Intl_Locale_LocaleService, GetPackagedLocales) {
ASSERT_TRUE(len > 0);
}
TEST(Intl_Locale_LocaleService, GetDefaultLocale) {
TEST(Intl_Locale_LocaleService, GetDefaultLocale)
{
nsAutoCString locStr;
LocaleService::GetInstance()->GetDefaultLocale(locStr);
@ -109,7 +119,8 @@ TEST(Intl_Locale_LocaleService, GetDefaultLocale) {
ASSERT_TRUE(Locale(locStr).IsWellFormed());
}
TEST(Intl_Locale_LocaleService, IsAppLocaleRTL) {
TEST(Intl_Locale_LocaleService, IsAppLocaleRTL)
{
// For now we can only test if the method doesn't crash.
LocaleService::GetInstance()->IsAppLocaleRTL();
ASSERT_TRUE(true);

View File

@ -9,7 +9,8 @@
using namespace mozilla::intl;
TEST(Intl_Locale_LocaleService, Negotiate) {
TEST(Intl_Locale_LocaleService, Negotiate)
{
nsTArray<nsCString> requestedLocales;
nsTArray<nsCString> availableLocales;
nsTArray<nsCString> supportedLocales;
@ -30,7 +31,8 @@ TEST(Intl_Locale_LocaleService, Negotiate) {
ASSERT_TRUE(supportedLocales[1].EqualsLiteral("en-US"));
}
TEST(Intl_Locale_LocaleService, UseLSDefaultLocale) {
TEST(Intl_Locale_LocaleService, UseLSDefaultLocale)
{
nsTArray<nsCString> requestedLocales;
nsTArray<nsCString> availableLocales;
nsTArray<nsCString> supportedLocales;

View File

@ -8,20 +8,23 @@
using namespace mozilla::intl;
TEST(Intl_Locale_Locale, Locale) {
TEST(Intl_Locale_Locale, Locale)
{
Locale loc = Locale("en-US");
ASSERT_TRUE(loc.GetLanguage().Equals("en"));
ASSERT_TRUE(loc.GetRegion().Equals("US"));
}
TEST(Intl_Locale_Locale, AsString) {
TEST(Intl_Locale_Locale, AsString)
{
Locale loc = Locale("ja-jp-windows");
ASSERT_TRUE(loc.AsString().Equals("ja-JP-windows"));
}
TEST(Intl_Locale_Locale, GetSubTags) {
TEST(Intl_Locale_Locale, GetSubTags)
{
Locale loc = Locale("en-latn-us-macos");
ASSERT_TRUE(loc.GetLanguage().Equals("en"));
@ -31,7 +34,8 @@ TEST(Intl_Locale_Locale, GetSubTags) {
ASSERT_TRUE(loc.GetVariants()[0].Equals("macos"));
}
TEST(Intl_Locale_Locale, Matches) {
TEST(Intl_Locale_Locale, Matches)
{
Locale loc = Locale("en-US");
Locale loc2 = Locale("en-GB");
@ -44,7 +48,8 @@ TEST(Intl_Locale_Locale, Matches) {
ASSERT_TRUE(loc == loc4);
}
TEST(Intl_Locale_Locale, MatchesRange) {
TEST(Intl_Locale_Locale, MatchesRange)
{
Locale loc = Locale("en-US");
Locale loc2 = Locale("en-Latn-US");
@ -62,14 +67,16 @@ TEST(Intl_Locale_Locale, MatchesRange) {
ASSERT_TRUE(loc.Matches(loc3, true, true));
}
TEST(Intl_Locale_Locale, Variants) {
TEST(Intl_Locale_Locale, Variants)
{
Locale loc = Locale("en-US-UniFon-BasicEng");
// Make sure that we canonicalize and sort variant tags
ASSERT_TRUE(loc.AsString().Equals("en-US-basiceng-unifon"));
}
TEST(Intl_Locale_Locale, PrivateUse) {
TEST(Intl_Locale_Locale, PrivateUse)
{
Locale loc = Locale("x-test");
ASSERT_TRUE(loc.IsWellFormed());
@ -98,7 +105,8 @@ TEST(Intl_Locale_Locale, PrivateUse) {
ASSERT_TRUE(loc3.AsString().Equals("fr-x-foo-bar-baz"));
}
TEST(Intl_Locale_Locale, InvalidLocale) {
TEST(Intl_Locale_Locale, InvalidLocale)
{
Locale loc = Locale("en-verylongsubtag");
ASSERT_FALSE(loc.IsWellFormed());
@ -106,13 +114,15 @@ TEST(Intl_Locale_Locale, InvalidLocale) {
ASSERT_FALSE(loc2.IsWellFormed());
}
TEST(Intl_Locale_Locale, ClearRegion) {
TEST(Intl_Locale_Locale, ClearRegion)
{
Locale loc = Locale("en-US");
loc.ClearRegion();
ASSERT_TRUE(loc.AsString().Equals("en"));
}
TEST(Intl_Locale_Locale, ClearVariants) {
TEST(Intl_Locale_Locale, ClearVariants)
{
Locale loc = Locale("en-US-mac");
loc.ClearVariants();
ASSERT_TRUE(loc.AsString().Equals("en-US"));

View File

@ -17,7 +17,8 @@ using namespace mozilla::intl;
* decide how to handle this and special case and this test should make
* it not happen without us noticing.
*/
TEST(Intl_Locale_OSPreferences, GetSystemLocales) {
TEST(Intl_Locale_OSPreferences, GetSystemLocales)
{
nsTArray<nsCString> systemLocales;
ASSERT_TRUE(NS_SUCCEEDED(
OSPreferences::GetInstance()->GetSystemLocales(systemLocales)));
@ -33,7 +34,8 @@ TEST(Intl_Locale_OSPreferences, GetSystemLocales) {
* decide how to handle this and special case and this test should make
* it not happen without us noticing.
*/
TEST(Intl_Locale_OSPreferences, GetRegionalPrefsLocales) {
TEST(Intl_Locale_OSPreferences, GetRegionalPrefsLocales)
{
nsTArray<nsCString> rgLocales;
ASSERT_TRUE(NS_SUCCEEDED(
OSPreferences::GetInstance()->GetRegionalPrefsLocales(rgLocales)));
@ -49,7 +51,8 @@ TEST(Intl_Locale_OSPreferences, GetRegionalPrefsLocales) {
* bindings for, so effectively, we're testing for crashes. We should
* never crash.
*/
TEST(Intl_Locale_OSPreferences, GetDateTimePattern) {
TEST(Intl_Locale_OSPreferences, GetDateTimePattern)
{
nsAutoString pattern;
OSPreferences* osprefs = OSPreferences::GetInstance();

View File

@ -125,7 +125,8 @@ bool TestASCIIWB(mozilla::intl::WordBreaker* lb, const char* in,
return Check(in, out, outlen, i, res);
}
TEST(LineBreak, LineBreaker) {
TEST(LineBreak, LineBreaker)
{
RefPtr<mozilla::intl::LineBreaker> t = mozilla::intl::LineBreaker::Create();
ASSERT_TRUE(t);
@ -135,7 +136,8 @@ TEST(LineBreak, LineBreaker) {
ASSERT_TRUE(TestASCIILB(t, teng3, lexp3, sizeof(lexp3) / sizeof(uint32_t)));
}
TEST(LineBreak, WordBreaker) {
TEST(LineBreak, WordBreaker)
{
RefPtr<mozilla::intl::WordBreaker> t = mozilla::intl::WordBreaker::Create();
ASSERT_TRUE(t);
@ -251,7 +253,8 @@ void TestFindWordBreakFromPosition(uint32_t fragN, uint32_t offset,
<< "FindWordBreakFromPosition(" << fragN << ", " << offset << ")";
}
TEST(LineBreak, WordBreakUsage) {
TEST(LineBreak, WordBreakUsage)
{
TestPrintWordWithBreak();
TestFindWordBreakFromPosition(0, 0, "This");
TestFindWordBreakFromPosition(1, 0, "his");

View File

@ -33,7 +33,8 @@ void* ThreadLocalPlatform::GetValueFromSlot(SlotType& slot) {
// static
void ThreadLocalPlatform::SetValueInSlot(SlotType& slot, void* value) {
if (!TlsSetValue(slot, value)) {
CHECK(false) << "Failed to TlsSetValue().";
CHECK(false)
<< "Failed to TlsSetValue().";
}
}

View File

@ -62,7 +62,7 @@ bool WaitableEvent::TimedWait(const TimeDelta& max_time) {
size_t WaitableEvent::WaitMany(WaitableEvent** events, size_t count) {
HANDLE handles[MAXIMUM_WAIT_OBJECTS];
CHECK(count <= MAXIMUM_WAIT_OBJECTS)
<< "Can only wait on " << MAXIMUM_WAIT_OBJECTS << " with WaitMany";
<< "Can only wait on " << MAXIMUM_WAIT_OBJECTS << " with WaitMany";
for (size_t i = 0; i < count; ++i) handles[i] = events[i]->handle();

View File

@ -131,8 +131,9 @@ class PipeMap {
DCHECK(fd != -1);
ChannelToFDMap::const_iterator i = map_.find(channel_id);
CHECK(i == map_.end()) << "Creating second IPC server for '" << channel_id
<< "' while first still exists";
CHECK(i == map_.end())
<< "Creating second IPC server for '" << channel_id
<< "' while first still exists";
map_[channel_id] = fd;
}

View File

@ -65,7 +65,8 @@ const B64Test tests[] = {
{"_", {}, false}, // 1 character is too few.
};
TEST(ClearKey, DecodeBase64) {
TEST(ClearKey, DecodeBase64)
{
for (const B64Test& test : tests) {
vector<uint8_t> v;
bool rv = DecodeBase64(string(test.b64), v);

View File

@ -1098,13 +1098,13 @@ class IceTestPeer : public sigslot::has_slots<> {
std::vector<NrIceCandidatePair> old_pairs = *new_pairs;
GetCandidatePairs(stream_index, new_pairs);
ASSERT_TRUE(CandidatePairsPriorityDescending(*new_pairs))
<< "New list of "
"candidate pairs is either not sorted in priority order, or has "
"duplicate priorities.";
<< "New list of "
"candidate pairs is either not sorted in priority order, or has "
"duplicate priorities.";
ASSERT_TRUE(CandidatePairsPriorityDescending(old_pairs))
<< "Old list of "
"candidate pairs is either not sorted in priority order, or has "
"duplicate priorities. This indicates some bug in the test case.";
<< "Old list of "
"candidate pairs is either not sorted in priority order, or has "
"duplicate priorities. This indicates some bug in the test case.";
std::vector<NrIceCandidatePair> added_pairs;
std::vector<NrIceCandidatePair> removed_pairs;
@ -1134,8 +1134,9 @@ class IceTestPeer : public sigslot::has_slots<> {
DumpCandidatePair(removed_pair);
}
ASSERT_TRUE(removed_pairs.empty()) << "At least one candidate pair has "
"gone missing.";
ASSERT_TRUE(removed_pairs.empty())
<< "At least one candidate pair has "
"gone missing.";
}
void StreamReady(NrIceMediaStream* stream) {
@ -1220,7 +1221,8 @@ class IceTestPeer : public sigslot::has_slots<> {
void ParseCandidate_s(size_t i, const std::string& candidate) {
auto media_stream = GetStream_s(i);
ASSERT_TRUE(media_stream.get()) << "No such stream " << i;
ASSERT_TRUE(media_stream.get())
<< "No such stream " << i;
media_stream->ParseTrickleCandidate(candidate, "");
}
@ -1233,7 +1235,8 @@ class IceTestPeer : public sigslot::has_slots<> {
void DisableComponent_s(size_t index, int component_id) {
ASSERT_LT(index, stream_counter_);
auto stream = GetStream_s(index);
ASSERT_TRUE(stream.get()) << "No such stream " << index;
ASSERT_TRUE(stream.get())
<< "No such stream " << index;
nsresult res = stream->DisableComponent(component_id);
ASSERT_TRUE(NS_SUCCEEDED(res));
}
@ -1249,7 +1252,8 @@ class IceTestPeer : public sigslot::has_slots<> {
ConsentStatus status) {
ASSERT_LT(index, stream_counter_);
auto stream = GetStream_s(index);
ASSERT_TRUE(stream.get()) << "No such stream " << index;
ASSERT_TRUE(stream.get())
<< "No such stream " << index;
bool can_send;
struct timeval timestamp;
nsresult res =
@ -3844,7 +3848,8 @@ TEST_F(WebRtcIcePacketFilterTest, TestRecvDataPacketWithAPendingAddress) {
ASSERT_EQ(0, nr_stun_message_destroy(&msg));
}
TEST(WebRtcIceInternalsTest, TestAddBogusAttribute) {
TEST(WebRtcIceInternalsTest, TestAddBogusAttribute)
{
nr_stun_message* req;
ASSERT_EQ(0, nr_stun_message_create(&req));
Data* data;

View File

@ -28,39 +28,46 @@ class TestSimpleTokenBucket : public SimpleTokenBucket {
}
};
TEST(SimpleTokenBucketTest, TestConstruct) { TestSimpleTokenBucket b(10, 1); }
TEST(SimpleTokenBucketTest, TestConstruct)
{ TestSimpleTokenBucket b(10, 1); }
TEST(SimpleTokenBucketTest, TestGet) {
TEST(SimpleTokenBucketTest, TestGet)
{
TestSimpleTokenBucket b(10, 1);
ASSERT_EQ(5U, b.getTokens(5));
}
TEST(SimpleTokenBucketTest, TestGetAll) {
TEST(SimpleTokenBucketTest, TestGetAll)
{
TestSimpleTokenBucket b(10, 1);
ASSERT_EQ(10U, b.getTokens(10));
}
TEST(SimpleTokenBucketTest, TestGetInsufficient) {
TEST(SimpleTokenBucketTest, TestGetInsufficient)
{
TestSimpleTokenBucket b(10, 1);
ASSERT_EQ(5U, b.getTokens(5));
ASSERT_EQ(5U, b.getTokens(6));
}
TEST(SimpleTokenBucketTest, TestGetBucketCount) {
TEST(SimpleTokenBucketTest, TestGetBucketCount)
{
TestSimpleTokenBucket b(10, 1);
ASSERT_EQ(10U, b.getTokens(UINT32_MAX));
ASSERT_EQ(5U, b.getTokens(5));
ASSERT_EQ(5U, b.getTokens(UINT32_MAX));
}
TEST(SimpleTokenBucketTest, TestTokenRefill) {
TEST(SimpleTokenBucketTest, TestTokenRefill)
{
TestSimpleTokenBucket b(10, 1);
ASSERT_EQ(5U, b.getTokens(5));
b.fastForward(1000);
ASSERT_EQ(6U, b.getTokens(6));
}
TEST(SimpleTokenBucketTest, TestNoTimeWasted) {
TEST(SimpleTokenBucketTest, TestNoTimeWasted)
{
// Makes sure that when the time elapsed is insufficient to add any
// tokens to the bucket, the internal timestamp that is used in this
// calculation is not updated (ie; two subsequent 0.5 second elapsed times
@ -73,7 +80,8 @@ TEST(SimpleTokenBucketTest, TestNoTimeWasted) {
ASSERT_EQ(6U, b.getTokens(6));
}
TEST(SimpleTokenBucketTest, TestNegativeTime) {
TEST(SimpleTokenBucketTest, TestNegativeTime)
{
TestSimpleTokenBucket b(10, 1);
b.fastForward(-1000);
// Make sure we don't end up with an invalid number of tokens, but otherwise
@ -81,13 +89,15 @@ TEST(SimpleTokenBucketTest, TestNegativeTime) {
ASSERT_GT(11U, b.getTokens(100));
}
TEST(SimpleTokenBucketTest, TestEmptyBucket) {
TEST(SimpleTokenBucketTest, TestEmptyBucket)
{
TestSimpleTokenBucket b(10, 1);
ASSERT_EQ(10U, b.getTokens(10));
ASSERT_EQ(0U, b.getTokens(10));
}
TEST(SimpleTokenBucketTest, TestEmptyThenFillBucket) {
TEST(SimpleTokenBucketTest, TestEmptyThenFillBucket)
{
TestSimpleTokenBucket b(10, 1);
ASSERT_EQ(10U, b.getTokens(10));
ASSERT_EQ(0U, b.getTokens(1));
@ -95,7 +105,8 @@ TEST(SimpleTokenBucketTest, TestEmptyThenFillBucket) {
ASSERT_EQ(10U, b.getTokens(10));
}
TEST(SimpleTokenBucketTest, TestNoOverflow) {
TEST(SimpleTokenBucketTest, TestNoOverflow)
{
TestSimpleTokenBucket b(10, 1);
ASSERT_EQ(10U, b.getTokens(10));
ASSERT_EQ(0U, b.getTokens(1));

View File

@ -93,7 +93,8 @@ class TestNrSocketTest : public MtransportTest {
void CreatePublicAddrs_s(size_t count, const char *ip_str, int proto) {
while (count--) {
auto sock = CreateTestNrSocket_s(ip_str, proto, nullptr);
ASSERT_TRUE(sock) << "Failed to create socket";
ASSERT_TRUE(sock)
<< "Failed to create socket";
public_addrs_.push_back(sock);
}
}
@ -530,8 +531,8 @@ TEST_F(TestNrSocketTest, FullConeOnePinhole) {
ASSERT_FALSE(nr_transport_addr_cmp(&sender_external_address,
&sender_external_address2,
NR_TRANSPORT_ADDR_CMP_MODE_ALL))
<< "addr1: " << sender_external_address.as_string
<< " addr2: " << sender_external_address2.as_string;
<< "addr1: " << sender_external_address.as_string
<< " addr2: " << sender_external_address2.as_string;
}
// OS 10.6 doesn't seem to allow us to open ports on 127.0.0.2, and while linux
@ -575,8 +576,8 @@ TEST_F(TestNrSocketTest, DISABLED_AddressRestrictedCone) {
ASSERT_FALSE(nr_transport_addr_cmp(&sender_external_address,
&sender_external_address2,
NR_TRANSPORT_ADDR_CMP_MODE_ALL))
<< "addr1: " << sender_external_address.as_string
<< " addr2: " << sender_external_address2.as_string;
<< "addr1: " << sender_external_address.as_string
<< " addr2: " << sender_external_address2.as_string;
// Verify that the other public IP can now use the pinhole
ASSERT_TRUE(CheckConnectivityVia(public_addrs_[1], private_addrs_[0],
@ -589,8 +590,8 @@ TEST_F(TestNrSocketTest, DISABLED_AddressRestrictedCone) {
ASSERT_FALSE(nr_transport_addr_cmp(&sender_external_address,
&sender_external_address3,
NR_TRANSPORT_ADDR_CMP_MODE_ALL))
<< "addr1: " << sender_external_address.as_string
<< " addr2: " << sender_external_address3.as_string;
<< "addr1: " << sender_external_address.as_string
<< " addr2: " << sender_external_address3.as_string;
// Verify that the other public IP can now use the pinhole
ASSERT_TRUE(CheckConnectivityVia(public_addrs_[2], private_addrs_[0],
@ -623,8 +624,8 @@ TEST_F(TestNrSocketTest, RestrictedCone) {
ASSERT_FALSE(nr_transport_addr_cmp(&sender_external_address,
&sender_external_address2,
NR_TRANSPORT_ADDR_CMP_MODE_ALL))
<< "addr1: " << sender_external_address.as_string
<< " addr2: " << sender_external_address2.as_string;
<< "addr1: " << sender_external_address.as_string
<< " addr2: " << sender_external_address2.as_string;
// Verify that the other public IP can now use the pinhole
ASSERT_TRUE(CheckConnectivityVia(public_addrs_[1], private_addrs_[0],
@ -657,8 +658,8 @@ TEST_F(TestNrSocketTest, PortDependentMappingFullCone) {
ASSERT_TRUE(nr_transport_addr_cmp(&sender_external_address0,
&sender_external_address1,
NR_TRANSPORT_ADDR_CMP_MODE_ALL))
<< "addr1: " << sender_external_address0.as_string
<< " addr2: " << sender_external_address1.as_string;
<< "addr1: " << sender_external_address0.as_string
<< " addr2: " << sender_external_address1.as_string;
// Verify that return traffic works
ASSERT_TRUE(CheckConnectivityVia(public_addrs_[1], private_addrs_[0],

View File

@ -125,7 +125,8 @@ const uint8_t g2xGoogleWPTCencInitData[] = {
// clang-format on
};
TEST(PsshParser, ParseCencInitData) {
TEST(PsshParser, ParseCencInitData)
{
std::vector<std::vector<uint8_t>> keyIds;
bool rv;

View File

@ -103,8 +103,8 @@ class JsepSessionTest : public JsepSessionTestBase,
for (const RefPtr<JsepTransceiver>& newTransceiver : newTransceivers) {
if (newTransceiver->HasLevel()) {
ASSERT_FALSE(levels.count(newTransceiver->GetLevel()))
<< "Two new transceivers are mapped to level "
<< newTransceiver->GetLevel();
<< "Two new transceivers are mapped to level "
<< newTransceiver->GetLevel();
levels.insert(newTransceiver->GetLevel());
}
}
@ -121,10 +121,10 @@ class JsepSessionTest : public JsepSessionTestBase,
for (const RefPtr<JsepTransceiver>& oldTransceiver : oldTransceivers) {
if (oldTransceiver->HasLevel()) {
ASSERT_TRUE(levels.count(oldTransceiver->GetLevel()))
<< "Level " << oldTransceiver->GetLevel()
<< " had a transceiver in the old, but not the new (or, "
"perhaps this level had more than one transceiver in the "
"old)";
<< "Level " << oldTransceiver->GetLevel()
<< " had a transceiver in the old, but not the new (or, "
"perhaps this level had more than one transceiver in the "
"old)";
levels.erase(oldTransceiver->GetLevel());
}
}
@ -1077,7 +1077,7 @@ class JsepSessionTest : public JsepSessionTestBase,
expectedCandidates[transportId][RTCP].size());
ASSERT_TRUE(attrs.HasAttribute(SdpAttribute::kCandidateAttribute))
<< context << " (level " << msection.GetLevel() << ")";
<< context << " (level " << msection.GetLevel() << ")";
auto& candidates = attrs.GetCandidate();
ASSERT_EQ(kNumCandidatesPerComponent * 2, candidates.size())
<< context << " (level " << msection.GetLevel() << ")";
@ -1124,7 +1124,7 @@ class JsepSessionTest : public JsepSessionTestBase,
auto defaultCandidates = mDefaultCandidates;
ASSERT_TRUE(msection.GetAttributeList().HasAttribute(
SdpAttribute::kRtcpAttribute))
<< context << " (level " << msection.GetLevel() << ")";
<< context << " (level " << msection.GetLevel() << ")";
auto& rtcpAttr = msection.GetAttributeList().GetRtcp();
ASSERT_EQ(defaultCandidates[transportId][RTCP].second, rtcpAttr.mPort)
<< context << " (level " << msection.GetLevel() << ")";
@ -1137,7 +1137,7 @@ class JsepSessionTest : public JsepSessionTestBase,
} else {
ASSERT_FALSE(msection.GetAttributeList().HasAttribute(
SdpAttribute::kRtcpAttribute))
<< context << " (level " << msection.GetLevel() << ")";
<< context << " (level " << msection.GetLevel() << ")";
}
}
@ -1173,18 +1173,19 @@ class JsepSessionTest : public JsepSessionTestBase,
if (expectEoc) {
ASSERT_TRUE(msection.GetAttributeList().HasAttribute(
SdpAttribute::kEndOfCandidatesAttribute))
<< context << " (level " << msection.GetLevel() << ")";
<< context << " (level " << msection.GetLevel() << ")";
} else {
ASSERT_FALSE(msection.GetAttributeList().HasAttribute(
SdpAttribute::kEndOfCandidatesAttribute))
<< context << " (level " << msection.GetLevel() << ")";
<< context << " (level " << msection.GetLevel() << ")";
}
}
void CheckTransceiversAreBundled(const JsepSession& session,
const std::string& context) {
for (const auto& transceiver : session.GetTransceivers()) {
ASSERT_TRUE(transceiver->HasBundleLevel()) << context;
ASSERT_TRUE(transceiver->HasBundleLevel())
<< context;
ASSERT_EQ(0U, transceiver->BundleLevel()) << context;
}
}
@ -3996,7 +3997,8 @@ TEST_P(JsepSessionTest, TestRejectMline) {
EnsureNegotiationFailure(types.front(), "webrtc-datachannel");
break;
default:
ASSERT_TRUE(false) << "Unknown media type";
ASSERT_TRUE(false)
<< "Unknown media type";
}
AddTracks(*mSessionOff);
@ -4020,7 +4022,8 @@ TEST_P(JsepSessionTest, TestRejectMline) {
}
}
ASSERT_TRUE(failed_section) << "Failed type was entirely absent from SDP";
ASSERT_TRUE(failed_section)
<< "Failed type was entirely absent from SDP";
auto& failed_attrs = failed_section->GetAttributeList();
ASSERT_EQ(SdpDirectionAttribute::kInactive, failed_attrs.GetDirection());
ASSERT_EQ(0U, failed_section->GetPort());
@ -4393,7 +4396,8 @@ TEST_F(JsepSessionTest, UnknownFingerprintAlgorithm) {
ASSERT_NE("", mSessionAns->GetLastError());
}
TEST(H264ProfileLevelIdTest, TestLevelComparisons) {
TEST(H264ProfileLevelIdTest, TestLevelComparisons)
{
ASSERT_LT(JsepVideoCodecDescription::GetSaneH264Level(0x421D0B), // 1b
JsepVideoCodecDescription::GetSaneH264Level(0x420D0B)); // 1.1
ASSERT_LT(JsepVideoCodecDescription::GetSaneH264Level(0x420D0A), // 1.0
@ -4409,7 +4413,8 @@ TEST(H264ProfileLevelIdTest, TestLevelComparisons) {
JsepVideoCodecDescription::GetSaneH264Level(0x64000B)); // 1.1
}
TEST(H264ProfileLevelIdTest, TestLevelSetting) {
TEST(H264ProfileLevelIdTest, TestLevelSetting)
{
uint32_t profileLevelId = 0x420D0A;
JsepVideoCodecDescription::SetSaneH264Level(
JsepVideoCodecDescription::GetSaneH264Level(0x42100B), &profileLevelId);

View File

@ -1580,7 +1580,7 @@ class NewSdpTest
if (expectSuccess) {
ASSERT_TRUE(!!mSdp)
<< "Parse failed on first pass: " << GetParseErrors();
<< "Parse failed on first pass: " << GetParseErrors();
}
if (mSdp) {
@ -1595,9 +1595,9 @@ class NewSdpTest
// Whether we expected the parse to work or not, it should
// succeed the second time if it succeeded the first.
ASSERT_TRUE(!!mSdp)
<< "Parse failed on second pass, SDP was: " << std::endl
<< os.str() << std::endl
<< "Errors were: " << GetParseErrors();
<< "Parse failed on second pass, SDP was: " << std::endl
<< os.str() << std::endl
<< "Errors were: " << GetParseErrors();
// Serialize again and compare
std::stringstream os2;
@ -1607,7 +1607,8 @@ class NewSdpTest
}
if (expectSuccess) {
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(0U, mSdpErrorHolder->GetParseErrors().size())
<< "Got unexpected parse errors/warnings: " << GetParseErrors();
}
@ -1933,7 +1934,8 @@ TEST_P(NewSdpTest, BasicAudioVideoSdpParse) { ParseSdp(kBasicAudioVideoOffer); }
TEST_P(NewSdpTest, CheckRemoveFmtp) {
ParseSdp(kBasicAudioVideoOffer);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(3U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -1968,7 +1970,8 @@ TEST_P(NewSdpTest, CheckRemoveFmtp) {
TEST_P(NewSdpTest, CheckIceUfrag) {
ParseSdp(kBasicAudioVideoOffer);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_TRUE(
mSdp->GetAttributeList().HasAttribute(SdpAttribute::kIceUfragAttribute));
auto ice_ufrag = mSdp->GetAttributeList().GetIceUfrag();
@ -1983,7 +1986,8 @@ TEST_P(NewSdpTest, CheckIceUfrag) {
TEST_P(NewSdpTest, CheckIcePwd) {
ParseSdp(kBasicAudioVideoOffer);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_TRUE(
mSdp->GetAttributeList().HasAttribute(SdpAttribute::kIcePwdAttribute));
auto ice_pwd = mSdp->GetAttributeList().GetIcePwd();
@ -2001,7 +2005,8 @@ TEST_P(NewSdpTest, CheckIcePwd) {
TEST_P(NewSdpTest, CheckIceOptions) {
ParseSdp(kBasicAudioVideoOffer);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_TRUE(mSdp->GetAttributeList().HasAttribute(
SdpAttribute::kIceOptionsAttribute));
auto ice_options = mSdp->GetAttributeList().GetIceOptions();
@ -2023,7 +2028,8 @@ TEST_P(NewSdpTest, CheckIceOptions) {
TEST_P(NewSdpTest, CheckFingerprint) {
ParseSdp(kBasicAudioVideoOffer);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_TRUE(mSdp->GetAttributeList().HasAttribute(
SdpAttribute::kFingerprintAttribute));
auto fingerprints = mSdp->GetAttributeList().GetFingerprint();
@ -2079,7 +2085,8 @@ TEST_P(NewSdpTest, CheckFingerprint) {
TEST_P(NewSdpTest, CheckIdentity) {
ParseSdp(kBasicAudioVideoOffer);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_TRUE(
mSdp->GetAttributeList().HasAttribute(SdpAttribute::kIdentityAttribute));
auto identity = mSdp->GetAttributeList().GetIdentity();
@ -2088,7 +2095,8 @@ TEST_P(NewSdpTest, CheckIdentity) {
TEST_P(NewSdpTest, CheckDtlsMessage) {
ParseSdp(kBasicAudioVideoOffer);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_TRUE(mSdp->GetAttributeList().HasAttribute(
SdpAttribute::kDtlsMessageAttribute));
auto dtls_message = mSdp->GetAttributeList().GetDtlsMessage();
@ -2100,14 +2108,16 @@ TEST_P(NewSdpTest, CheckDtlsMessage) {
TEST_P(NewSdpTest, CheckNumberOfMediaSections) {
ParseSdp(kBasicAudioVideoOffer);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(3U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
}
TEST_P(NewSdpTest, CheckMlines) {
ParseSdp(kBasicAudioVideoOffer);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(3U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
ASSERT_EQ(SdpMediaSection::kAudio, mSdp->GetMediaSection(0).GetMediaType())
@ -2139,7 +2149,8 @@ TEST_P(NewSdpTest, CheckMlines) {
TEST_P(NewSdpTest, CheckSetup) {
ParseSdp(kBasicAudioVideoOffer);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(3U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -2157,7 +2168,8 @@ TEST_P(NewSdpTest, CheckSetup) {
TEST_P(NewSdpTest, CheckSsrc) {
ParseSdp(kBasicAudioVideoOffer);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(3U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -2185,7 +2197,8 @@ TEST_P(NewSdpTest, CheckSsrc) {
TEST_P(NewSdpTest, CheckRtpmap) {
ParseSdp(kBasicAudioVideoOffer);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(3U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -2241,7 +2254,8 @@ static const std::string kAudioWithTelephoneEvent =
TEST_P(NewSdpTest, CheckTelephoneEventNoFmtp) {
ParseSdp(kAudioWithTelephoneEvent);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(1U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -2259,7 +2273,8 @@ TEST_P(NewSdpTest, CheckTelephoneEventNoFmtp) {
TEST_P(NewSdpTest, CheckTelephoneEventWithDefaultEvents) {
ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 0-15" CRLF);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(1U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -2268,7 +2283,8 @@ TEST_P(NewSdpTest, CheckTelephoneEventWithDefaultEvents) {
TEST_P(NewSdpTest, CheckTelephoneEventWithBadCharacter) {
ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 0-5." CRLF);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(1U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -2277,7 +2293,8 @@ TEST_P(NewSdpTest, CheckTelephoneEventWithBadCharacter) {
TEST_P(NewSdpTest, CheckTelephoneEventIncludingCommas) {
ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 0-15,66,67" CRLF);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(1U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -2286,7 +2303,8 @@ TEST_P(NewSdpTest, CheckTelephoneEventIncludingCommas) {
TEST_P(NewSdpTest, CheckTelephoneEventComplexEvents) {
ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 0,1,2-4,5-15,66,67" CRLF);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(1U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -2295,7 +2313,8 @@ TEST_P(NewSdpTest, CheckTelephoneEventComplexEvents) {
TEST_P(NewSdpTest, CheckTelephoneEventNoHyphen) {
ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 5,6,7" CRLF);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(1U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -2304,7 +2323,8 @@ TEST_P(NewSdpTest, CheckTelephoneEventNoHyphen) {
TEST_P(NewSdpTest, CheckTelephoneEventOnlyZero) {
ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 0" CRLF);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(1U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -2313,7 +2333,8 @@ TEST_P(NewSdpTest, CheckTelephoneEventOnlyZero) {
TEST_P(NewSdpTest, CheckTelephoneEventOnlyOne) {
ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 1" CRLF);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(1U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -2322,7 +2343,8 @@ TEST_P(NewSdpTest, CheckTelephoneEventOnlyOne) {
TEST_P(NewSdpTest, CheckTelephoneEventBadThreeDigit) {
ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 123" CRLF);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(1U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -2332,7 +2354,8 @@ TEST_P(NewSdpTest, CheckTelephoneEventBadThreeDigit) {
TEST_P(NewSdpTest, CheckTelephoneEventBadThreeDigitWithHyphen) {
ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 0-123" CRLF);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(1U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -2342,7 +2365,8 @@ TEST_P(NewSdpTest, CheckTelephoneEventBadThreeDigitWithHyphen) {
TEST_P(NewSdpTest, CheckTelephoneEventBadLeadingHyphen) {
ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 -12" CRLF);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(1U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -2360,7 +2384,8 @@ TEST_P(NewSdpTest, CheckTelephoneEventBadTrailingHyphenInMiddle) {
TEST_P(NewSdpTest, CheckTelephoneEventBadLeadingComma) {
ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 ,2,3" CRLF);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(1U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -2370,7 +2395,8 @@ TEST_P(NewSdpTest, CheckTelephoneEventBadLeadingComma) {
TEST_P(NewSdpTest, CheckTelephoneEventBadMultipleLeadingComma) {
ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 ,,,2,3" CRLF);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(1U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -2380,7 +2406,8 @@ TEST_P(NewSdpTest, CheckTelephoneEventBadMultipleLeadingComma) {
TEST_P(NewSdpTest, CheckTelephoneEventBadConsecutiveCommas) {
ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 1,,,,,,,,3" CRLF);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(1U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -2390,7 +2417,8 @@ TEST_P(NewSdpTest, CheckTelephoneEventBadConsecutiveCommas) {
TEST_P(NewSdpTest, CheckTelephoneEventBadTrailingComma) {
ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 1,2,3," CRLF);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(1U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -2400,7 +2428,8 @@ TEST_P(NewSdpTest, CheckTelephoneEventBadTrailingComma) {
TEST_P(NewSdpTest, CheckTelephoneEventBadTwoHyphens) {
ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 1-2-3" CRLF);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(1U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -2410,7 +2439,8 @@ TEST_P(NewSdpTest, CheckTelephoneEventBadTwoHyphens) {
TEST_P(NewSdpTest, CheckTelephoneEventBadSixDigit) {
ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 112233" CRLF);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(1U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -2420,7 +2450,8 @@ TEST_P(NewSdpTest, CheckTelephoneEventBadSixDigit) {
TEST_P(NewSdpTest, CheckTelephoneEventBadRangeReversed) {
ParseSdp(kAudioWithTelephoneEvent + "a=fmtp:101 33-2" CRLF);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(1U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -2441,7 +2472,8 @@ static const std::string kVideoWithRedAndUlpfecSdp =
TEST_P(NewSdpTest, CheckRedNoFmtp) {
ParseSdp(kVideoWithRedAndUlpfecSdp);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(1U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -2473,7 +2505,8 @@ TEST_P(NewSdpTest, CheckRedEmptyFmtp) {
}
}
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(1U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -2491,7 +2524,8 @@ TEST_P(NewSdpTest, CheckRedEmptyFmtp) {
TEST_P(NewSdpTest, CheckRedFmtpWith2Codecs) {
ParseSdp(kVideoWithRedAndUlpfecSdp + "a=fmtp:122 120/121" CRLF);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(1U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -2515,7 +2549,8 @@ TEST_P(NewSdpTest, CheckRedFmtpWith2Codecs) {
TEST_P(NewSdpTest, CheckRedFmtpWith3Codecs) {
ParseSdp(kVideoWithRedAndUlpfecSdp + "a=fmtp:122 120/121/123" CRLF);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(1U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -2599,7 +2634,8 @@ const std::string kH264AudioVideoOffer =
TEST_P(NewSdpTest, CheckFormatParameters) {
ParseSdp(kH264AudioVideoOffer);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(3U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -2712,7 +2748,8 @@ TEST_P(NewSdpTest, CheckFlags) {
TEST_P(NewSdpTest, CheckConnectionLines) {
ParseSdp(kBasicAudioVideoOffer);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(3U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -2739,7 +2776,8 @@ TEST_P(NewSdpTest, CheckConnectionLines) {
TEST_P(NewSdpTest, CheckDirections) {
ParseSdp(kBasicAudioVideoOffer);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(SdpDirectionAttribute::kSendonly,
mSdp->GetMediaSection(0).GetAttributeList().GetDirection());
ASSERT_EQ(SdpDirectionAttribute::kRecvonly,
@ -2750,7 +2788,8 @@ TEST_P(NewSdpTest, CheckDirections) {
TEST_P(NewSdpTest, CheckCandidates) {
ParseSdp(kBasicAudioVideoOffer);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(3U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -2926,7 +2965,8 @@ TEST_P(NewSdpTest, CheckRid) {
TEST_P(NewSdpTest, CheckMediaLevelIceUfrag) {
ParseSdp(kBasicAudioVideoOffer);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(3U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -2946,7 +2986,8 @@ TEST_P(NewSdpTest, CheckMediaLevelIceUfrag) {
TEST_P(NewSdpTest, CheckMediaLevelIcePwd) {
ParseSdp(kBasicAudioVideoOffer);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(3U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -3259,7 +3300,8 @@ TEST_P(NewSdpTest, CheckSimulcast) {
TEST_P(NewSdpTest, CheckSctpmap) {
ParseSdp(kBasicAudioVideoDataOffer);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(3U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -3280,7 +3322,8 @@ TEST_P(NewSdpTest, CheckSctpmap) {
TEST_P(NewSdpTest, CheckMaxPtime) {
ParseSdp(kBasicAudioVideoOffer);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(3U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -3719,11 +3762,9 @@ TEST_P(NewSdpTest, CheckNoAttributes) {
type != SdpAttribute::kDirectionAttribute) {
ASSERT_FALSE(
mSdp->GetMediaSection(0).GetAttributeList().HasAttribute(type))
<< "Attribute " << a
<< " should not have been present at media level";
<< "Attribute " << a << " should not have been present at media level";
ASSERT_FALSE(mSdp->GetAttributeList().HasAttribute(type))
<< "Attribute " << a
<< " should not have been present at session level";
<< "Attribute " << a << " should not have been present at session level";
}
}
@ -3749,7 +3790,8 @@ const std::string kMediaLevelDtlsMessage =
TEST_P(NewSdpTest, CheckMediaLevelDtlsMessage) {
ParseSdp(kMediaLevelDtlsMessage);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
// dtls-message is not defined for use at the media level; we don't
// parse it
@ -3765,7 +3807,8 @@ TEST_P(NewSdpTest, CheckSetPort) {
"a=sendonly" CRLF,
false);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
constexpr unsigned int expectedParesPort = 56436;
unsigned int currentPort = mSdp->GetMediaSection(0).GetPort();
@ -3782,7 +3825,8 @@ TEST_P(NewSdpTest, CheckAddCodec) {
"m=video 56436 RTP/SAVPF 120" CRLF "a=rtpmap:120 VP8/90000" CRLF
"a=sendonly" CRLF);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(1U, mSdp->GetMediaSectionCount());
ASSERT_EQ(1U, mSdp->GetMediaSection(0).GetFormats().size());
@ -3813,7 +3857,8 @@ TEST_P(NewSdpTest, CheckClearCodecs) {
"m=video 56436 RTP/SAVPF 120 110" CRLF "a=rtpmap:120 VP8/90000" CRLF
"a=sendonly" CRLF "a=rtpmap:110 opus/48000/2" CRLF);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(1U, mSdp->GetMediaSectionCount());
ASSERT_EQ(2U, mSdp->GetMediaSection(0).GetFormats().size());
@ -3831,7 +3876,8 @@ TEST_P(NewSdpTest, CheckClearCodecs) {
TEST_P(NewSdpTest, CheckAddMediaSection) {
ParseSdp(kBasicAudioVideoOffer);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(3U, mSdp->GetMediaSectionCount())
<< "Wrong number of media sections";
@ -3906,7 +3952,8 @@ TEST_P(NewSdpTest, CheckAddDataChannel_Draft05) {
"c=IN IP4 198.51.100.7" CRLF "b=CT:5000" CRLF "t=0 0" CRLF
"m=application 56436 DTLS/SCTP 5000" CRLF);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(1U, mSdp->GetMediaSectionCount());
auto& mediaSection = mSdp->GetMediaSection(0);
@ -3940,7 +3987,8 @@ TEST_P(NewSdpTest, CheckAddDataChannel) {
"c=IN IP4 198.51.100.7" CRLF "b=CT:5000" CRLF "t=0 0" CRLF
"m=application 56436 UDP/DTLS/SCTP webrtc-datachannel" CRLF);
ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_TRUE(!!mSdp)
<< "Parse failed: " << GetParseErrors();
ASSERT_EQ(1U, mSdp->GetMediaSectionCount());
auto& mediaSection = mSdp->GetMediaSection(0);
@ -3962,7 +4010,8 @@ TEST_P(NewSdpTest, CheckAddDataChannel) {
ASSERT_EQ(15000U, mediaSection.GetAttributeList().GetSctpPort());
}
TEST(NewSdpTestNoFixture, CheckParsingResultComparer) {
TEST(NewSdpTestNoFixture, CheckParsingResultComparer)
{
auto check_comparison = [](const std::string sdp_string) {
SipccSdpParser sipccParser;
RsdparsaSdpParser rustParser;
@ -4022,7 +4071,8 @@ TEST(NewSdpTestNoFixture, CheckParsingResultComparer) {
ASSERT_TRUE(check_comparison(kBasicH264Fmtp2));
}
TEST(NewSdpTestNoFixture, CheckAttributeTypeSerialize) {
TEST(NewSdpTestNoFixture, CheckAttributeTypeSerialize)
{
for (auto a = static_cast<size_t>(SdpAttribute::kFirstAttribute);
a <= static_cast<size_t>(SdpAttribute::kLastAttribute); ++a) {
SdpAttribute::AttributeType type =
@ -4048,7 +4098,8 @@ static SdpImageattrAttributeList::XYRange ParseXYRange(
return range;
}
TEST(NewSdpTestNoFixture, CheckImageattrXYRangeParseValid) {
TEST(NewSdpTestNoFixture, CheckImageattrXYRangeParseValid)
{
{
SdpImageattrAttributeList::XYRange range(ParseXYRange("640"));
ASSERT_EQ(1U, range.discreteValues.size());
@ -4093,7 +4144,7 @@ void ParseInvalid(const std::string& input, size_t last) {
T parsed;
std::string error;
ASSERT_FALSE(parsed.Parse(is, &error))
<< "\'" << input << "\' should not have parsed successfully";
<< "\'" << input << "\' should not have parsed successfully";
is.clear();
ASSERT_EQ(last, static_cast<size_t>(is.tellg()))
<< "Parse failed at unexpected location:" << std::endl
@ -4103,7 +4154,8 @@ void ParseInvalid(const std::string& input, size_t last) {
std::cout << "\"" << input << "\" - " << error << std::endl;
}
TEST(NewSdpTestNoFixture, CheckImageattrXYRangeParseInvalid) {
TEST(NewSdpTestNoFixture, CheckImageattrXYRangeParseInvalid)
{
ParseInvalid<SdpImageattrAttributeList::XYRange>("[-1", 1);
ParseInvalid<SdpImageattrAttributeList::XYRange>("[-", 1);
ParseInvalid<SdpImageattrAttributeList::XYRange>("[-v", 1);
@ -4152,7 +4204,8 @@ static SdpImageattrAttributeList::SRange ParseSRange(const std::string& input) {
return range;
}
TEST(NewSdpTestNoFixture, CheckImageattrSRangeParseValid) {
TEST(NewSdpTestNoFixture, CheckImageattrSRangeParseValid)
{
{
SdpImageattrAttributeList::SRange range(ParseSRange("0.1"));
ASSERT_EQ(1U, range.discreteValues.size());
@ -4182,7 +4235,8 @@ TEST(NewSdpTestNoFixture, CheckImageattrSRangeParseValid) {
}
}
TEST(NewSdpTestNoFixture, CheckImageattrSRangeParseInvalid) {
TEST(NewSdpTestNoFixture, CheckImageattrSRangeParseInvalid)
{
ParseInvalid<SdpImageattrAttributeList::SRange>("", 0);
ParseInvalid<SdpImageattrAttributeList::SRange>("[", 1);
ParseInvalid<SdpImageattrAttributeList::SRange>("[v", 1);
@ -4223,13 +4277,15 @@ static SdpImageattrAttributeList::PRange ParsePRange(const std::string& input) {
return range;
}
TEST(NewSdpTestNoFixture, CheckImageattrPRangeParseValid) {
TEST(NewSdpTestNoFixture, CheckImageattrPRangeParseValid)
{
SdpImageattrAttributeList::PRange range(ParsePRange("[0.1000-9.9999]"));
ASSERT_FLOAT_EQ(0.1f, range.min);
ASSERT_FLOAT_EQ(9.9999f, range.max);
}
TEST(NewSdpTestNoFixture, CheckImageattrPRangeParseInvalid) {
TEST(NewSdpTestNoFixture, CheckImageattrPRangeParseInvalid)
{
ParseInvalid<SdpImageattrAttributeList::PRange>("", 0);
ParseInvalid<SdpImageattrAttributeList::PRange>("[", 1);
ParseInvalid<SdpImageattrAttributeList::PRange>("[v", 1);
@ -4267,7 +4323,8 @@ static SdpImageattrAttributeList::Set ParseSet(const std::string& input) {
return set;
}
TEST(NewSdpTestNoFixture, CheckImageattrSetParseValid) {
TEST(NewSdpTestNoFixture, CheckImageattrSetParseValid)
{
{
SdpImageattrAttributeList::Set set(ParseSet("[x=320,y=240]"));
ASSERT_EQ(1U, set.xRange.discreteValues.size());
@ -4391,7 +4448,8 @@ TEST(NewSdpTestNoFixture, CheckImageattrSetParseValid) {
}
}
TEST(NewSdpTestNoFixture, CheckImageattrSetParseInvalid) {
TEST(NewSdpTestNoFixture, CheckImageattrSetParseInvalid)
{
ParseInvalid<SdpImageattrAttributeList::Set>("", 0);
ParseInvalid<SdpImageattrAttributeList::Set>("x", 0);
ParseInvalid<SdpImageattrAttributeList::Set>("[", 1);
@ -4439,7 +4497,8 @@ static SdpImageattrAttributeList::Imageattr ParseImageattr(
return imageattr;
}
TEST(NewSdpTestNoFixture, CheckImageattrParseValid) {
TEST(NewSdpTestNoFixture, CheckImageattrParseValid)
{
{
SdpImageattrAttributeList::Imageattr imageattr(ParseImageattr("* send *"));
ASSERT_FALSE(imageattr.pt.isSome());
@ -4571,7 +4630,8 @@ TEST(NewSdpTestNoFixture, CheckImageattrParseValid) {
}
}
TEST(NewSdpTestNoFixture, CheckImageattrParseInvalid) {
TEST(NewSdpTestNoFixture, CheckImageattrParseInvalid)
{
ParseInvalid<SdpImageattrAttributeList::Imageattr>("", 0);
ParseInvalid<SdpImageattrAttributeList::Imageattr>(" ", 0);
ParseInvalid<SdpImageattrAttributeList::Imageattr>("-1", 0);
@ -4595,7 +4655,8 @@ TEST(NewSdpTestNoFixture, CheckImageattrParseInvalid) {
"* send * recv [x=640,y=480] foobajooba", 28);
}
TEST(NewSdpTestNoFixture, CheckImageattrXYRangeSerialization) {
TEST(NewSdpTestNoFixture, CheckImageattrXYRangeSerialization)
{
SdpImageattrAttributeList::XYRange range;
std::stringstream os;
@ -4622,7 +4683,8 @@ TEST(NewSdpTestNoFixture, CheckImageattrXYRangeSerialization) {
ASSERT_EQ("[320,640]", os.str());
}
TEST(NewSdpTestNoFixture, CheckImageattrSRangeSerialization) {
TEST(NewSdpTestNoFixture, CheckImageattrSRangeSerialization)
{
SdpImageattrAttributeList::SRange range;
std::ostringstream os;
@ -4644,7 +4706,8 @@ TEST(NewSdpTestNoFixture, CheckImageattrSRangeSerialization) {
ASSERT_EQ("[0.1000,0.5000]", os.str());
}
TEST(NewSdpTestNoFixture, CheckImageattrPRangeSerialization) {
TEST(NewSdpTestNoFixture, CheckImageattrPRangeSerialization)
{
SdpImageattrAttributeList::PRange range;
std::ostringstream os;
@ -4654,7 +4717,8 @@ TEST(NewSdpTestNoFixture, CheckImageattrPRangeSerialization) {
ASSERT_EQ("[0.1000-0.9999]", os.str());
}
TEST(NewSdpTestNoFixture, CheckImageattrSetSerialization) {
TEST(NewSdpTestNoFixture, CheckImageattrSetSerialization)
{
SdpImageattrAttributeList::Set set;
std::ostringstream os;
@ -4691,7 +4755,8 @@ TEST(NewSdpTestNoFixture, CheckImageattrSetSerialization) {
os.str("");
}
TEST(NewSdpTestNoFixture, CheckImageattrSerialization) {
TEST(NewSdpTestNoFixture, CheckImageattrSerialization)
{
SdpImageattrAttributeList::Imageattr imageattr;
std::ostringstream os;
@ -4751,7 +4816,8 @@ TEST(NewSdpTestNoFixture, CheckImageattrSerialization) {
os.str("");
}
TEST(NewSdpTestNoFixture, CheckSimulcastVersionSerialize) {
TEST(NewSdpTestNoFixture, CheckSimulcastVersionSerialize)
{
std::ostringstream os;
SdpSimulcastAttribute::Version version;
@ -4782,7 +4848,8 @@ static SdpSimulcastAttribute::Version ParseSimulcastVersion(
return version;
}
TEST(NewSdpTestNoFixture, CheckSimulcastVersionValidParse) {
TEST(NewSdpTestNoFixture, CheckSimulcastVersionValidParse)
{
{
SdpSimulcastAttribute::Version version(ParseSimulcastVersion("1"));
ASSERT_EQ(1U, version.choices.size());
@ -4797,7 +4864,8 @@ TEST(NewSdpTestNoFixture, CheckSimulcastVersionValidParse) {
}
}
TEST(NewSdpTestNoFixture, CheckSimulcastVersionInvalidParse) {
TEST(NewSdpTestNoFixture, CheckSimulcastVersionInvalidParse)
{
ParseInvalid<SdpSimulcastAttribute::Version>("", 0);
ParseInvalid<SdpSimulcastAttribute::Version>(",", 0);
ParseInvalid<SdpSimulcastAttribute::Version>(";", 0);
@ -4808,7 +4876,8 @@ TEST(NewSdpTestNoFixture, CheckSimulcastVersionInvalidParse) {
ParseInvalid<SdpSimulcastAttribute::Version>("8,;", 2);
}
TEST(NewSdpTestNoFixture, CheckSimulcastVersionsSerialize) {
TEST(NewSdpTestNoFixture, CheckSimulcastVersionsSerialize)
{
std::ostringstream os;
SdpSimulcastAttribute::Versions versions;
@ -4852,7 +4921,8 @@ static SdpSimulcastAttribute::Versions ParseSimulcastVersions(
return list;
}
TEST(NewSdpTestNoFixture, CheckSimulcastVersionsValidParse) {
TEST(NewSdpTestNoFixture, CheckSimulcastVersionsValidParse)
{
{
SdpSimulcastAttribute::Versions versions(ParseSimulcastVersions("pt=8"));
ASSERT_EQ(1U, versions.size());
@ -4889,7 +4959,8 @@ TEST(NewSdpTestNoFixture, CheckSimulcastVersionsValidParse) {
}
}
TEST(NewSdpTestNoFixture, CheckSimulcastVersionsInvalidParse) {
TEST(NewSdpTestNoFixture, CheckSimulcastVersionsInvalidParse)
{
ParseInvalid<SdpSimulcastAttribute::Versions>("", 0);
ParseInvalid<SdpSimulcastAttribute::Versions>("x", 1);
ParseInvalid<SdpSimulcastAttribute::Versions>(";", 1);
@ -4904,7 +4975,8 @@ TEST(NewSdpTestNoFixture, CheckSimulcastVersionsInvalidParse) {
ParseInvalid<SdpSimulcastAttribute::Versions>("pt=8;;", 5);
}
TEST(NewSdpTestNoFixture, CheckSimulcastSerialize) {
TEST(NewSdpTestNoFixture, CheckSimulcastSerialize)
{
std::ostringstream os;
SdpSimulcastAttribute simulcast;
@ -4931,7 +5003,8 @@ static SdpSimulcastAttribute ParseSimulcast(const std::string& input) {
return simulcast;
}
TEST(NewSdpTestNoFixture, CheckSimulcastValidParse) {
TEST(NewSdpTestNoFixture, CheckSimulcastValidParse)
{
{
SdpSimulcastAttribute simulcast(ParseSimulcast(" send pt=8"));
ASSERT_EQ(1U, simulcast.sendVersions.size());
@ -4988,7 +5061,8 @@ TEST(NewSdpTestNoFixture, CheckSimulcastValidParse) {
}
}
TEST(NewSdpTestNoFixture, CheckSimulcastInvalidParse) {
TEST(NewSdpTestNoFixture, CheckSimulcastInvalidParse)
{
ParseInvalid<SdpSimulcastAttribute>("", 0);
ParseInvalid<SdpSimulcastAttribute>(" ", 1);
ParseInvalid<SdpSimulcastAttribute>("vcer ", 4);
@ -5007,7 +5081,8 @@ static SdpRidAttributeList::Rid ParseRid(const std::string& input) {
return rid;
}
TEST(NewSdpTestNoFixture, CheckRidValidParse) {
TEST(NewSdpTestNoFixture, CheckRidValidParse)
{
{
SdpRidAttributeList::Rid rid(ParseRid("1 send"));
ASSERT_EQ("1", rid.id);
@ -5292,7 +5367,8 @@ TEST(NewSdpTestNoFixture, CheckRidValidParse) {
}
}
TEST(NewSdpTestNoFixture, CheckRidInvalidParse) {
TEST(NewSdpTestNoFixture, CheckRidInvalidParse)
{
ParseInvalid<SdpRidAttributeList::Rid>("", 0);
ParseInvalid<SdpRidAttributeList::Rid>(" ", 0);
ParseInvalid<SdpRidAttributeList::Rid>("foo", 3);
@ -5319,7 +5395,8 @@ TEST(NewSdpTestNoFixture, CheckRidInvalidParse) {
ParseInvalid<SdpRidAttributeList::Rid>("foo send depend=1,", 18);
}
TEST(NewSdpTestNoFixture, CheckRidSerialize) {
TEST(NewSdpTestNoFixture, CheckRidSerialize)
{
{
SdpRidAttributeList::Rid rid;
rid.id = "foo";

View File

@ -66,7 +66,8 @@ static inline void TestThree(size_t size) {
ASSERT_NO_FATAL_FAILURE(TestOne(size + 1));
}
TEST(Jemalloc, UsableSizeInAdvance) {
TEST(Jemalloc, UsableSizeInAdvance)
{
/*
* Test every size up to a certain point, then (N-1, N, N+1) triplets for a
* various sizes beyond that.
@ -97,7 +98,8 @@ bool InfoEqFreedPage(jemalloc_ptr_info_t& aInfo, void* aAddr,
aInfo.size == aPageSize;
}
TEST(Jemalloc, PtrInfo) {
TEST(Jemalloc, PtrInfo)
{
// Some things might be running in other threads, so ensure our assumptions
// (e.g. about isFreedSmall and isFreedPage ratios below) are not altered by
// other threads.
@ -253,7 +255,8 @@ TEST(Jemalloc, PtrInfo) {
size_t sSizes[] = {1, 42, 79, 918, 1.5_KiB,
73_KiB, 129_KiB, 1.1_MiB, 2.6_MiB, 5.1_MiB};
TEST(Jemalloc, Arenas) {
TEST(Jemalloc, Arenas)
{
arena_id_t arena = moz_create_arena();
ASSERT_TRUE(arena != 0);
void* ptr = moz_arena_malloc(arena, 42);
@ -385,7 +388,8 @@ static bool CanReallocInPlace(size_t aFromSize, size_t aToSize,
return false;
}
TEST(Jemalloc, InPlace) {
TEST(Jemalloc, InPlace)
{
jemalloc_stats_t stats;
jemalloc_stats(&stats);
@ -417,7 +421,8 @@ TEST(Jemalloc, InPlace) {
// Bug 1474254: disable this test for windows ccov builds because it leads to
// timeout.
#if !defined(XP_WIN) || !defined(MOZ_CODE_COVERAGE)
TEST(Jemalloc, JunkPoison) {
TEST(Jemalloc, JunkPoison)
{
jemalloc_stats_t stats;
jemalloc_stats(&stats);

Some files were not shown because too many files have changed in this diff Show More