Chromium Code Reviews| Index: chrome/browser/chromeos/extensions/file_manager/file_manager_private_apitest.cc |
| diff --git a/chrome/browser/chromeos/extensions/file_manager/file_manager_private_apitest.cc b/chrome/browser/chromeos/extensions/file_manager/file_manager_private_apitest.cc |
| index d0b4541e4916fc44fc962d5f7c96d87366963cda..ba9f2259e50c4499c6d99491a8c7c93ff530acda 100644 |
| --- a/chrome/browser/chromeos/extensions/file_manager/file_manager_private_apitest.cc |
| +++ b/chrome/browser/chromeos/extensions/file_manager/file_manager_private_apitest.cc |
| @@ -15,6 +15,8 @@ |
| #include "chromeos/disks/mock_disk_mount_manager.h" |
| #include "extensions/common/extension.h" |
| #include "extensions/common/install_warning.h" |
| +#include "google_apis/drive/test_util.h" |
| +#include "storage/browser/fileapi/external_mount_points.h" |
| using ::testing::_; |
| using ::testing::ReturnRef; |
| @@ -384,3 +386,50 @@ IN_PROC_BROWSER_TEST_F(FileManagerPrivateApiTest, OnFileChanged) { |
| // message loop of BrowserThread::FILE. Wait until they are done. |
| content::RunAllPendingInMessageLoop(content::BrowserThread::FILE); |
| } |
| + |
| +bool InitializeLocalFileSystem(std::string mount_point_name, |
|
mtomasz
2015/01/08 00:38:40
This can go to an anonymous namespace.
Ben Kwa
2015/01/08 19:29:14
Done.
|
| + base::ScopedTempDir *tmp_dir, |
|
mtomasz
2015/01/08 00:38:40
nit: tmp_dir -> temp_dir for consistency with the
Ben Kwa
2015/01/08 19:29:14
Done.
|
| + base::FilePath* mount_point_dir) { |
| + const char kTestFileContent[] = "The five boxing wizards jumped quickly"; |
| + if (!tmp_dir->CreateUniqueTempDir()) |
| + return false; |
| + |
| + *mount_point_dir = tmp_dir->path().AppendASCII(mount_point_name); |
| + // Create the mount point. |
| + if (!base::CreateDirectory(*mount_point_dir)) |
| + return false; |
| + |
| + base::FilePath test_dir = mount_point_dir->AppendASCII("test_dir"); |
|
mtomasz
2015/01/08 00:38:40
nit: This can be const
Ben Kwa
2015/01/08 19:29:13
Done.
|
| + if (!base::CreateDirectory(test_dir)) |
| + return false; |
| + |
| + base::FilePath test_file = test_dir.AppendASCII("test_file.txt"); |
|
mtomasz
2015/01/08 00:38:40
nit: ditto
Ben Kwa
2015/01/08 19:29:14
Done.
|
| + if (!google_apis::test_util::WriteStringToFile(test_file, kTestFileContent)) |
| + return false; |
| + |
| + return true; |
| +} |
| + |
| +IN_PROC_BROWSER_TEST_F(FileManagerPrivateApiTest, ContentChecksum) { |
| + base::ScopedTempDir tmp_dir; |
| + base::FilePath mount_point_dir; |
| + const char kLocalMountPointName[] = "local"; |
| + |
| + ASSERT_TRUE(InitializeLocalFileSystem( |
| + kLocalMountPointName, &tmp_dir, &mount_point_dir)) |
| + << "Failed to initialize test file system"; |
| + |
| + EXPECT_TRUE(content::BrowserContext::GetMountPoints(browser()->profile()) |
| + ->RegisterFileSystem(kLocalMountPointName, |
| + storage::kFileSystemTypeNativeLocal, |
| + storage::FileSystemMountOption(), |
| + mount_point_dir)); |
| + file_manager::VolumeManager::Get( |
| + browser()->profile())->AddVolumeInfoForTesting( |
| + mount_point_dir, |
| + file_manager::VOLUME_TYPE_TESTING, |
| + chromeos::DEVICE_TYPE_UNKNOWN); |
| + |
| + ASSERT_TRUE(RunExtensionTestIgnoreManifestWarnings( |
|
mtomasz
2015/01/08 00:38:40
Is RunComponentExtensionTest enough? We don't expe
Ben Kwa
2015/01/08 19:29:14
Done.
|
| + "file_browser/content_checksum_test")); |
| +} |