| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/path_service.h" | 5 #include "base/path_service.h" |
| 6 #include "chrome/browser/apps/app_browsertest_util.h" | 6 #include "chrome/browser/apps/app_browsertest_util.h" |
| 7 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | 7 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
| 8 #include "chrome/browser/chromeos/drive/file_system_interface.h" | 8 #include "chrome/browser/chromeos/drive/file_system_interface.h" |
| 9 #include "chrome/browser/chromeos/drive/file_system_util.h" | 9 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 10 #include "chrome/browser/drive/fake_drive_service.h" | 10 #include "chrome/browser/drive/fake_drive_service.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 ASSERT_TRUE(AddTestFile("save_existing.txt", "Can you see me?", root)); | 83 ASSERT_TRUE(AddTestFile("save_existing.txt", "Can you see me?", root)); |
| 84 const std::string subdir = AddTestDirectory("subdir", root); | 84 const std::string subdir = AddTestDirectory("subdir", root); |
| 85 ASSERT_FALSE(subdir.empty()); | 85 ASSERT_FALSE(subdir.empty()); |
| 86 ASSERT_TRUE(AddTestFile("open_existing.txt", "Can you see me?", subdir)); | 86 ASSERT_TRUE(AddTestFile("open_existing.txt", "Can you see me?", subdir)); |
| 87 } | 87 } |
| 88 | 88 |
| 89 bool AddTestFile(const std::string& title, | 89 bool AddTestFile(const std::string& title, |
| 90 const std::string& data, | 90 const std::string& data, |
| 91 const std::string& parent_id) { | 91 const std::string& parent_id) { |
| 92 scoped_ptr<google_apis::FileResource> entry; | 92 scoped_ptr<google_apis::FileResource> entry; |
| 93 google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; | 93 google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR; |
| 94 fake_drive_service_->AddNewFile( | 94 fake_drive_service_->AddNewFile( |
| 95 "text/plain", data, parent_id, title, false, | 95 "text/plain", data, parent_id, title, false, |
| 96 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); | 96 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); |
| 97 content::RunAllPendingInMessageLoop(); | 97 content::RunAllPendingInMessageLoop(); |
| 98 return error == google_apis::HTTP_CREATED && entry; | 98 return error == google_apis::HTTP_CREATED && entry; |
| 99 } | 99 } |
| 100 | 100 |
| 101 std::string AddTestDirectory(const std::string& title, | 101 std::string AddTestDirectory(const std::string& title, |
| 102 const std::string& parent_id) { | 102 const std::string& parent_id) { |
| 103 scoped_ptr<google_apis::FileResource> entry; | 103 scoped_ptr<google_apis::FileResource> entry; |
| 104 google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; | 104 google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR; |
| 105 fake_drive_service_->AddNewDirectory( | 105 fake_drive_service_->AddNewDirectory( |
| 106 parent_id, title, | 106 parent_id, title, |
| 107 drive::DriveServiceInterface::AddNewDirectoryOptions(), | 107 drive::DriveServiceInterface::AddNewDirectoryOptions(), |
| 108 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); | 108 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); |
| 109 content::RunAllPendingInMessageLoop(); | 109 content::RunAllPendingInMessageLoop(); |
| 110 return error == google_apis::HTTP_CREATED && entry ? entry->file_id() : ""; | 110 return error == google_apis::HTTP_CREATED && entry ? entry->file_id() : ""; |
| 111 } | 111 } |
| 112 | 112 |
| 113 base::ScopedTempDir test_cache_root_; | 113 base::ScopedTempDir test_cache_root_; |
| 114 drive::FakeDriveService* fake_drive_service_; | 114 drive::FakeDriveService* fake_drive_service_; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 FileSystemApiSaveExistingFileWithWriteTest) { | 247 FileSystemApiSaveExistingFileWithWriteTest) { |
| 248 base::FilePath test_file = drive::util::GetDriveMountPointPath( | 248 base::FilePath test_file = drive::util::GetDriveMountPointPath( |
| 249 browser()->profile()).AppendASCII("root/save_existing.txt"); | 249 browser()->profile()).AppendASCII("root/save_existing.txt"); |
| 250 FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( | 250 FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( |
| 251 &test_file); | 251 &test_file); |
| 252 ASSERT_TRUE(RunPlatformAppTest( | 252 ASSERT_TRUE(RunPlatformAppTest( |
| 253 "api_test/file_system/save_existing_with_write")) << message_; | 253 "api_test/file_system/save_existing_with_write")) << message_; |
| 254 } | 254 } |
| 255 | 255 |
| 256 } // namespace extensions | 256 } // namespace extensions |
| OLD | NEW |