Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: components/arc/test/fake_file_system_instance.cc

Issue 2914433002: arc: Use the MIME type returned by the container to handle content URLs (Closed)
Patch Set: Comment drop. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/arc/test/fake_file_system_instance.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/arc/test/fake_file_system_instance.cc
diff --git a/components/arc/test/fake_file_system_instance.cc b/components/arc/test/fake_file_system_instance.cc
index f522024e2c1f847d018479fc0045790146709617..88eabd93ff0401a16b230b8e2b7ecaa60aacd444 100644
--- a/components/arc/test/fake_file_system_instance.cc
+++ b/components/arc/test/fake_file_system_instance.cc
@@ -64,8 +64,9 @@ FakeFileSystemInstance::File::File(const File& that) = default;
FakeFileSystemInstance::File::File(const std::string& url,
const std::string& content,
+ const std::string& mime_type,
Seekable seekable)
- : url(url), content(content), seekable(seekable) {}
+ : url(url), content(content), mime_type(mime_type), seekable(seekable) {}
FakeFileSystemInstance::File::~File() = default;
@@ -170,6 +171,20 @@ void FakeFileSystemInstance::GetFileSize(const std::string& url,
FROM_HERE, base::Bind(callback, file.content.size()));
}
+void FakeFileSystemInstance::GetMimeType(const std::string& url,
+ const GetMimeTypeCallback& callback) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ auto iter = files_.find(url);
+ if (iter == files_.end()) {
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::BindOnce(callback, base::nullopt));
+ return;
+ }
+ const File& file = iter->second;
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::BindOnce(callback, file.mime_type));
+}
+
void FakeFileSystemInstance::OpenFileToRead(
const std::string& url,
const OpenFileToReadCallback& callback) {
« no previous file with comments | « components/arc/test/fake_file_system_instance.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698