|
@@ -31,7 +31,7 @@ TEST_CASE(determine_computed_mime_type_given_no_sniff_is_unset)
|
|
EXPECT_EQ(xml_mime_type, MUST(computed_mime_type.serialized()));
|
|
EXPECT_EQ(xml_mime_type, MUST(computed_mime_type.serialized()));
|
|
}
|
|
}
|
|
|
|
|
|
-TEST_CASE(compute_unknown_mime_type)
|
|
|
|
|
|
+TEST_CASE(determine_computed_mime_type_in_both_none_and_browsing_sniffing_context)
|
|
{
|
|
{
|
|
HashMap<StringView, Vector<StringView>> mime_type_to_headers_map;
|
|
HashMap<StringView, Vector<StringView>> mime_type_to_headers_map;
|
|
|
|
|
|
@@ -84,8 +84,14 @@ TEST_CASE(compute_unknown_mime_type)
|
|
auto mime_type = mime_type_to_headers.key;
|
|
auto mime_type = mime_type_to_headers.key;
|
|
|
|
|
|
for (auto const& header : mime_type_to_headers.value) {
|
|
for (auto const& header : mime_type_to_headers.value) {
|
|
|
|
+
|
|
|
|
+ // Test in a non-specific sniffing context.
|
|
auto computed_mime_type = MUST(Web::MimeSniff::Resource::sniff(header.bytes()));
|
|
auto computed_mime_type = MUST(Web::MimeSniff::Resource::sniff(header.bytes()));
|
|
EXPECT_EQ(mime_type, computed_mime_type.essence());
|
|
EXPECT_EQ(mime_type, computed_mime_type.essence());
|
|
|
|
+
|
|
|
|
+ // Test sniffing in a browsing context.
|
|
|
|
+ computed_mime_type = MUST(Web::MimeSniff::Resource::sniff(header.bytes(), Web::MimeSniff::SniffingConfiguration { .sniffing_context = Web::MimeSniff::SniffingContext::Browsing }));
|
|
|
|
+ EXPECT_EQ(mime_type, computed_mime_type.essence());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|