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

Side by Side Diff: chrome/browser/chromeos/file_manager/external_filesystem_apitest.cc

Issue 300063006: Files.app: Let Files.app pass mutliple files to file handlers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « apps/launcher.cc ('k') | chrome/browser/chromeos/file_manager/file_tasks.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 } 592 }
593 593
594 DriveIntegrationServiceFactory::FactoryCallback 594 DriveIntegrationServiceFactory::FactoryCallback
595 create_drive_integration_service_; 595 create_drive_integration_service_;
596 scoped_ptr<DriveIntegrationServiceFactory::ScopedFactoryForTest> 596 scoped_ptr<DriveIntegrationServiceFactory::ScopedFactoryForTest>
597 service_factory_for_test_; 597 service_factory_for_test_;
598 Profile* second_profile; 598 Profile* second_profile;
599 std::map<std::string, std::string> resource_ids_; 599 std::map<std::string, std::string> resource_ids_;
600 }; 600 };
601 601
602 class LocalAndDriveFileSystemExtensionApiTest
603 : public FileSystemExtensionApiTestBase {
604 public:
605 LocalAndDriveFileSystemExtensionApiTest() {}
606 virtual ~LocalAndDriveFileSystemExtensionApiTest() {}
607
608 // FileSystemExtensionApiTestBase OVERRIDE.
609 virtual void InitTestFileSystem() OVERRIDE {
610 ASSERT_TRUE(InitializeLocalFileSystem(
611 kLocalMountPointName, &local_tmp_dir_, &local_mount_point_dir_))
612 << "Failed to initialize file system.";
613
614 // Set up cache root to be used by DriveIntegrationService. This has to be
615 // done before the browser is created because the service instance is
616 // initialized by EventRouter.
617 ASSERT_TRUE(test_cache_root_.CreateUniqueTempDir());
618
619 // This callback will get called during Profile creation.
620 create_drive_integration_service_ = base::Bind(
621 &LocalAndDriveFileSystemExtensionApiTest::CreateDriveIntegrationService,
622 base::Unretained(this));
623 service_factory_for_test_.reset(
624 new DriveIntegrationServiceFactory::ScopedFactoryForTest(
625 &create_drive_integration_service_));
626 }
627
628 // FileSystemExtensionApiTestBase OVERRIDE.
629 virtual void AddTestMountPoint() OVERRIDE {
630 EXPECT_TRUE(content::BrowserContext::GetMountPoints(browser()->profile())
631 ->RegisterFileSystem(kLocalMountPointName,
632 fileapi::kFileSystemTypeNativeLocal,
633 fileapi::FileSystemMountOption(),
634 local_mount_point_dir_));
635 VolumeManager::Get(browser()->profile())
636 ->AddVolumeInfoForTesting(local_mount_point_dir_,
637 VOLUME_TYPE_TESTING,
638 chromeos::DEVICE_TYPE_UNKNOWN);
639 test_util::WaitUntilDriveMountPointIsAdded(browser()->profile());
640 }
641
642 protected:
643 // DriveIntegrationService factory function for this test.
644 drive::DriveIntegrationService* CreateDriveIntegrationService(
645 Profile* profile) {
646 fake_drive_service_ = new drive::FakeDriveService;
647 fake_drive_service_->LoadAppListForDriveApi("drive/applist.json");
648
649 std::map<std::string, std::string> resource_ids;
650 EXPECT_TRUE(InitializeDriveService(fake_drive_service_, &resource_ids));
651
652 return new drive::DriveIntegrationService(profile,
653 NULL,
654 fake_drive_service_,
655 "drive",
656 test_cache_root_.path(),
657 NULL);
658 }
659
660 private:
661 // For local volume.
662 base::ScopedTempDir local_tmp_dir_;
663 base::FilePath local_mount_point_dir_;
664
665 // For drive volume.
666 base::ScopedTempDir test_cache_root_;
667 drive::FakeDriveService* fake_drive_service_;
668 DriveIntegrationServiceFactory::FactoryCallback
669 create_drive_integration_service_;
670 scoped_ptr<DriveIntegrationServiceFactory::ScopedFactoryForTest>
671 service_factory_for_test_;
672 };
673
602 // 674 //
603 // LocalFileSystemExtensionApiTests. 675 // LocalFileSystemExtensionApiTests.
604 // 676 //
605 677
606 IN_PROC_BROWSER_TEST_F(LocalFileSystemExtensionApiTest, FileSystemOperations) { 678 IN_PROC_BROWSER_TEST_F(LocalFileSystemExtensionApiTest, FileSystemOperations) {
607 EXPECT_TRUE(RunFileSystemExtensionApiTest( 679 EXPECT_TRUE(RunFileSystemExtensionApiTest(
608 "file_browser/filesystem_operations_test", 680 "file_browser/filesystem_operations_test",
609 FILE_PATH_LITERAL("manifest.json"), 681 FILE_PATH_LITERAL("manifest.json"),
610 "", 682 "",
611 FLAGS_NONE)) << message_; 683 FLAGS_NONE)) << message_;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 IN_PROC_BROWSER_TEST_F(MultiProfileDriveFileSystemExtensionApiTest, 777 IN_PROC_BROWSER_TEST_F(MultiProfileDriveFileSystemExtensionApiTest,
706 CrossProfileCopy) { 778 CrossProfileCopy) {
707 ASSERT_TRUE(AddTestHostedDocuments()); 779 ASSERT_TRUE(AddTestHostedDocuments());
708 EXPECT_TRUE(RunFileSystemExtensionApiTest( 780 EXPECT_TRUE(RunFileSystemExtensionApiTest(
709 "file_browser/multi_profile_copy", 781 "file_browser/multi_profile_copy",
710 FILE_PATH_LITERAL("manifest.json"), 782 FILE_PATH_LITERAL("manifest.json"),
711 "", 783 "",
712 FLAGS_NONE)) << message_; 784 FLAGS_NONE)) << message_;
713 } 785 }
714 786
787 //
788 // LocalAndDriveFileSystemExtensionApiTests.
789 //
790 IN_PROC_BROWSER_TEST_F(LocalAndDriveFileSystemExtensionApiTest,
791 AppFileHandlerMulti) {
792 EXPECT_TRUE(
793 RunFileSystemExtensionApiTest("file_browser/app_file_handler_multi",
794 FILE_PATH_LITERAL("manifest.json"),
795 "",
796 FLAGS_NONE))
797 << message_;
798 }
715 } // namespace 799 } // namespace
716 } // namespace file_manager 800 } // namespace file_manager
OLDNEW
« no previous file with comments | « apps/launcher.cc ('k') | chrome/browser/chromeos/file_manager/file_tasks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698