#include "base/threading/sequenced_worker_pool.h"
#include "chrome/browser/sync_file_system/sync_file_system_test_util.h"
#include "chrome/browser/sync_file_system/sync_status_code.h"
-#include "content/public/test/test_browser_thread.h"
#include "google_apis/drive/drive_api_parser.h"
#include "google_apis/drive/gdata_wapi_parser.h"
#include "testing/gtest/include/gtest/gtest.h"
GDataErrorCode FakeDriveServiceHelper::AddOrphanedFolder(
const std::string& title,
std::string* folder_id) {
- EXPECT_TRUE(folder_id);
-
std::string root_folder_id = fake_drive_service_->GetRootResourceId();
GDataErrorCode error = AddFolder(root_folder_id, title, folder_id);
if (error != google_apis::HTTP_CREATED)
CreateResultReceiver(&error));
base::RunLoop().RunUntilIdle();
- if (error != google_apis::HTTP_NO_CONTENT)
+ if (error != google_apis::HTTP_NO_CONTENT && folder_id)
return error;
return google_apis::HTTP_CREATED;
}
const std::string& parent_folder_id,
const std::string& title,
std::string* folder_id) {
- EXPECT_TRUE(folder_id);
-
GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
scoped_ptr<ResourceEntry> folder;
fake_drive_service_->AddNewDirectory(
parent_folder_id, title,
+ drive::DriveServiceInterface::AddNewDirectoryOptions(),
CreateResultReceiver(&error, &folder));
base::RunLoop().RunUntilIdle();
- if (error == google_apis::HTTP_CREATED)
+ if (error == google_apis::HTTP_CREATED && folder_id)
*folder_id = folder->resource_id();
return error;
}
const std::string& title,
const std::string& content,
std::string* file_id) {
- EXPECT_TRUE(file_id);
base::FilePath temp_file = WriteToTempFile(content);
GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
google_apis::ProgressCallback());
base::RunLoop().RunUntilIdle();
- if (error == google_apis::HTTP_SUCCESS)
+ if (error == google_apis::HTTP_SUCCESS && file_id)
*file_id = file->resource_id();
return error;
}
return error;
}
+GDataErrorCode FakeDriveServiceHelper::UpdateModificationTime(
+ const std::string& file_id,
+ const base::Time& modification_time) {
+ GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
+ scoped_ptr<ResourceEntry> entry;
+ error = GetResourceEntry(file_id, &entry);
+ if (error != google_apis::HTTP_SUCCESS)
+ return error;
+
+ fake_drive_service_->UpdateResource(
+ file_id, std::string(), entry->title(),
+ modification_time, entry->last_viewed_time(),
+ CreateResultReceiver(&error, &entry));
+ base::RunLoop().RunUntilIdle();
+ return error;
+}
+
GDataErrorCode FakeDriveServiceHelper::RenameResource(
const std::string& file_id,
const std::string& new_title) {