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

Unified Diff: chrome/browser/extensions/api/file_system/file_system_apitest_chromeos.cc

Issue 137343008: Make chrome.fileSystem.chooseEntry work on Google Drive directories. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test. Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/api/file_system/file_system_api.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/file_system/file_system_apitest_chromeos.cc
diff --git a/chrome/browser/extensions/api/file_system/file_system_apitest_chromeos.cc b/chrome/browser/extensions/api/file_system/file_system_apitest_chromeos.cc
index 16abe55d56fd3bc345e9d06629047067b0c9cbba..400b27e473e29a4a597e797cfdd7e3eb6cb46922 100644
--- a/chrome/browser/extensions/api/file_system/file_system_apitest_chromeos.cc
+++ b/chrome/browser/extensions/api/file_system/file_system_apitest_chromeos.cc
@@ -77,6 +77,9 @@ class FileSystemApiTestForDrive : public PlatformAppBrowserTest {
void SetUpTestFileHierarchy() {
const std::string root = fake_drive_service_->GetRootResourceId();
ASSERT_TRUE(AddTestFile("open_existing.txt", "Can you see me?", root));
+ const std::string subdir = AddTestDirectory("subdir", root);
+ ASSERT_FALSE(subdir.empty());
+ ASSERT_TRUE(AddTestFile("open_existing.txt", "Can you see me?", subdir));
}
bool AddTestFile(const std::string& title,
@@ -92,6 +95,19 @@ class FileSystemApiTestForDrive : public PlatformAppBrowserTest {
return error == google_apis::HTTP_CREATED && resource_entry;
}
+ std::string AddTestDirectory(const std::string& title,
+ const std::string& parent_id) {
+ scoped_ptr<google_apis::ResourceEntry> resource_entry;
+ google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
+ fake_drive_service_->AddNewDirectory(
+ parent_id, title,
+ google_apis::test_util::CreateCopyResultCallback(&error,
+ &resource_entry));
+ content::RunAllPendingInMessageLoop();
+ return error == google_apis::HTTP_CREATED && resource_entry ?
+ resource_entry->resource_id() : "";
+ }
+
base::ScopedTempDir test_cache_root_;
drive::FakeDriveService* fake_drive_service_;
drive::DriveIntegrationService* integration_service_;
@@ -121,4 +137,47 @@ IN_PROC_BROWSER_TEST_F(FileSystemApiTestForDrive,
"api_test/file_system/open_existing_with_write")) << message_;
}
+IN_PROC_BROWSER_TEST_F(FileSystemApiTestForDrive,
+ FileSystemApiOpenDirectoryTest) {
+ base::FilePath test_directory =
+ drive::util::GetDriveMountPointPath().AppendASCII("root/subdir");
+ FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest(
+ &test_directory);
+ ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/open_directory"))
+ << message_;
+}
+
+IN_PROC_BROWSER_TEST_F(FileSystemApiTestForDrive,
+ FileSystemApiOpenDirectoryWithWriteTest) {
+ base::FilePath test_directory =
+ drive::util::GetDriveMountPointPath().AppendASCII("root/subdir");
+ FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest(
+ &test_directory);
+ ASSERT_TRUE(
+ RunPlatformAppTest("api_test/file_system/open_directory_with_write"))
+ << message_;
+}
+
+IN_PROC_BROWSER_TEST_F(FileSystemApiTestForDrive,
+ FileSystemApiOpenDirectoryWithoutPermissionTest) {
+ base::FilePath test_directory =
+ drive::util::GetDriveMountPointPath().AppendASCII("root/subdir");
+ FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest(
+ &test_directory);
+ ASSERT_TRUE(RunPlatformAppTest(
+ "api_test/file_system/open_directory_without_permission"))
+ << message_;
+}
+
+IN_PROC_BROWSER_TEST_F(FileSystemApiTestForDrive,
+ FileSystemApiOpenDirectoryWithOnlyWritePermissionTest) {
+ base::FilePath test_directory =
+ drive::util::GetDriveMountPointPath().AppendASCII("root/subdir");
+ FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest(
+ &test_directory);
+ ASSERT_TRUE(RunPlatformAppTest(
+ "api_test/file_system/open_directory_with_only_write"))
+ << message_;
+}
+
} // namespace extensions
« no previous file with comments | « chrome/browser/extensions/api/file_system/file_system_api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698