Commit 9de2b96f authored by Trent Apted's avatar Trent Apted Committed by Commit Bot

chrome://media-app: Do a case-insensitive comparison for matching media extensions.

Currently this only applies to .mkv files. Without the fix, '.MKV' in
the same folder as a photo won't be navigation options when Backlight
opens. (An .MKV will still be opened if selected by itself.)

Bug: b/169360871
Change-Id: I18cebbdadaa76466860784ab47230c75bfe0660b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2428513Reviewed-by: default avatarRachel Carpenter <carpenterr@chromium.org>
Commit-Queue: Trent Apted <tapted@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810447}
parent 460861fc
...@@ -599,7 +599,8 @@ async function getFileFromHandle(fileSystemHandle) { ...@@ -599,7 +599,8 @@ async function getFileFromHandle(fileSystemHandle) {
function isVideoOrImage(file) { function isVideoOrImage(file) {
// Check for .mkv explicitly because it is not a web-supported type, but is in // Check for .mkv explicitly because it is not a web-supported type, but is in
// common use on ChromeOS. // common use on ChromeOS.
return /^(image)|(video)\//.test(file.type) || /\.mkv$/.test(file.name); return /^(image)|(video)\//.test(file.type) ||
/\.mkv$/.test(file.name.toLowerCase());
} }
/** /**
......
...@@ -1036,26 +1036,27 @@ TEST_F('MediaAppUIBrowserTest', 'RelatedFiles', async () => { ...@@ -1036,26 +1036,27 @@ TEST_F('MediaAppUIBrowserTest', 'RelatedFiles', async () => {
{name: 'jiff.gif', type: 'image/gif'}, {name: 'jiff.gif', type: 'image/gif'},
{name: 'matroska.emkv'}, {name: 'matroska.emkv'},
{name: 'matroska.mkv'}, {name: 'matroska.mkv'},
{name: 'matryoshka.MKV'},
{name: 'noext', type: ''}, {name: 'noext', type: ''},
{name: 'other.txt', type: 'text/plain'}, {name: 'other.txt', type: 'text/plain'},
{name: 'text.txt', type: 'text/plain'}, {name: 'text.txt', type: 'text/plain'},
{name: 'world.webm', type: 'video/webm'}, {name: 'world.webm', type: 'video/webm'},
]; ];
const directory = await createMockTestDirectory(testFiles); const directory = await createMockTestDirectory(testFiles);
const [html, jpg, gif, emkv, mkv, ext, other, txt, webm] = const [html, jpg, gif, emkv, mkv, MKV, ext, other, txt, webm] =
directory.getFilesSync(); directory.getFilesSync();
await loadFilesWithoutSendingToGuest(directory, mkv); await loadFilesWithoutSendingToGuest(directory, mkv);
assertFilesToBe([mkv, webm, jpg, gif], 'mkv'); assertFilesToBe([mkv, MKV, webm, jpg, gif], 'mkv');
await loadFilesWithoutSendingToGuest(directory, jpg); await loadFilesWithoutSendingToGuest(directory, jpg);
assertFilesToBe([jpg, gif, mkv, webm], 'jpg'); assertFilesToBe([jpg, gif, mkv, MKV, webm], 'jpg');
await loadFilesWithoutSendingToGuest(directory, gif); await loadFilesWithoutSendingToGuest(directory, gif);
assertFilesToBe([gif, mkv, webm, jpg], 'gif'); assertFilesToBe([gif, mkv, MKV, webm, jpg], 'gif');
await loadFilesWithoutSendingToGuest(directory, webm); await loadFilesWithoutSendingToGuest(directory, webm);
assertFilesToBe([webm, jpg, gif, mkv], 'webm'); assertFilesToBe([webm, jpg, gif, mkv, MKV], 'webm');
await loadFilesWithoutSendingToGuest(directory, txt); await loadFilesWithoutSendingToGuest(directory, txt);
assertFilesToBe([txt, other], 'txt'); assertFilesToBe([txt, other], 'txt');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment