Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / chrome / browser / chromeos / file_manager / external_filesystem_apitest.cc
blobe72e76f4f336b22de48ca8028701a745d1defe7d
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/bind.h"
6 #include "base/file_util.h"
7 #include "base/files/file_path.h"
8 #include "base/files/scoped_temp_dir.h"
9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/chrome_notification_types.h"
11 #include "chrome/browser/chromeos/drive/drive_integration_service.h"
12 #include "chrome/browser/chromeos/drive/test_util.h"
13 #include "chrome/browser/chromeos/file_manager/drive_test_util.h"
14 #include "chrome/browser/chromeos/file_manager/volume_manager.h"
15 #include "chrome/browser/drive/fake_drive_service.h"
16 #include "chrome/browser/extensions/extension_apitest.h"
17 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/profiles/profile_manager.h"
19 #include "chrome/browser/ui/browser.h"
20 #include "chrome/common/chrome_constants.h"
21 #include "content/public/browser/browser_context.h"
22 #include "content/public/browser/notification_service.h"
23 #include "content/public/test/test_utils.h"
24 #include "google_apis/drive/test_util.h"
25 #include "google_apis/drive/time_util.h"
26 #include "webkit/browser/fileapi/external_mount_points.h"
28 // Tests for access to external file systems (as defined in
29 // webkit/common/fileapi/file_system_types.h) from extensions with
30 // fileBrowserPrivate and fileBrowserHandler extension permissions.
31 // The tests cover following external file system types:
32 // - local (kFileSystemTypeLocalNative): a local file system on which files are
33 // accessed using native local path.
34 // - restricted (kFileSystemTypeRestrictedLocalNative): a *read-only* local file
35 // system which can only be accessed by extensions that have full access to
36 // external file systems (i.e. extensions with fileBrowserPrivate permission).
37 // - drive (kFileSystemTypeDrive): a file system that provides access to Google
38 // Drive.
40 // The tests cover following scenarios:
41 // - Performing file system operations on external file systems from an
42 // extension with fileBrowserPrivate permission (i.e. a file browser
43 // extension).
44 // - Performing read/write operations from file handler extensions. These
45 // extensions need a file browser extension to give them permissions to access
46 // files. This also includes file handler extensions in filesystem API.
47 // - Observing directory changes from a file browser extension (using
48 // fileBrowserPrivate API).
49 // - Doing searches on drive file system from file browser extension (using
50 // fileBrowserPrivate API).
52 using drive::DriveIntegrationServiceFactory;
53 using extensions::Extension;
55 namespace file_manager {
56 namespace {
58 // Root dirs for file systems expected by the test extensions.
59 // NOTE: Root dir for drive file system is set by Chrome's drive implementation,
60 // but the test will have to make sure the mount point is added before
61 // starting a test extension using WaitUntilDriveMountPointIsAdded().
62 const char kLocalMountPointName[] = "local";
63 const char kRestrictedMountPointName[] = "restricted";
65 // Default file content for the test files.
66 const char kTestFileContent[] = "This is some test content.";
68 // Sets up the initial file system state for native local and restricted native
69 // local file systems. The hierarchy is the same as for the drive file system.
70 // The directory is created at unique_temp_dir/|mount_point_name| path.
71 bool InitializeLocalFileSystem(std::string mount_point_name,
72 base::ScopedTempDir* tmp_dir,
73 base::FilePath* mount_point_dir) {
74 if (!tmp_dir->CreateUniqueTempDir())
75 return false;
77 *mount_point_dir = tmp_dir->path().AppendASCII(mount_point_name);
78 // Create the mount point.
79 if (!base::CreateDirectory(*mount_point_dir))
80 return false;
82 base::FilePath test_dir = mount_point_dir->AppendASCII("test_dir");
83 if (!base::CreateDirectory(test_dir))
84 return false;
86 base::FilePath test_subdir = test_dir.AppendASCII("empty_test_dir");
87 if (!base::CreateDirectory(test_subdir))
88 return false;
90 test_subdir = test_dir.AppendASCII("subdir");
91 if (!base::CreateDirectory(test_subdir))
92 return false;
94 base::FilePath test_file = test_dir.AppendASCII("test_file.xul");
95 if (!google_apis::test_util::WriteStringToFile(test_file, kTestFileContent))
96 return false;
98 test_file = test_dir.AppendASCII("test_file.xul.foo");
99 if (!google_apis::test_util::WriteStringToFile(test_file, kTestFileContent))
100 return false;
102 test_file = test_dir.AppendASCII("test_file.tiff");
103 if (!google_apis::test_util::WriteStringToFile(test_file, kTestFileContent))
104 return false;
106 test_file = test_dir.AppendASCII("test_file.tiff.foo");
107 if (!google_apis::test_util::WriteStringToFile(test_file, kTestFileContent))
108 return false;
110 test_file = test_dir.AppendASCII("empty_test_file.foo");
111 if (!google_apis::test_util::WriteStringToFile(test_file, ""))
112 return false;
114 return true;
117 scoped_ptr<google_apis::ResourceEntry> UpdateDriveEntryTime(
118 drive::FakeDriveService* fake_drive_service,
119 const std::string& resource_id,
120 const std::string& last_modified,
121 const std::string& last_viewed_by_me) {
122 base::Time last_modified_time, last_viewed_by_me_time;
123 if (!google_apis::util::GetTimeFromString(last_modified,
124 &last_modified_time) ||
125 !google_apis::util::GetTimeFromString(last_viewed_by_me,
126 &last_viewed_by_me_time))
127 return scoped_ptr<google_apis::ResourceEntry>();
129 google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
130 scoped_ptr<google_apis::ResourceEntry> entry;
131 fake_drive_service->UpdateResource(
132 resource_id,
133 std::string(), // parent_resource_id
134 std::string(), // title
135 last_modified_time,
136 last_viewed_by_me_time,
137 google_apis::test_util::CreateCopyResultCallback(&error, &entry));
138 base::RunLoop().RunUntilIdle();
139 if (error != google_apis::HTTP_SUCCESS)
140 return scoped_ptr<google_apis::ResourceEntry>();
142 return entry.Pass();
145 scoped_ptr<google_apis::ResourceEntry> AddFileToDriveService(
146 drive::FakeDriveService* fake_drive_service,
147 const std::string& mime_type,
148 const std::string& content,
149 const std::string& parent_resource_id,
150 const std::string& title,
151 const std::string& last_modified,
152 const std::string& last_viewed_by_me) {
153 google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
154 scoped_ptr<google_apis::ResourceEntry> entry;
155 fake_drive_service->AddNewFile(
156 mime_type,
157 content,
158 parent_resource_id,
159 title,
160 false, // shared_with_me
161 google_apis::test_util::CreateCopyResultCallback(&error, &entry));
162 base::RunLoop().RunUntilIdle();
163 if (error != google_apis::HTTP_CREATED)
164 return scoped_ptr<google_apis::ResourceEntry>();
166 return UpdateDriveEntryTime(fake_drive_service, entry->resource_id(),
167 last_modified, last_viewed_by_me);
170 scoped_ptr<google_apis::ResourceEntry> AddDirectoryToDriveService(
171 drive::FakeDriveService* fake_drive_service,
172 const std::string& parent_resource_id,
173 const std::string& title,
174 const std::string& last_modified,
175 const std::string& last_viewed_by_me) {
176 google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
177 scoped_ptr<google_apis::ResourceEntry> entry;
178 fake_drive_service->AddNewDirectory(
179 parent_resource_id,
180 title,
181 drive::DriveServiceInterface::AddNewDirectoryOptions(),
182 google_apis::test_util::CreateCopyResultCallback(&error, &entry));
183 base::RunLoop().RunUntilIdle();
184 if (error != google_apis::HTTP_CREATED)
185 return scoped_ptr<google_apis::ResourceEntry>();
187 return UpdateDriveEntryTime(fake_drive_service, entry->resource_id(),
188 last_modified, last_viewed_by_me);
191 // Sets up the drive service state.
192 // The hierarchy is the same as for the local file system.
193 bool InitializeDriveService(
194 drive::FakeDriveService* fake_drive_service,
195 std::map<std::string, std::string>* out_resource_ids) {
196 scoped_ptr<google_apis::ResourceEntry> entry;
198 entry = AddDirectoryToDriveService(fake_drive_service,
199 fake_drive_service->GetRootResourceId(),
200 "test_dir",
201 "2012-01-02T00:00:00.000Z",
202 "2012-01-02T00:00:01.000Z");
203 if (!entry)
204 return false;
205 (*out_resource_ids)[entry->title()] = entry->resource_id();
207 entry = AddDirectoryToDriveService(fake_drive_service,
208 (*out_resource_ids)["test_dir"],
209 "empty_test_dir",
210 "2011-11-02T04:00:00.000Z",
211 "2011-11-02T04:00:00.000Z");
212 if (!entry)
213 return false;
214 (*out_resource_ids)[entry->title()] = entry->resource_id();
216 entry = AddDirectoryToDriveService(fake_drive_service,
217 (*out_resource_ids)["test_dir"],
218 "subdir",
219 "2011-04-01T18:34:08.234Z",
220 "2012-01-02T00:00:01.000Z");
221 if (!entry)
222 return false;
223 (*out_resource_ids)[entry->title()] = entry->resource_id();
225 entry = AddFileToDriveService(fake_drive_service,
226 "application/vnd.mozilla.xul+xml",
227 kTestFileContent,
228 (*out_resource_ids)["test_dir"],
229 "test_file.xul",
230 "2011-12-14T00:40:47.330Z",
231 "2012-01-02T00:00:00.000Z");
232 if (!entry)
233 return false;
234 (*out_resource_ids)[entry->title()] = entry->resource_id();
236 entry = AddFileToDriveService(fake_drive_service,
237 "test/ro",
238 kTestFileContent,
239 (*out_resource_ids)["test_dir"],
240 "test_file.xul.foo",
241 "2012-01-01T10:00:30.000Z",
242 "2012-01-01T00:00:00.000Z");
243 if (!entry)
244 return false;
245 (*out_resource_ids)[entry->title()] = entry->resource_id();
247 entry = AddFileToDriveService(fake_drive_service,
248 "image/tiff",
249 kTestFileContent,
250 (*out_resource_ids)["test_dir"],
251 "test_file.tiff",
252 "2011-04-03T11:11:10.000Z",
253 "2012-01-02T00:00:00.000Z");
254 if (!entry)
255 return false;
256 (*out_resource_ids)[entry->title()] = entry->resource_id();
258 entry = AddFileToDriveService(fake_drive_service,
259 "test/rw",
260 kTestFileContent,
261 (*out_resource_ids)["test_dir"],
262 "test_file.tiff.foo",
263 "2011-12-14T00:40:47.330Z",
264 "2010-01-02T00:00:00.000Z");
265 if (!entry)
266 return false;
267 (*out_resource_ids)[entry->title()] = entry->resource_id();
269 entry = AddFileToDriveService(fake_drive_service,
270 "test/rw",
272 (*out_resource_ids)["test_dir"],
273 "empty_test_file.foo",
274 "2011-12-14T00:40:47.330Z",
275 "2011-12-14T00:40:47.330Z");
276 if (!entry)
277 return false;
278 (*out_resource_ids)[entry->title()] = entry->resource_id();
280 return true;
283 // Helper class to wait for a background page to load or close again.
284 class BackgroundObserver {
285 public:
286 BackgroundObserver()
287 : page_created_(chrome::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY,
288 content::NotificationService::AllSources()),
289 page_closed_(chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED,
290 content::NotificationService::AllSources()) {
293 void WaitUntilLoaded() {
294 page_created_.Wait();
297 void WaitUntilClosed() {
298 page_closed_.Wait();
301 private:
302 content::WindowedNotificationObserver page_created_;
303 content::WindowedNotificationObserver page_closed_;
306 // Base class for FileSystemExtensionApi tests.
307 class FileSystemExtensionApiTestBase : public ExtensionApiTest {
308 public:
309 enum Flags {
310 FLAGS_NONE = 0,
311 FLAGS_USE_FILE_HANDLER = 1 << 1,
312 FLAGS_LAZY_FILE_HANDLER = 1 << 2
315 FileSystemExtensionApiTestBase() {}
316 virtual ~FileSystemExtensionApiTestBase() {}
318 virtual void SetUp() OVERRIDE {
319 InitTestFileSystem();
320 ExtensionApiTest::SetUp();
323 virtual void SetUpOnMainThread() OVERRIDE {
324 AddTestMountPoint();
325 ExtensionApiTest::SetUpOnMainThread();
328 // Runs a file system extension API test.
329 // It loads test component extension at |filebrowser_path| with manifest
330 // at |filebrowser_manifest|. The |filebrowser_manifest| should be a path
331 // relative to |filebrowser_path|. The method waits until the test extension
332 // sends test succeed or fail message. It returns true if the test succeeds.
333 // If |FLAGS_USE_FILE_HANDLER| flag is set, the file handler extension at path
334 // |filehandler_path| will be loaded before the file browser extension.
335 // If the flag FLAGS_LAZY_FILE_HANDLER is set, the file handler extension must
336 // not have persistent background page. The test will wait until the file
337 // handler's background page is closed after initial load before the file
338 // browser extension is loaded.
339 // If |RunFileSystemExtensionApiTest| fails, |message_| will contain a failure
340 // message.
341 bool RunFileSystemExtensionApiTest(
342 const std::string& filebrowser_path,
343 const base::FilePath::CharType* filebrowser_manifest,
344 const std::string& filehandler_path,
345 int flags) {
346 if (flags & FLAGS_USE_FILE_HANDLER) {
347 if (filehandler_path.empty()) {
348 message_ = "Missing file handler path.";
349 return false;
352 BackgroundObserver page_complete;
353 const Extension* file_handler =
354 LoadExtension(test_data_dir_.AppendASCII(filehandler_path));
355 if (!file_handler)
356 return false;
358 if (flags & FLAGS_LAZY_FILE_HANDLER) {
359 page_complete.WaitUntilClosed();
360 } else {
361 page_complete.WaitUntilLoaded();
365 ResultCatcher catcher;
367 const Extension* file_browser = LoadExtensionAsComponentWithManifest(
368 test_data_dir_.AppendASCII(filebrowser_path),
369 filebrowser_manifest);
370 if (!file_browser)
371 return false;
373 if (!catcher.GetNextResult()) {
374 message_ = catcher.message();
375 return false;
378 return true;
381 protected:
382 // Sets up initial test file system hierarchy.
383 virtual void InitTestFileSystem() = 0;
384 // Registers mount point used in the test.
385 virtual void AddTestMountPoint() = 0;
388 // Tests for a native local file system.
389 class LocalFileSystemExtensionApiTest : public FileSystemExtensionApiTestBase {
390 public:
391 LocalFileSystemExtensionApiTest() {}
392 virtual ~LocalFileSystemExtensionApiTest() {}
394 // FileSystemExtensionApiTestBase OVERRIDE.
395 virtual void InitTestFileSystem() OVERRIDE {
396 ASSERT_TRUE(InitializeLocalFileSystem(
397 kLocalMountPointName, &tmp_dir_, &mount_point_dir_))
398 << "Failed to initialize file system.";
401 // FileSystemExtensionApiTestBase OVERRIDE.
402 virtual void AddTestMountPoint() OVERRIDE {
403 EXPECT_TRUE(content::BrowserContext::GetMountPoints(browser()->profile())->
404 RegisterFileSystem(kLocalMountPointName,
405 fileapi::kFileSystemTypeNativeLocal,
406 fileapi::FileSystemMountOption(),
407 mount_point_dir_));
408 VolumeManager::Get(browser()->profile())->AddVolumeInfoForTesting(
409 mount_point_dir_, VOLUME_TYPE_TESTING, chromeos::DEVICE_TYPE_UNKNOWN);
412 private:
413 base::ScopedTempDir tmp_dir_;
414 base::FilePath mount_point_dir_;
417 // Tests for restricted native local file systems.
418 class RestrictedFileSystemExtensionApiTest
419 : public FileSystemExtensionApiTestBase {
420 public:
421 RestrictedFileSystemExtensionApiTest() {}
422 virtual ~RestrictedFileSystemExtensionApiTest() {}
424 // FileSystemExtensionApiTestBase OVERRIDE.
425 virtual void InitTestFileSystem() OVERRIDE {
426 ASSERT_TRUE(InitializeLocalFileSystem(
427 kRestrictedMountPointName, &tmp_dir_, &mount_point_dir_))
428 << "Failed to initialize file system.";
431 // FileSystemExtensionApiTestBase OVERRIDE.
432 virtual void AddTestMountPoint() OVERRIDE {
433 EXPECT_TRUE(content::BrowserContext::GetMountPoints(browser()->profile())->
434 RegisterFileSystem(kRestrictedMountPointName,
435 fileapi::kFileSystemTypeRestrictedNativeLocal,
436 fileapi::FileSystemMountOption(),
437 mount_point_dir_));
438 VolumeManager::Get(browser()->profile())->AddVolumeInfoForTesting(
439 mount_point_dir_, VOLUME_TYPE_TESTING, chromeos::DEVICE_TYPE_UNKNOWN);
442 private:
443 base::ScopedTempDir tmp_dir_;
444 base::FilePath mount_point_dir_;
447 // Tests for a drive file system.
448 class DriveFileSystemExtensionApiTest : public FileSystemExtensionApiTestBase {
449 public:
450 DriveFileSystemExtensionApiTest() : fake_drive_service_(NULL) {}
451 virtual ~DriveFileSystemExtensionApiTest() {}
453 // FileSystemExtensionApiTestBase OVERRIDE.
454 virtual void InitTestFileSystem() OVERRIDE {
455 // Set up cache root to be used by DriveIntegrationService. This has to be
456 // done before the browser is created because the service instance is
457 // initialized by EventRouter.
458 ASSERT_TRUE(test_cache_root_.CreateUniqueTempDir());
460 // This callback will get called during Profile creation.
461 create_drive_integration_service_ = base::Bind(
462 &DriveFileSystemExtensionApiTest::CreateDriveIntegrationService,
463 base::Unretained(this));
464 service_factory_for_test_.reset(
465 new DriveIntegrationServiceFactory::ScopedFactoryForTest(
466 &create_drive_integration_service_));
469 // FileSystemExtensionApiTestBase OVERRIDE.
470 virtual void AddTestMountPoint() OVERRIDE {
471 test_util::WaitUntilDriveMountPointIsAdded(browser()->profile());
474 protected:
475 // DriveIntegrationService factory function for this test.
476 drive::DriveIntegrationService* CreateDriveIntegrationService(
477 Profile* profile) {
478 fake_drive_service_ = new drive::FakeDriveService;
479 fake_drive_service_->LoadAppListForDriveApi("drive/applist.json");
481 std::map<std::string, std::string> resource_ids;
482 EXPECT_TRUE(InitializeDriveService(fake_drive_service_, &resource_ids));
484 return new drive::DriveIntegrationService(
485 profile, NULL,
486 fake_drive_service_, "drive", test_cache_root_.path(), NULL);
489 base::ScopedTempDir test_cache_root_;
490 drive::FakeDriveService* fake_drive_service_;
491 DriveIntegrationServiceFactory::FactoryCallback
492 create_drive_integration_service_;
493 scoped_ptr<DriveIntegrationServiceFactory::ScopedFactoryForTest>
494 service_factory_for_test_;
497 // Tests for Drive file systems in multi-profile setting.
498 class MultiProfileDriveFileSystemExtensionApiTest :
499 public FileSystemExtensionApiTestBase {
500 public:
501 MultiProfileDriveFileSystemExtensionApiTest() : second_profile(NULL) {}
503 virtual void SetUpOnMainThread() OVERRIDE {
504 // Set up the secondary profile.
505 base::FilePath profile_dir;
506 base::CreateNewTempDirectory(base::FilePath::StringType(), &profile_dir);
507 profile_dir = profile_dir.AppendASCII(
508 std::string(chrome::kProfileDirPrefix) + "fileBrowserApiTestProfile2");
509 second_profile =
510 g_browser_process->profile_manager()->GetProfile(profile_dir);
512 FileSystemExtensionApiTestBase::SetUpOnMainThread();
515 virtual void InitTestFileSystem() OVERRIDE {
516 // This callback will get called during Profile creation.
517 create_drive_integration_service_ = base::Bind(
518 &MultiProfileDriveFileSystemExtensionApiTest::
519 CreateDriveIntegrationService,
520 base::Unretained(this));
521 service_factory_for_test_.reset(
522 new DriveIntegrationServiceFactory::ScopedFactoryForTest(
523 &create_drive_integration_service_));
526 virtual void AddTestMountPoint() OVERRIDE {
527 test_util::WaitUntilDriveMountPointIsAdded(browser()->profile());
528 test_util::WaitUntilDriveMountPointIsAdded(second_profile);
531 protected:
532 // DriveIntegrationService factory function for this test.
533 drive::DriveIntegrationService* CreateDriveIntegrationService(
534 Profile* profile) {
535 base::FilePath cache_dir;
536 base::CreateNewTempDirectory(base::FilePath::StringType(), &cache_dir);
538 drive::FakeDriveService* const fake_drive_service =
539 new drive::FakeDriveService;
540 fake_drive_service->LoadAppListForDriveApi("drive/applist.json");
541 EXPECT_TRUE(InitializeDriveService(fake_drive_service, &resource_ids_));
543 return new drive::DriveIntegrationService(
544 profile, NULL, fake_drive_service, std::string(), cache_dir, NULL);
547 bool AddTestHostedDocuments() {
548 const char kResourceId[] = "unique-id-for-multiprofile-copy-test";
549 drive::FakeDriveService* const main_service =
550 static_cast<drive::FakeDriveService*>(
551 drive::util::GetDriveServiceByProfile(browser()->profile()));
552 drive::FakeDriveService* const sub_service =
553 static_cast<drive::FakeDriveService*>(
554 drive::util::GetDriveServiceByProfile(second_profile));
556 google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
557 scoped_ptr<google_apis::ResourceEntry> entry;
559 // Place a hosted document under root/test_dir of the sub profile.
560 sub_service->AddNewFileWithResourceId(
561 kResourceId,
562 "application/vnd.google-apps.document", "",
563 resource_ids_["test_dir"], "hosted_doc", true,
564 google_apis::test_util::CreateCopyResultCallback(&error, &entry));
565 drive::test_util::RunBlockingPoolTask();
566 if (error != google_apis::HTTP_CREATED)
567 return false;
569 // Place the hosted document with no parent in the main profile, for
570 // simulating the situation that the document is shared to the main profile.
571 error = google_apis::GDATA_OTHER_ERROR;
572 main_service->AddNewFileWithResourceId(
573 kResourceId,
574 "application/vnd.google-apps.document", "", "", "hosted_doc", true,
575 google_apis::test_util::CreateCopyResultCallback(&error, &entry));
576 drive::test_util::RunBlockingPoolTask();
577 return (error == google_apis::HTTP_CREATED);
580 DriveIntegrationServiceFactory::FactoryCallback
581 create_drive_integration_service_;
582 scoped_ptr<DriveIntegrationServiceFactory::ScopedFactoryForTest>
583 service_factory_for_test_;
584 Profile* second_profile;
585 std::map<std::string, std::string> resource_ids_;
589 // LocalFileSystemExtensionApiTests.
592 IN_PROC_BROWSER_TEST_F(LocalFileSystemExtensionApiTest, FileSystemOperations) {
593 EXPECT_TRUE(RunFileSystemExtensionApiTest(
594 "file_browser/filesystem_operations_test",
595 FILE_PATH_LITERAL("manifest.json"),
597 FLAGS_NONE)) << message_;
600 IN_PROC_BROWSER_TEST_F(LocalFileSystemExtensionApiTest, FileWatch) {
601 EXPECT_TRUE(RunFileSystemExtensionApiTest(
602 "file_browser/file_watcher_test",
603 FILE_PATH_LITERAL("manifest.json"),
605 FLAGS_NONE)) << message_;
608 IN_PROC_BROWSER_TEST_F(LocalFileSystemExtensionApiTest, FileBrowserHandlers) {
609 EXPECT_TRUE(RunFileSystemExtensionApiTest(
610 "file_browser/handler_test_runner",
611 FILE_PATH_LITERAL("manifest.json"),
612 "file_browser/file_browser_handler",
613 FLAGS_USE_FILE_HANDLER)) << message_;
616 IN_PROC_BROWSER_TEST_F(LocalFileSystemExtensionApiTest,
617 FileBrowserHandlersLazy) {
618 EXPECT_TRUE(RunFileSystemExtensionApiTest(
619 "file_browser/handler_test_runner",
620 FILE_PATH_LITERAL("manifest.json"),
621 "file_browser/file_browser_handler_lazy",
622 FLAGS_USE_FILE_HANDLER | FLAGS_LAZY_FILE_HANDLER)) << message_;
625 IN_PROC_BROWSER_TEST_F(LocalFileSystemExtensionApiTest, AppFileHandler) {
626 EXPECT_TRUE(RunFileSystemExtensionApiTest(
627 "file_browser/handler_test_runner",
628 FILE_PATH_LITERAL("manifest.json"),
629 "file_browser/app_file_handler",
630 FLAGS_USE_FILE_HANDLER)) << message_;
634 // RestrictedFileSystemExtensionApiTests.
636 IN_PROC_BROWSER_TEST_F(RestrictedFileSystemExtensionApiTest,
637 FileSystemOperations) {
638 EXPECT_TRUE(RunFileSystemExtensionApiTest(
639 "file_browser/filesystem_operations_test",
640 FILE_PATH_LITERAL("manifest.json"),
642 FLAGS_NONE)) << message_;
646 // DriveFileSystemExtensionApiTests.
648 IN_PROC_BROWSER_TEST_F(DriveFileSystemExtensionApiTest, FileSystemOperations) {
649 EXPECT_TRUE(RunFileSystemExtensionApiTest(
650 "file_browser/filesystem_operations_test",
651 FILE_PATH_LITERAL("manifest.json"),
653 FLAGS_NONE)) << message_;
656 IN_PROC_BROWSER_TEST_F(DriveFileSystemExtensionApiTest, FileWatch) {
657 EXPECT_TRUE(RunFileSystemExtensionApiTest(
658 "file_browser/file_watcher_test",
659 FILE_PATH_LITERAL("manifest.json"),
661 FLAGS_NONE)) << message_;
664 IN_PROC_BROWSER_TEST_F(DriveFileSystemExtensionApiTest, FileBrowserHandlers) {
665 EXPECT_TRUE(RunFileSystemExtensionApiTest(
666 "file_browser/handler_test_runner",
667 FILE_PATH_LITERAL("manifest.json"),
668 "file_browser/file_browser_handler",
669 FLAGS_USE_FILE_HANDLER)) << message_;
672 IN_PROC_BROWSER_TEST_F(DriveFileSystemExtensionApiTest, Search) {
673 // Configure the drive service to return only one search result at a time
674 // to simulate paginated searches.
675 fake_drive_service_->set_default_max_results(1);
676 EXPECT_TRUE(RunFileSystemExtensionApiTest(
677 "file_browser/drive_search_test",
678 FILE_PATH_LITERAL("manifest.json"),
680 FLAGS_NONE)) << message_;
683 IN_PROC_BROWSER_TEST_F(DriveFileSystemExtensionApiTest, AppFileHandler) {
684 EXPECT_TRUE(RunFileSystemExtensionApiTest(
685 "file_browser/handler_test_runner",
686 FILE_PATH_LITERAL("manifest.json"),
687 "file_browser/app_file_handler",
688 FLAGS_USE_FILE_HANDLER)) << message_;
691 IN_PROC_BROWSER_TEST_F(MultiProfileDriveFileSystemExtensionApiTest,
692 CrossProfileCopy) {
693 ASSERT_TRUE(AddTestHostedDocuments());
694 EXPECT_TRUE(RunFileSystemExtensionApiTest(
695 "file_browser/multi_profile_copy",
696 FILE_PATH_LITERAL("manifest.json"),
698 FLAGS_NONE)) << message_;
701 } // namespace
702 } // namespace file_manager