haikuwebkit/LayoutTests/inspector/unit-tests/mimetype-utilities.html

218 lines
9.7 KiB
HTML
Raw Permalink Normal View History

<!DOCTYPE html>
<html>
<head>
<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
<script>
function test()
{
let suite = InspectorTest.createSyncSuite("MIMETypeUtilities");
suite.addTestCase({
name: "parseMIMEType",
test() {
function test(fullMimeType, expected) {
InspectorTest.newline();
InspectorTest.log(`Test ${JSON.stringify(fullMimeType)}`);
let {
type: expectedType,
boundary: expectedBoundary,
encoding: expectedEncoding,
} = expected;
let {
type: actualType,
boundary: actualBoundary,
encoding: actualEncoding,
} = parseMIMEType(fullMimeType);
InspectorTest.expectEqual(actualType, expectedType, `type should be: ${JSON.stringify(expectedType)}`);
InspectorTest.expectEqual(actualBoundary, expectedBoundary, `boundary should be: ${JSON.stringify(expectedBoundary)}`);
InspectorTest.expectEqual(actualEncoding, expectedEncoding, `encoding should be: ${JSON.stringify(expectedEncoding)}`);
}
test(null, {
type: null,
boundary: null,
encoding: null,
});
test("a", {
type: "a",
boundary: null,
encoding: null,
});
test("mime", {
type: "mime",
boundary: null,
encoding: null,
});
test("mime-dash", {
type: "mime-dash",
boundary: null,
encoding: null,
});
test("mime/slash", {
type: "mime/slash",
boundary: null,
encoding: null,
});
test("mime+plus", {
type: "mime+plus",
boundary: null,
encoding: null,
});
test("mime/slash+plus", {
type: "mime/slash+plus",
boundary: null,
encoding: null,
});
test("mime/slash ;", {
type: "mime/slash",
boundary: null,
encoding: null,
});
test("mime ; semicolon", {
type: "mime",
boundary: null,
encoding: null,
});
test("mime/generic ; a = b", {
type: "mime/generic",
boundary: null,
encoding: null,
});
test("mime/generic ; boundary = charset", {
type: "mime/generic",
boundary: "charset",
encoding: null,
});
test("mime/generic ; charset = boundary", {
type: "mime/generic",
boundary: null,
encoding: "boundary",
});
test("mime/generic ; boundary = foo ; charset = bar", {
type: "mime/generic",
boundary: "foo",
encoding: "bar",
});
return true;
}
});
Web Inspector: Local Resource Overrides: UI for overriding image and font resource content https://bugs.webkit.org/show_bug.cgi?id=202016 <rdar://problem/55541475> Reviewed by Devin Rousso. Source/WebInspectorUI: Extend SourceCodeRevision to be a (content, base64Encoded, mimeType) tuple and make clients update the revision content more explicitly (`updateRevisionContent`). This also includes `blobContent` as a more explicit way to get the content as a Blob, which may not always be desired. Switch LocalResource use the originalRevision / currentRevision instead of keeping its own localContent / localContentIsBase64Encoded properties. Introduce a `DropZoneView` to simplify handling of presenting a drop zone over a specific element. And use it for the ImageResourceContentView for local resource overrides to accept new content. * Localizations/en.lproj/localizedStrings.js: * UserInterface/Main.html: New strings and resources. * .eslintrc: * UserInterface/Base/BlobUtilities.js: Added. (WI.BlobUtilities.blobForContent): (WI.BlobUtilities.decodeBase64ToBlob): (WI.BlobUtilities.textToBlob): (WI.BlobUtilities.blobAsText): (WI.BlobUtilities): * UserInterface/Base/FileUtilities.js: (WI.FileUtilities.async.readDataURL): (WI.FileUtilities): * UserInterface/Base/MIMETypeUtilities.js: (WI.fileExtensionForFilename): (WI.fileExtensionForURL): * UserInterface/Base/Utilities.js: Move around or introduce some minor utilities. * UserInterface/Models/SourceCodeRevision.js: (WI.SourceCodeRevision): (WI.SourceCodeRevision.prototype.get sourceCode): (WI.SourceCodeRevision.prototype.get content): (WI.SourceCodeRevision.prototype.get base64Encoded): (WI.SourceCodeRevision.prototype.get mimeType): (WI.SourceCodeRevision.prototype.get blobContent): (WI.SourceCodeRevision.prototype.updateRevisionContent): (WI.SourceCodeRevision.prototype.copy): (WI.SourceCodeRevision.prototype.set content): Deleted. Data is now a (content, base64Encoded, mimeType) tuple. * UserInterface/Controllers/NetworkManager.js: (WI.NetworkManager.prototype.responseIntercepted): (WI.NetworkManager.prototype._handleResourceContentDidChange): (WI.NetworkManager.prototype._persistLocalResourceOverrideSoonAfterContentChange): Deleted. This is now a unified resource content change path without anything special for local resource overrides. * UserInterface/Models/LocalResource.js: (WI.LocalResource.prototype.toJSON): (WI.LocalResource.prototype.requestContentFromBackend): (WI.LocalResource.prototype.handleCurrentRevisionContentChange): (WI.LocalResource): (WI.LocalResource.prototype.get localContent): Deleted. (WI.LocalResource.prototype.get localContentIsBase64Encoded): Deleted. (WI.LocalResource.prototype.hasContent): Deleted. (WI.LocalResource.prototype.setContent): Deleted. (WI.LocalResource.prototype.updateOverrideContent): Deleted. Use originalRevision / currentRevision as appropriate. * UserInterface/Views/DropZoneView.css: Added. (.drop-zone): (.drop-zone.visible): (@media (prefers-color-scheme: dark)): * UserInterface/Views/DropZoneView.js: Added. (WI.DropZoneView): (WI.DropZoneView.prototype.get delegate): (WI.DropZoneView.prototype.get targetElement): (WI.DropZoneView.prototype.set targetElement): (WI.DropZoneView.prototype.initialLayout): (WI.DropZoneView.prototype._startActiveDrag): (WI.DropZoneView.prototype._stopActiveDrag): (WI.DropZoneView.prototype._handleDragEnter): (WI.DropZoneView.prototype._handleDragLeave): (WI.DropZoneView.prototype._handleDragOver): (WI.DropZoneView.prototype._handleDrop): Simplified handling of a drop zone. * UserInterface/Views/ResourceContentView.js: (WI.ResourceContentView.prototype.removeLoadingIndicator): More safely remove children and subviews. (WI.ResourceContentView): (WI.ResourceContentView.prototype.get resource): (WI.ResourceContentView.prototype.get navigationItems): (WI.ResourceContentView.prototype.localResourceOverrideInitialContent): (WI.ResourceContentView.prototype.closed): (WI.ResourceContentView.prototype.removeLoadingIndicator): (WI.ResourceContentView.prototype._contentAvailable): (WI.ResourceContentView.prototype._issueWasAdded): (WI.ResourceContentView.prototype.async._handleCreateLocalResourceOverride): (WI.ResourceContentView.prototype._handleRemoveLocalResourceOverride): (WI.ResourceContentView.prototype._handleLocalResourceOverrideChanged): (WI.ResourceContentView.prototype._mouseWasClicked): * UserInterface/Views/TextResourceContentView.js: (WI.TextResourceContentView): (WI.TextResourceContentView.prototype.get navigationItems): (WI.TextResourceContentView.prototype.localResourceOverrideInitialContent): (WI.TextResourceContentView.prototype._contentWillPopulate): (WI.TextResourceContentView.prototype._contentDidPopulate): (WI.TextResourceContentView.prototype._textEditorContentDidChange): (WI.TextResourceContentView.prototype._shouldBeEditable): (WI.TextResourceContentView.prototype.async._handleCreateLocalResourceOverride): Deleted. (WI.TextResourceContentView.prototype._handleRemoveLocalResourceOverride): Deleted. (WI.TextResourceContentView.prototype._handleLocalResourceOverrideChanged): Deleted. Extract generalized local resource override properties into the ResourceContentView base class. * UserInterface/Views/FontResourceContentView.css: (.content-view.resource.font): (.content-view.resource.font > .drop-zone): (.content-view.resource.font > .preview-container): (.content-view.resource.font .preview): * UserInterface/Views/FontResourceContentView.js: (WI.FontResourceContentView): (WI.FontResourceContentView.prototype.contentAvailable): (WI.FontResourceContentView.prototype.shown): (WI.FontResourceContentView.prototype.hidden): (WI.FontResourceContentView.prototype.closed): (WI.FontResourceContentView.prototype.layout): (WI.FontResourceContentView.prototype._updatePreviewElement.createMetricElement): (WI.FontResourceContentView.prototype._updatePreviewElement): (WI.FontResourceContentView.prototype.dropZoneShouldAppearForDragEvent): (WI.FontResourceContentView.prototype.dropZoneHandleDrop): Create a drop zone that will update the font local resource override content. * UserInterface/Views/ImageResourceContentView.css: (.content-view.resource.image): (.content-view.resource.image > .drop-zone): (.content-view.resource.image > .img-container): (.content-view.resource.image img): * UserInterface/Views/ImageResourceContentView.js: (WI.ImageResourceContentView): (WI.ImageResourceContentView.prototype.get navigationItems): (WI.ImageResourceContentView.prototype.contentAvailable): (WI.ImageResourceContentView.prototype.closed): (WI.ImageResourceContentView.prototype.dropZoneShouldAppearForDragEvent): (WI.ImageResourceContentView.prototype.dropZoneHandleDrop): Create a drop zone that will update the image local resource override content. * UserInterface/Models/Script.js: (WI.Script.prototype.get mimeType): Seems like this should have a default value given there may not be a resource. * UserInterface/Views/LocalResourceOverridePopover.js: (WI.LocalResourceOverridePopover.prototype.show): Better handling here, since the utilities expects a number not a string. * UserInterface/Models/Resource.js: (WI.Resource.prototype.createObjectURL): * UserInterface/Views/LocalResourceOverrideTreeElement.js: (WI.LocalResourceOverrideTreeElement.prototype.willDismissPopover): Use currentRevision more appropriately. * UserInterface/Models/SourceCode.js: (WI.SourceCode.prototype._processContent): * UserInterface/Views/TextResourceContentView.js: (WI.TextResourceContentView.prototype._textEditorContentDidChange): * UserInterface/Controllers/CSSManager.js: (WI.CSSManager.prototype._resourceContentDidChange.applyStyleSheetChanges.styleSheetFound): (WI.CSSManager.prototype._resourceContentDidChange.applyStyleSheetChanges): (WI.CSSManager.prototype._resourceContentDidChange): (WI.CSSManager.prototype._updateResourceContent.fetchedStyleSheetContent): Update revision content more explicitly. LayoutTests: * inspector/unit-tests/mimetype-utilities-expected.txt: * inspector/unit-tests/mimetype-utilities.html: Test new utilities. * http/tests/inspector/network/fetch-response-body.html: * http/tests/inspector/network/xhr-response-body.html: Renamed utilities. Canonical link: https://commits.webkit.org/216314@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251024 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-11 20:44:05 +00:00
suite.addTestCase({
name: "fileExtensionForFilename",
test() {
InspectorTest.expectNull(WI.fileExtensionForFilename(null), `File extension for null filename should be null.`);
InspectorTest.expectEqual(WI.fileExtensionForURL("test"), null, `File extension for filename without a period should be null.`);
InspectorTest.expectEqual(WI.fileExtensionForURL("test."), null, `File extension for filename ending in a period should be null.`);
InspectorTest.expectEqual(WI.fileExtensionForFilename("foo.xyz"), "xyz", `File extension for "foo.xyz" should be "xyz".`);
InspectorTest.expectEqual(WI.fileExtensionForFilename("image.png"), "png", `File extension for "image.png" should be "png".`);
InspectorTest.expectEqual(WI.fileExtensionForFilename("image.gif"), "gif", `File extension for "image.png" should be "gif".`);
InspectorTest.expectEqual(WI.fileExtensionForFilename("script.js"), "js", `File extension for "script.js" should be "js".`);
InspectorTest.expectEqual(WI.fileExtensionForFilename("script.min.js"), "js", `File extension for "script.min.js" should be "js".`);
return true;
}
});
suite.addTestCase({
name: "fileExtensionForURL",
test() {
Web Inspector: Local Resource Overrides: UI for overriding image and font resource content https://bugs.webkit.org/show_bug.cgi?id=202016 <rdar://problem/55541475> Reviewed by Devin Rousso. Source/WebInspectorUI: Extend SourceCodeRevision to be a (content, base64Encoded, mimeType) tuple and make clients update the revision content more explicitly (`updateRevisionContent`). This also includes `blobContent` as a more explicit way to get the content as a Blob, which may not always be desired. Switch LocalResource use the originalRevision / currentRevision instead of keeping its own localContent / localContentIsBase64Encoded properties. Introduce a `DropZoneView` to simplify handling of presenting a drop zone over a specific element. And use it for the ImageResourceContentView for local resource overrides to accept new content. * Localizations/en.lproj/localizedStrings.js: * UserInterface/Main.html: New strings and resources. * .eslintrc: * UserInterface/Base/BlobUtilities.js: Added. (WI.BlobUtilities.blobForContent): (WI.BlobUtilities.decodeBase64ToBlob): (WI.BlobUtilities.textToBlob): (WI.BlobUtilities.blobAsText): (WI.BlobUtilities): * UserInterface/Base/FileUtilities.js: (WI.FileUtilities.async.readDataURL): (WI.FileUtilities): * UserInterface/Base/MIMETypeUtilities.js: (WI.fileExtensionForFilename): (WI.fileExtensionForURL): * UserInterface/Base/Utilities.js: Move around or introduce some minor utilities. * UserInterface/Models/SourceCodeRevision.js: (WI.SourceCodeRevision): (WI.SourceCodeRevision.prototype.get sourceCode): (WI.SourceCodeRevision.prototype.get content): (WI.SourceCodeRevision.prototype.get base64Encoded): (WI.SourceCodeRevision.prototype.get mimeType): (WI.SourceCodeRevision.prototype.get blobContent): (WI.SourceCodeRevision.prototype.updateRevisionContent): (WI.SourceCodeRevision.prototype.copy): (WI.SourceCodeRevision.prototype.set content): Deleted. Data is now a (content, base64Encoded, mimeType) tuple. * UserInterface/Controllers/NetworkManager.js: (WI.NetworkManager.prototype.responseIntercepted): (WI.NetworkManager.prototype._handleResourceContentDidChange): (WI.NetworkManager.prototype._persistLocalResourceOverrideSoonAfterContentChange): Deleted. This is now a unified resource content change path without anything special for local resource overrides. * UserInterface/Models/LocalResource.js: (WI.LocalResource.prototype.toJSON): (WI.LocalResource.prototype.requestContentFromBackend): (WI.LocalResource.prototype.handleCurrentRevisionContentChange): (WI.LocalResource): (WI.LocalResource.prototype.get localContent): Deleted. (WI.LocalResource.prototype.get localContentIsBase64Encoded): Deleted. (WI.LocalResource.prototype.hasContent): Deleted. (WI.LocalResource.prototype.setContent): Deleted. (WI.LocalResource.prototype.updateOverrideContent): Deleted. Use originalRevision / currentRevision as appropriate. * UserInterface/Views/DropZoneView.css: Added. (.drop-zone): (.drop-zone.visible): (@media (prefers-color-scheme: dark)): * UserInterface/Views/DropZoneView.js: Added. (WI.DropZoneView): (WI.DropZoneView.prototype.get delegate): (WI.DropZoneView.prototype.get targetElement): (WI.DropZoneView.prototype.set targetElement): (WI.DropZoneView.prototype.initialLayout): (WI.DropZoneView.prototype._startActiveDrag): (WI.DropZoneView.prototype._stopActiveDrag): (WI.DropZoneView.prototype._handleDragEnter): (WI.DropZoneView.prototype._handleDragLeave): (WI.DropZoneView.prototype._handleDragOver): (WI.DropZoneView.prototype._handleDrop): Simplified handling of a drop zone. * UserInterface/Views/ResourceContentView.js: (WI.ResourceContentView.prototype.removeLoadingIndicator): More safely remove children and subviews. (WI.ResourceContentView): (WI.ResourceContentView.prototype.get resource): (WI.ResourceContentView.prototype.get navigationItems): (WI.ResourceContentView.prototype.localResourceOverrideInitialContent): (WI.ResourceContentView.prototype.closed): (WI.ResourceContentView.prototype.removeLoadingIndicator): (WI.ResourceContentView.prototype._contentAvailable): (WI.ResourceContentView.prototype._issueWasAdded): (WI.ResourceContentView.prototype.async._handleCreateLocalResourceOverride): (WI.ResourceContentView.prototype._handleRemoveLocalResourceOverride): (WI.ResourceContentView.prototype._handleLocalResourceOverrideChanged): (WI.ResourceContentView.prototype._mouseWasClicked): * UserInterface/Views/TextResourceContentView.js: (WI.TextResourceContentView): (WI.TextResourceContentView.prototype.get navigationItems): (WI.TextResourceContentView.prototype.localResourceOverrideInitialContent): (WI.TextResourceContentView.prototype._contentWillPopulate): (WI.TextResourceContentView.prototype._contentDidPopulate): (WI.TextResourceContentView.prototype._textEditorContentDidChange): (WI.TextResourceContentView.prototype._shouldBeEditable): (WI.TextResourceContentView.prototype.async._handleCreateLocalResourceOverride): Deleted. (WI.TextResourceContentView.prototype._handleRemoveLocalResourceOverride): Deleted. (WI.TextResourceContentView.prototype._handleLocalResourceOverrideChanged): Deleted. Extract generalized local resource override properties into the ResourceContentView base class. * UserInterface/Views/FontResourceContentView.css: (.content-view.resource.font): (.content-view.resource.font > .drop-zone): (.content-view.resource.font > .preview-container): (.content-view.resource.font .preview): * UserInterface/Views/FontResourceContentView.js: (WI.FontResourceContentView): (WI.FontResourceContentView.prototype.contentAvailable): (WI.FontResourceContentView.prototype.shown): (WI.FontResourceContentView.prototype.hidden): (WI.FontResourceContentView.prototype.closed): (WI.FontResourceContentView.prototype.layout): (WI.FontResourceContentView.prototype._updatePreviewElement.createMetricElement): (WI.FontResourceContentView.prototype._updatePreviewElement): (WI.FontResourceContentView.prototype.dropZoneShouldAppearForDragEvent): (WI.FontResourceContentView.prototype.dropZoneHandleDrop): Create a drop zone that will update the font local resource override content. * UserInterface/Views/ImageResourceContentView.css: (.content-view.resource.image): (.content-view.resource.image > .drop-zone): (.content-view.resource.image > .img-container): (.content-view.resource.image img): * UserInterface/Views/ImageResourceContentView.js: (WI.ImageResourceContentView): (WI.ImageResourceContentView.prototype.get navigationItems): (WI.ImageResourceContentView.prototype.contentAvailable): (WI.ImageResourceContentView.prototype.closed): (WI.ImageResourceContentView.prototype.dropZoneShouldAppearForDragEvent): (WI.ImageResourceContentView.prototype.dropZoneHandleDrop): Create a drop zone that will update the image local resource override content. * UserInterface/Models/Script.js: (WI.Script.prototype.get mimeType): Seems like this should have a default value given there may not be a resource. * UserInterface/Views/LocalResourceOverridePopover.js: (WI.LocalResourceOverridePopover.prototype.show): Better handling here, since the utilities expects a number not a string. * UserInterface/Models/Resource.js: (WI.Resource.prototype.createObjectURL): * UserInterface/Views/LocalResourceOverrideTreeElement.js: (WI.LocalResourceOverrideTreeElement.prototype.willDismissPopover): Use currentRevision more appropriately. * UserInterface/Models/SourceCode.js: (WI.SourceCode.prototype._processContent): * UserInterface/Views/TextResourceContentView.js: (WI.TextResourceContentView.prototype._textEditorContentDidChange): * UserInterface/Controllers/CSSManager.js: (WI.CSSManager.prototype._resourceContentDidChange.applyStyleSheetChanges.styleSheetFound): (WI.CSSManager.prototype._resourceContentDidChange.applyStyleSheetChanges): (WI.CSSManager.prototype._resourceContentDidChange): (WI.CSSManager.prototype._updateResourceContent.fetchedStyleSheetContent): Update revision content more explicitly. LayoutTests: * inspector/unit-tests/mimetype-utilities-expected.txt: * inspector/unit-tests/mimetype-utilities.html: Test new utilities. * http/tests/inspector/network/fetch-response-body.html: * http/tests/inspector/network/xhr-response-body.html: Renamed utilities. Canonical link: https://commits.webkit.org/216314@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251024 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-11 20:44:05 +00:00
InspectorTest.expectNull(WI.fileExtensionForURL(null), `File extension for null URL should be null.`);
InspectorTest.expectEqual(WI.fileExtensionForURL("invalid-url"), null, `File extension for invalid URL should be null.`);
InspectorTest.expectEqual(WI.fileExtensionForURL("https://example.com"), null, `File extension for URL without last path component should be null.`);
InspectorTest.expectEqual(WI.fileExtensionForURL("https://example.com/"), null, `File extension for URL without last path component should be null.`);
InspectorTest.expectEqual(WI.fileExtensionForURL("https://example.com/test"), null, `File extension for URL with last path component without a period should be null.`);
InspectorTest.expectEqual(WI.fileExtensionForURL("https://example.com/foo.bar/test"), null, `File extension for URL with last path component without a period should be null.`);
InspectorTest.expectEqual(WI.fileExtensionForURL("https://example.com/test."), null, `File extension for URL with last path component ending in a period should be null.`);
InspectorTest.expectEqual(WI.fileExtensionForURL("https://example.com/foo.xyz"), "xyz", `File extension for "foo.xyz" should be "xyz".`);
InspectorTest.expectEqual(WI.fileExtensionForURL("https://example.com/image.png"), "png", `File extension for "image.png" should be "png".`);
InspectorTest.expectEqual(WI.fileExtensionForURL("https://example.com/image.gif"), "gif", `File extension for "image.png" should be "gif".`);
InspectorTest.expectEqual(WI.fileExtensionForURL("https://example.com/script.js"), "js", `File extension for "script.js" should be "js".`);
InspectorTest.expectEqual(WI.fileExtensionForURL("https://example.com/script.min.js"), "js", `File extension for "script.min.js" should be "js".`);
return true;
}
});
suite.addTestCase({
name: "fileExtensionForMIMEType",
test() {
InspectorTest.expectEqual(WI.fileExtensionForMIMEType(null), null, `File extension for null mime type should be null.`);
InspectorTest.expectEqual(WI.fileExtensionForMIMEType("invalid-mimetype"), null, `File extension for invalid mime type should be null.`);
InspectorTest.expectEqual(WI.fileExtensionForMIMEType("application/unknown"), null, `File extension for unknown mime type should be null.`);
InspectorTest.expectEqual(WI.fileExtensionForMIMEType("image/jpeg"), "jpg", `File extension for "image/jpeg" should be "jpg".`);
InspectorTest.expectEqual(WI.fileExtensionForMIMEType("image/png"), "png", `File extension for "image/png" should be "png".`);
InspectorTest.expectEqual(WI.fileExtensionForMIMEType("image/gif"), "gif", `File extension for "image/gif" should be "gif".`);
InspectorTest.expectEqual(WI.fileExtensionForMIMEType("text/javascript"), "js", `File extension for "text/javascript" should be "js".`);
InspectorTest.expectEqual(WI.fileExtensionForMIMEType("application/json"), "json", `File extension for "application/json" should be "json".`);
InspectorTest.expectEqual(WI.fileExtensionForMIMEType("application/vnd.api+json"), "json", `File extension for "application/vnd.api+json" should be "json".`);
InspectorTest.expectEqual(WI.fileExtensionForMIMEType("application/xhtml+xml"), "xhtml", `File extension for "application/xhtml+xml" should be "xhtml".`);
InspectorTest.expectEqual(WI.fileExtensionForMIMEType("image/svg+xml"), "svg", `File extension for "image/svg+xml" should be "svg".`);
InspectorTest.expectEqual(WI.fileExtensionForMIMEType("text/foo+xml"), "xml", `File extension for "text/foo+xml" should be "xml".`);
return true;
}
});
suite.addTestCase({
name: "shouldTreatMIMETypeAsText",
test() {
function expectText(mimeType) {
InspectorTest.expectTrue(WI.shouldTreatMIMETypeAsText(mimeType), `"${mimeType}" should be treated as text.`);
}
function expectNotText(mimeType) {
InspectorTest.expectFalse(WI.shouldTreatMIMETypeAsText(mimeType), `"${mimeType}" should not be treated as text.`);
}
InspectorTest.expectFalse(WI.shouldTreatMIMETypeAsText(null), `null mime type should not be treated as text.`);
expectNotText("application/unknown");
expectText("text/plain");
expectText("text/javascript");
expectText("application/json");
expectText("application/vnd.api+json");
expectText("application/vnd.apple.mpegurl");
expectText("image/svg+xml");
expectText("text/x-coffeescript");
expectText("application/xml");
expectNotText("image/jpeg");
expectNotText("image/png");
expectNotText("image/gif");
expectNotText("font/woff");
expectNotText("video/mpeg");
expectNotText("audio/ogg");
expectNotText("application/pdf");
return true;
}
})
suite.runTestCasesAndFinish();
}
</script>
</head>
<body onLoad="runTest()">
</body>
</html>