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

Side by Side Diff: chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root_unittest.cc

Issue 2580713004: mediaview: Implement ArcDocumentsProviderBackendDelegate. (Closed)
Patch Set: ThreadChecker failure fix. Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string.h> 5 #include <string.h>
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root.h" 14 #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root.h"
15 #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_util.h" 15 #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_util.h"
16 #include "components/arc/arc_bridge_service.h" 16 #include "components/arc/arc_bridge_service.h"
17 #include "components/arc/arc_service_manager.h" 17 #include "components/arc/arc_service_manager.h"
18 #include "components/arc/test/fake_file_system_instance.h" 18 #include "components/arc/test/fake_file_system_instance.h"
19 #include "content/public/test/test_browser_thread_bundle.h" 19 #include "content/public/test/test_browser_thread_bundle.h"
20 #include "storage/common/fileapi/directory_entry.h" 20 #include "storage/common/fileapi/directory_entry.h"
21 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
22 #include "url/gurl.h"
22 23
23 using storage::DirectoryEntry; 24 using storage::DirectoryEntry;
24 using EntryList = storage::AsyncFileUtil::EntryList; 25 using EntryList = storage::AsyncFileUtil::EntryList;
25 26
26 namespace arc { 27 namespace arc {
27 28
28 namespace { 29 namespace {
29 30
30 struct DocumentSpec { 31 struct DocumentSpec {
31 const char* document_id; 32 const char* document_id;
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 const EntryList& file_list, bool has_more) { 230 const EntryList& file_list, bool has_more) {
230 EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, error); 231 EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, error);
231 EXPECT_EQ(0u, file_list.size()); 232 EXPECT_EQ(0u, file_list.size());
232 EXPECT_FALSE(has_more); 233 EXPECT_FALSE(has_more);
233 run_loop->Quit(); 234 run_loop->Quit();
234 }, 235 },
235 &run_loop)); 236 &run_loop));
236 run_loop.Run(); 237 run_loop.Run();
237 } 238 }
238 239
240 TEST_F(ArcDocumentsProviderRootTest, ResolveToContentUrl) {
241 base::RunLoop run_loop;
242 root_->ResolveToContentUrl(
243 base::FilePath(FILE_PATH_LITERAL("pet/cat.png")),
244 base::Bind(
245 [](base::RunLoop* run_loop, const GURL& url) {
246 EXPECT_EQ(GURL("content://org.chromium.test/document/cat-id"), url);
247 run_loop->Quit();
248 },
249 &run_loop));
250 run_loop.Run();
251 }
252
253 TEST_F(ArcDocumentsProviderRootTest, ResolveToContentUrlRoot) {
254 base::RunLoop run_loop;
255 root_->ResolveToContentUrl(
256 base::FilePath(FILE_PATH_LITERAL("")),
257 base::Bind(
258 [](base::RunLoop* run_loop, const GURL& url) {
259 EXPECT_EQ(GURL("content://org.chromium.test/document/root-id"),
260 url);
261 run_loop->Quit();
262 },
263 &run_loop));
264 run_loop.Run();
265 }
266
267 TEST_F(ArcDocumentsProviderRootTest, ResolveToContentUrlNoSuchFile) {
268 base::RunLoop run_loop;
269 root_->ResolveToContentUrl(base::FilePath(FILE_PATH_LITERAL("pet/fox.jpg")),
270 base::Bind(
271 [](base::RunLoop* run_loop, const GURL& url) {
272 EXPECT_EQ(GURL(), url);
273 run_loop->Quit();
274 },
275 &run_loop));
276 run_loop.Run();
277 }
278
239 } // namespace arc 279 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698