Commit f32af4ae authored by Noel Gordon's avatar Noel Gordon Committed by Commit Bot

[filesapp] Support SVG files in file manager unittest harness

Update the file manager unittest harness: add SVG files to the list of
allowable file types that it can serve.

Bug: 1061388
Change-Id: I6ee69e26946a368da77373c2cd8c643cc856c603
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2138931Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Commit-Queue: Noel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756931}
parent 18fa197b
......@@ -73,9 +73,10 @@ class TestFilesDataSource : public content::URLDataSource {
// Do some basic validation of the file extension.
CHECK(src_file_path.Extension() == ".html" ||
src_file_path.Extension() == ".js" ||
src_file_path.Extension() == ".css")
<< "chrome://file_manager_test/ only supports .html/.js/.css extension "
"files";
src_file_path.Extension() == ".css" ||
src_file_path.Extension() == ".svg")
<< "chrome://file_manager_test/ only supports .html/.js/.css/.svg "
"extension files";
CHECK(base::PathExists(src_file_path) || base::PathExists(gen_file_path))
<< src_file_path << " or: " << gen_file_path << " input path: " << path;
......@@ -88,7 +89,7 @@ class TestFilesDataSource : public content::URLDataSource {
std::move(callback).Run(response.get());
}
// It currently only serves HTML/JS/CSS.
// It currently only serves HTML/JS/CSS/SVG.
std::string GetMimeType(const std::string& path) override {
if (base::EndsWith(path, ".html", base::CompareCase::INSENSITIVE_ASCII)) {
return "text/html";
......@@ -98,8 +99,16 @@ class TestFilesDataSource : public content::URLDataSource {
return "text/css";
}
CHECK(base::EndsWith(path, ".js", base::CompareCase::INSENSITIVE_ASCII));
return "application/javascript";
if (base::EndsWith(path, ".js", base::CompareCase::INSENSITIVE_ASCII)) {
return "application/javascript";
}
if (base::EndsWith(path, ".svg", base::CompareCase::INSENSITIVE_ASCII)) {
return "image/svg+xml";
}
LOG(FATAL) << "unsupported file type: " << path;
return {};
}
std::string GetContentSecurityPolicyScriptSrc() override {
......
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