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

Unified Diff: chrome/browser/chromeos/drive/job_scheduler_unittest.cc

Issue 881403003: Rename gdata_errorcode.h to drive_api_error_codes.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typos in BUILD.gn Created 5 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
Index: chrome/browser/chromeos/drive/job_scheduler_unittest.cc
diff --git a/chrome/browser/chromeos/drive/job_scheduler_unittest.cc b/chrome/browser/chromeos/drive/job_scheduler_unittest.cc
index 7f06a68ad5ec8a6103d91dc8fef9bb4f466bf664..428bf034367d9020f1b96046ee643585d5d47b32 100644
--- a/chrome/browser/chromeos/drive/job_scheduler_unittest.cc
+++ b/chrome/browser/chromeos/drive/job_scheduler_unittest.cc
@@ -32,7 +32,7 @@ const int64 kDummyDownloadFileSize = 0;
void CopyTitleFromFileResourceCallback(
std::vector<std::string>* title_list_out,
- google_apis::GDataErrorCode error_in,
+ google_apis::DriveApiErrorCode error_in,
scoped_ptr<google_apis::FileResource> entry_in) {
title_list_out->push_back(entry_in->title());
}
@@ -109,7 +109,7 @@ class CancelTestableFakeDriveService : public FakeDriveService {
const UploadNewFileOptions& options,
const google_apis::InitiateUploadCallback& callback) override {
if (upload_new_file_cancelable_)
- return base::Bind(callback, google_apis::GDATA_CANCELLED, GURL());
+ return base::Bind(callback, google_apis::DRIVE_CANCELLED, GURL());
return FakeDriveService::InitiateUploadNewFile(content_type,
content_length,
@@ -192,7 +192,7 @@ class JobSchedulerTest : public testing::Test {
TEST_F(JobSchedulerTest, GetAboutResource) {
ConnectToWifi();
- google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
scoped_ptr<google_apis::AboutResource> about_resource;
scheduler_->GetAboutResource(
google_apis::test_util::CreateCopyResultCallback(
@@ -205,7 +205,7 @@ TEST_F(JobSchedulerTest, GetAboutResource) {
TEST_F(JobSchedulerTest, GetAppList) {
ConnectToWifi();
- google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
scoped_ptr<google_apis::AppList> app_list;
scheduler_->GetAppList(
@@ -219,7 +219,7 @@ TEST_F(JobSchedulerTest, GetAppList) {
TEST_F(JobSchedulerTest, GetAllFileList) {
ConnectToWifi();
- google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
scoped_ptr<google_apis::FileList> file_list;
scheduler_->GetAllFileList(
@@ -233,7 +233,7 @@ TEST_F(JobSchedulerTest, GetAllFileList) {
TEST_F(JobSchedulerTest, GetFileListInDirectory) {
ConnectToWifi();
- google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
scoped_ptr<google_apis::FileList> file_list;
scheduler_->GetFileListInDirectory(
@@ -248,7 +248,7 @@ TEST_F(JobSchedulerTest, GetFileListInDirectory) {
TEST_F(JobSchedulerTest, Search) {
ConnectToWifi();
- google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
scoped_ptr<google_apis::FileList> file_list;
scheduler_->Search(
@@ -266,7 +266,7 @@ TEST_F(JobSchedulerTest, GetChangeList) {
int64 old_largest_change_id =
fake_drive_service_->about_resource().largest_change_id();
- google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
// Create a new directory.
{
@@ -281,7 +281,7 @@ TEST_F(JobSchedulerTest, GetChangeList) {
ASSERT_EQ(google_apis::HTTP_CREATED, error);
}
- error = google_apis::GDATA_OTHER_ERROR;
+ error = google_apis::DRIVE_OTHER_ERROR;
scoped_ptr<google_apis::ChangeList> change_list;
scheduler_->GetChangeList(
old_largest_change_id + 1,
@@ -296,7 +296,7 @@ TEST_F(JobSchedulerTest, GetRemainingChangeList) {
ConnectToWifi();
fake_drive_service_->set_default_max_results(2);
- google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
scoped_ptr<google_apis::ChangeList> change_list;
scheduler_->GetChangeList(
@@ -310,7 +310,7 @@ TEST_F(JobSchedulerTest, GetRemainingChangeList) {
// Keep the next url before releasing the |change_list|.
GURL next_url(change_list->next_link());
- error = google_apis::GDATA_OTHER_ERROR;
+ error = google_apis::DRIVE_OTHER_ERROR;
change_list.reset();
scheduler_->GetRemainingChangeList(
@@ -326,7 +326,7 @@ TEST_F(JobSchedulerTest, GetRemainingFileList) {
ConnectToWifi();
fake_drive_service_->set_default_max_results(2);
- google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
scoped_ptr<google_apis::FileList> file_list;
scheduler_->GetFileListInDirectory(
@@ -340,7 +340,7 @@ TEST_F(JobSchedulerTest, GetRemainingFileList) {
// Keep the next url before releasing the |file_list|.
GURL next_url(file_list->next_link());
- error = google_apis::GDATA_OTHER_ERROR;
+ error = google_apis::DRIVE_OTHER_ERROR;
file_list.reset();
scheduler_->GetRemainingFileList(
@@ -355,7 +355,7 @@ TEST_F(JobSchedulerTest, GetRemainingFileList) {
TEST_F(JobSchedulerTest, GetFileResource) {
ConnectToWifi();
- google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
scoped_ptr<google_apis::FileResource> entry;
scheduler_->GetFileResource(
@@ -371,7 +371,7 @@ TEST_F(JobSchedulerTest, GetFileResource) {
TEST_F(JobSchedulerTest, GetShareUrl) {
ConnectToWifi();
- google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
GURL share_url;
scheduler_->GetShareUrl(
@@ -388,7 +388,7 @@ TEST_F(JobSchedulerTest, GetShareUrl) {
TEST_F(JobSchedulerTest, TrashResource) {
ConnectToWifi();
- google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
scheduler_->TrashResource(
"2_file_resource_id",
@@ -402,7 +402,7 @@ TEST_F(JobSchedulerTest, TrashResource) {
TEST_F(JobSchedulerTest, CopyResource) {
ConnectToWifi();
- google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
scoped_ptr<google_apis::FileResource> entry;
scheduler_->CopyResource(
@@ -420,7 +420,7 @@ TEST_F(JobSchedulerTest, CopyResource) {
TEST_F(JobSchedulerTest, UpdateResource) {
ConnectToWifi();
- google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
scoped_ptr<google_apis::FileResource> entry;
scheduler_->UpdateResource(
@@ -440,7 +440,7 @@ TEST_F(JobSchedulerTest, UpdateResource) {
TEST_F(JobSchedulerTest, AddResourceToDirectory) {
ConnectToWifi();
- google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
scheduler_->AddResourceToDirectory(
"1_folder_resource_id",
@@ -454,7 +454,7 @@ TEST_F(JobSchedulerTest, AddResourceToDirectory) {
TEST_F(JobSchedulerTest, RemoveResourceFromDirectory) {
ConnectToWifi();
- google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
scheduler_->RemoveResourceFromDirectory(
"1_folder_resource_id",
@@ -469,7 +469,7 @@ TEST_F(JobSchedulerTest, RemoveResourceFromDirectory) {
TEST_F(JobSchedulerTest, AddNewDirectory) {
ConnectToWifi();
- google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
scoped_ptr<google_apis::FileResource> entry;
scheduler_->AddNewDirectory(
@@ -487,7 +487,8 @@ TEST_F(JobSchedulerTest, AddNewDirectory) {
TEST_F(JobSchedulerTest, PriorityHandling) {
// Saturate the metadata job queue with uninteresting jobs to prevent
// following jobs from starting.
- google_apis::GDataErrorCode error_dontcare = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode error_dontcare =
+ google_apis::DRIVE_OTHER_ERROR;
scoped_ptr<google_apis::FileResource> entry_dontcare;
for (int i = 0; i < GetMetadataQueueMaxJobCount(); ++i) {
std::string resource_id("2_file_resource_id");
@@ -544,7 +545,7 @@ TEST_F(JobSchedulerTest, NoConnectionUserInitiated) {
std::string resource_id("2_file_resource_id");
- google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
scoped_ptr<google_apis::FileResource> entry;
scheduler_->GetFileResource(
resource_id,
@@ -552,7 +553,7 @@ TEST_F(JobSchedulerTest, NoConnectionUserInitiated) {
google_apis::test_util::CreateCopyResultCallback(&error, &entry));
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(google_apis::GDATA_NO_CONNECTION, error);
+ EXPECT_EQ(google_apis::DRIVE_NO_CONNECTION, error);
}
TEST_F(JobSchedulerTest, NoConnectionBackground) {
@@ -560,7 +561,7 @@ TEST_F(JobSchedulerTest, NoConnectionBackground) {
std::string resource_id("2_file_resource_id");
- google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
scoped_ptr<google_apis::FileResource> entry;
scheduler_->GetFileResource(
resource_id,
@@ -591,7 +592,8 @@ TEST_F(JobSchedulerTest, DownloadFileCellularDisabled) {
const base::FilePath kOutputFilePath =
temp_dir.path().AppendASCII("whatever.txt");
- google_apis::GDataErrorCode download_error = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode download_error =
+ google_apis::DRIVE_OTHER_ERROR;
base::FilePath output_file_path;
scheduler_->DownloadFile(
base::FilePath::FromUTF8Unsafe("drive/whatever.txt"), // virtual path
@@ -603,7 +605,8 @@ TEST_F(JobSchedulerTest, DownloadFileCellularDisabled) {
&download_error, &output_file_path),
google_apis::GetContentCallback());
// Metadata should still work
- google_apis::GDataErrorCode metadata_error = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode metadata_error =
+ google_apis::DRIVE_OTHER_ERROR;
scoped_ptr<google_apis::AboutResource> about_resource;
// Try to get the metadata
@@ -617,7 +620,7 @@ TEST_F(JobSchedulerTest, DownloadFileCellularDisabled) {
ASSERT_TRUE(about_resource);
// Check the download
- EXPECT_EQ(google_apis::GDATA_OTHER_ERROR, download_error);
+ EXPECT_EQ(google_apis::DRIVE_OTHER_ERROR, download_error);
// Switch to a Wifi connection
ConnectToWifi();
@@ -644,7 +647,8 @@ TEST_F(JobSchedulerTest, DownloadFileWimaxDisabled) {
const base::FilePath kOutputFilePath =
temp_dir.path().AppendASCII("whatever.txt");
- google_apis::GDataErrorCode download_error = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode download_error =
+ google_apis::DRIVE_OTHER_ERROR;
base::FilePath output_file_path;
scheduler_->DownloadFile(
base::FilePath::FromUTF8Unsafe("drive/whatever.txt"), // virtual path
@@ -656,7 +660,8 @@ TEST_F(JobSchedulerTest, DownloadFileWimaxDisabled) {
&download_error, &output_file_path),
google_apis::GetContentCallback());
// Metadata should still work
- google_apis::GDataErrorCode metadata_error = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode metadata_error =
+ google_apis::DRIVE_OTHER_ERROR;
scoped_ptr<google_apis::AboutResource> about_resource;
// Try to get the metadata
@@ -670,7 +675,7 @@ TEST_F(JobSchedulerTest, DownloadFileWimaxDisabled) {
ASSERT_TRUE(about_resource);
// Check the download
- EXPECT_EQ(google_apis::GDATA_OTHER_ERROR, download_error);
+ EXPECT_EQ(google_apis::DRIVE_OTHER_ERROR, download_error);
// Switch to a Wifi connection
ConnectToWifi();
@@ -697,7 +702,8 @@ TEST_F(JobSchedulerTest, DownloadFileCellularEnabled) {
const base::FilePath kOutputFilePath =
temp_dir.path().AppendASCII("whatever.txt");
- google_apis::GDataErrorCode download_error = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode download_error =
+ google_apis::DRIVE_OTHER_ERROR;
base::FilePath output_file_path;
scheduler_->DownloadFile(
base::FilePath::FromUTF8Unsafe("drive/whatever.txt"), // virtual path
@@ -709,7 +715,8 @@ TEST_F(JobSchedulerTest, DownloadFileCellularEnabled) {
&download_error, &output_file_path),
google_apis::GetContentCallback());
// Metadata should still work
- google_apis::GDataErrorCode metadata_error = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode metadata_error =
+ google_apis::DRIVE_OTHER_ERROR;
scoped_ptr<google_apis::AboutResource> about_resource;
// Try to get the metadata
@@ -742,7 +749,8 @@ TEST_F(JobSchedulerTest, DownloadFileWimaxEnabled) {
const base::FilePath kOutputFilePath =
temp_dir.path().AppendASCII("whatever.txt");
- google_apis::GDataErrorCode download_error = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode download_error =
+ google_apis::DRIVE_OTHER_ERROR;
base::FilePath output_file_path;
scheduler_->DownloadFile(
base::FilePath::FromUTF8Unsafe("drive/whatever.txt"), // virtual path
@@ -754,7 +762,8 @@ TEST_F(JobSchedulerTest, DownloadFileWimaxEnabled) {
&download_error, &output_file_path),
google_apis::GetContentCallback());
// Metadata should still work
- google_apis::GDataErrorCode metadata_error = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode metadata_error =
+ google_apis::DRIVE_OTHER_ERROR;
scoped_ptr<google_apis::AboutResource> about_resource;
// Try to get the metadata
@@ -786,7 +795,7 @@ TEST_F(JobSchedulerTest, JobInfo) {
base::ScopedTempDir temp_dir;
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
- google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
scoped_ptr<google_apis::FileResource> entry;
scoped_ptr<google_apis::AboutResource> about_resource;
base::FilePath path;
@@ -908,7 +917,7 @@ TEST_F(JobSchedulerTest, JobInfoProgress) {
base::ScopedTempDir temp_dir;
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
- google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
base::FilePath path;
// Download job.
@@ -932,8 +941,8 @@ TEST_F(JobSchedulerTest, JobInfoProgress) {
// Upload job.
path = temp_dir.path().AppendASCII("new_file.txt");
ASSERT_TRUE(google_apis::test_util::WriteStringToFile(path, "Hello"));
- google_apis::GDataErrorCode upload_error =
- google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode upload_error =
+ google_apis::DRIVE_OTHER_ERROR;
scoped_ptr<google_apis::FileResource> entry;
scheduler_->UploadNewFile(
@@ -967,7 +976,7 @@ TEST_F(JobSchedulerTest, CancelPendingJob) {
pref_service_->SetBoolean(prefs::kDisableDriveOverCellular, true);
// Start the first job and record its job ID.
- google_apis::GDataErrorCode error1 = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode error1 = google_apis::DRIVE_OTHER_ERROR;
scoped_ptr<google_apis::FileResource> entry;
scheduler_->UploadNewFile(
fake_drive_service_->GetRootResourceId(),
@@ -985,7 +994,7 @@ TEST_F(JobSchedulerTest, CancelPendingJob) {
JobID first_job_id = jobs[0].job_id;
// Start the second job.
- google_apis::GDataErrorCode error2 = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode error2 = google_apis::DRIVE_OTHER_ERROR;
scheduler_->UploadNewFile(
fake_drive_service_->GetRootResourceId(),
base::FilePath::FromUTF8Unsafe("dummy/path"),
@@ -1002,7 +1011,7 @@ TEST_F(JobSchedulerTest, CancelPendingJob) {
// Only the first job should be cancelled.
ConnectToWifi();
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(google_apis::GDATA_CANCELLED, error1);
+ EXPECT_EQ(google_apis::DRIVE_CANCELLED, error1);
EXPECT_EQ(google_apis::HTTP_SUCCESS, error2);
EXPECT_TRUE(scheduler_->GetJobInfoList().empty());
}
@@ -1017,7 +1026,7 @@ TEST_F(JobSchedulerTest, CancelRunningJob) {
// Run as a cancelable task.
fake_drive_service_->set_upload_new_file_cancelable(true);
- google_apis::GDataErrorCode error1 = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode error1 = google_apis::DRIVE_OTHER_ERROR;
scoped_ptr<google_apis::FileResource> entry;
scheduler_->UploadNewFile(
fake_drive_service_->GetRootResourceId(),
@@ -1036,7 +1045,7 @@ TEST_F(JobSchedulerTest, CancelRunningJob) {
// Start the second job normally.
fake_drive_service_->set_upload_new_file_cancelable(false);
- google_apis::GDataErrorCode error2 = google_apis::GDATA_OTHER_ERROR;
+ google_apis::DriveApiErrorCode error2 = google_apis::DRIVE_OTHER_ERROR;
scheduler_->UploadNewFile(
fake_drive_service_->GetRootResourceId(),
base::FilePath::FromUTF8Unsafe("dummy/path"),
@@ -1052,7 +1061,7 @@ TEST_F(JobSchedulerTest, CancelRunningJob) {
// Only the first job should be cancelled.
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(google_apis::GDATA_CANCELLED, error1);
+ EXPECT_EQ(google_apis::DRIVE_CANCELLED, error1);
EXPECT_EQ(google_apis::HTTP_SUCCESS, error2);
EXPECT_TRUE(scheduler_->GetJobInfoList().empty());
}

Powered by Google App Engine
This is Rietveld 408576698