Index: chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root_unittest.cc |
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root_unittest.cc b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root_unittest.cc |
index 1bbef1cdf559c607e3d6ed4f05fe074260526ea5..b74552ae5a7486e12890d9639c3290aaca420163 100644 |
--- a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root_unittest.cc |
+++ b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root_unittest.cc |
@@ -19,6 +19,7 @@ |
#include "content/public/test/test_browser_thread_bundle.h" |
#include "storage/common/fileapi/directory_entry.h" |
#include "testing/gtest/include/gtest/gtest.h" |
+#include "url/gurl.h" |
using storage::DirectoryEntry; |
using EntryList = storage::AsyncFileUtil::EntryList; |
@@ -309,4 +310,60 @@ TEST_F(ArcDocumentsProviderRootTest, ReadDirectoryDups) { |
run_loop.Run(); |
} |
+TEST_F(ArcDocumentsProviderRootTest, ResolveToContentUrl) { |
+ base::RunLoop run_loop; |
+ root_->ResolveToContentUrl( |
+ base::FilePath(FILE_PATH_LITERAL("dir/photo.jpg")), |
+ base::Bind( |
+ [](base::RunLoop* run_loop, const GURL& url) { |
+ EXPECT_EQ(GURL("content://org.chromium.test/document/photo-id"), |
+ url); |
+ run_loop->Quit(); |
+ }, |
+ &run_loop)); |
+ run_loop.Run(); |
+} |
+ |
+TEST_F(ArcDocumentsProviderRootTest, ResolveToContentUrlRoot) { |
+ base::RunLoop run_loop; |
+ root_->ResolveToContentUrl( |
+ base::FilePath(FILE_PATH_LITERAL("")), |
+ base::Bind( |
+ [](base::RunLoop* run_loop, const GURL& url) { |
+ EXPECT_EQ(GURL("content://org.chromium.test/document/root-id"), |
+ url); |
+ run_loop->Quit(); |
+ }, |
+ &run_loop)); |
+ run_loop.Run(); |
+} |
+ |
+TEST_F(ArcDocumentsProviderRootTest, ResolveToContentUrlNoSuchFile) { |
+ base::RunLoop run_loop; |
+ root_->ResolveToContentUrl(base::FilePath(FILE_PATH_LITERAL("missing")), |
+ base::Bind( |
+ [](base::RunLoop* run_loop, const GURL& url) { |
+ EXPECT_EQ(GURL(), url); |
+ run_loop->Quit(); |
+ }, |
+ &run_loop)); |
+ run_loop.Run(); |
+} |
+ |
+TEST_F(ArcDocumentsProviderRootTest, ResolveToContentUrlDups) { |
+ base::RunLoop run_loop; |
+ // "dup 2.mp4" should map to the 3rd instance of "dup.mp4" regardless of the |
+ // order returned from FileSystemInstance. |
+ root_->ResolveToContentUrl( |
+ base::FilePath(FILE_PATH_LITERAL("dups/dup (2).mp4")), |
+ base::Bind( |
+ [](base::RunLoop* run_loop, const GURL& url) { |
+ EXPECT_EQ(GURL("content://org.chromium.test/document/dup3-id"), |
+ url); |
+ run_loop->Quit(); |
+ }, |
+ &run_loop)); |
+ run_loop.Run(); |
+} |
+ |
} // namespace arc |