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

Side by Side Diff: chrome/browser/chromeos/drive/sync/entry_update_performer_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, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/chromeos/drive/sync/entry_update_performer.h" 5 #include "chrome/browser/chromeos/drive/sync/entry_update_performer.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/md5.h" 9 #include "base/md5.h"
10 #include "base/task_runner_util.h" 10 #include "base/task_runner_util.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 // Perform server side update. 98 // Perform server side update.
99 error = FILE_ERROR_FAILED; 99 error = FILE_ERROR_FAILED;
100 performer_->UpdateEntry( 100 performer_->UpdateEntry(
101 src_entry.local_id(), 101 src_entry.local_id(),
102 ClientContext(USER_INITIATED), 102 ClientContext(USER_INITIATED),
103 google_apis::test_util::CreateCopyResultCallback(&error)); 103 google_apis::test_util::CreateCopyResultCallback(&error));
104 content::RunAllBlockingPoolTasksUntilIdle(); 104 content::RunAllBlockingPoolTasksUntilIdle();
105 EXPECT_EQ(FILE_ERROR_OK, error); 105 EXPECT_EQ(FILE_ERROR_OK, error);
106 106
107 // Verify the file is updated on the server. 107 // Verify the file is updated on the server.
108 google_apis::GDataErrorCode gdata_error = google_apis::GDATA_OTHER_ERROR; 108 google_apis::DriveApiErrorCode gdata_error = google_apis::DRIVE_OTHER_ERROR;
109 scoped_ptr<google_apis::FileResource> gdata_entry; 109 scoped_ptr<google_apis::FileResource> gdata_entry;
110 fake_service()->GetFileResource( 110 fake_service()->GetFileResource(
111 src_entry.resource_id(), 111 src_entry.resource_id(),
112 google_apis::test_util::CreateCopyResultCallback(&gdata_error, 112 google_apis::test_util::CreateCopyResultCallback(&gdata_error,
113 &gdata_entry)); 113 &gdata_entry));
114 content::RunAllBlockingPoolTasksUntilIdle(); 114 content::RunAllBlockingPoolTasksUntilIdle();
115 EXPECT_EQ(google_apis::HTTP_SUCCESS, gdata_error); 115 EXPECT_EQ(google_apis::HTTP_SUCCESS, gdata_error);
116 ASSERT_TRUE(gdata_entry); 116 ASSERT_TRUE(gdata_entry);
117 117
118 EXPECT_EQ(src_entry.title(), gdata_entry->title()); 118 EXPECT_EQ(src_entry.title(), gdata_entry->title());
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 // Perform server side update. This shouldn't fail. (crbug.com/358590) 164 // Perform server side update. This shouldn't fail. (crbug.com/358590)
165 error = FILE_ERROR_FAILED; 165 error = FILE_ERROR_FAILED;
166 performer_->UpdateEntry( 166 performer_->UpdateEntry(
167 src_entry->local_id(), 167 src_entry->local_id(),
168 ClientContext(USER_INITIATED), 168 ClientContext(USER_INITIATED),
169 google_apis::test_util::CreateCopyResultCallback(&error)); 169 google_apis::test_util::CreateCopyResultCallback(&error));
170 content::RunAllBlockingPoolTasksUntilIdle(); 170 content::RunAllBlockingPoolTasksUntilIdle();
171 EXPECT_EQ(FILE_ERROR_OK, error); 171 EXPECT_EQ(FILE_ERROR_OK, error);
172 172
173 // Verify the file is updated on the server. 173 // Verify the file is updated on the server.
174 google_apis::GDataErrorCode gdata_error = google_apis::GDATA_OTHER_ERROR; 174 google_apis::DriveApiErrorCode gdata_error = google_apis::DRIVE_OTHER_ERROR;
175 scoped_ptr<google_apis::FileResource> gdata_entry; 175 scoped_ptr<google_apis::FileResource> gdata_entry;
176 fake_service()->GetFileResource( 176 fake_service()->GetFileResource(
177 src_entry->resource_id(), 177 src_entry->resource_id(),
178 google_apis::test_util::CreateCopyResultCallback(&gdata_error, 178 google_apis::test_util::CreateCopyResultCallback(&gdata_error,
179 &gdata_entry)); 179 &gdata_entry));
180 content::RunAllBlockingPoolTasksUntilIdle(); 180 content::RunAllBlockingPoolTasksUntilIdle();
181 EXPECT_EQ(google_apis::HTTP_SUCCESS, gdata_error); 181 EXPECT_EQ(google_apis::HTTP_SUCCESS, gdata_error);
182 ASSERT_TRUE(gdata_entry); 182 ASSERT_TRUE(gdata_entry);
183 EXPECT_EQ(src_entry->title(), gdata_entry->title()); 183 EXPECT_EQ(src_entry->title(), gdata_entry->title());
184 } 184 }
(...skipping 28 matching lines...) Expand all
213 ClientContext(USER_INITIATED), 213 ClientContext(USER_INITIATED),
214 google_apis::test_util::CreateCopyResultCallback(&error)); 214 google_apis::test_util::CreateCopyResultCallback(&error));
215 content::RunAllBlockingPoolTasksUntilIdle(); 215 content::RunAllBlockingPoolTasksUntilIdle();
216 EXPECT_EQ(FILE_ERROR_OK, error); 216 EXPECT_EQ(FILE_ERROR_OK, error);
217 217
218 // Check that the server has received an update. 218 // Check that the server has received an update.
219 EXPECT_LT(original_changestamp, 219 EXPECT_LT(original_changestamp,
220 fake_service()->about_resource().largest_change_id()); 220 fake_service()->about_resource().largest_change_id());
221 221
222 // Check that the file size is updated to that of the updated content. 222 // Check that the file size is updated to that of the updated content.
223 google_apis::GDataErrorCode gdata_error = google_apis::GDATA_OTHER_ERROR; 223 google_apis::DriveApiErrorCode gdata_error = google_apis::DRIVE_OTHER_ERROR;
224 scoped_ptr<google_apis::FileResource> server_entry; 224 scoped_ptr<google_apis::FileResource> server_entry;
225 fake_service()->GetFileResource( 225 fake_service()->GetFileResource(
226 kResourceId, 226 kResourceId,
227 google_apis::test_util::CreateCopyResultCallback(&gdata_error, 227 google_apis::test_util::CreateCopyResultCallback(&gdata_error,
228 &server_entry)); 228 &server_entry));
229 content::RunAllBlockingPoolTasksUntilIdle(); 229 content::RunAllBlockingPoolTasksUntilIdle();
230 EXPECT_EQ(google_apis::HTTP_SUCCESS, gdata_error); 230 EXPECT_EQ(google_apis::HTTP_SUCCESS, gdata_error);
231 EXPECT_EQ(static_cast<int64>(kTestFileContent.size()), 231 EXPECT_EQ(static_cast<int64>(kTestFileContent.size()),
232 server_entry->file_size()); 232 server_entry->file_size());
233 233
(...skipping 23 matching lines...) Expand all
257 ClientContext(USER_INITIATED), 257 ClientContext(USER_INITIATED),
258 google_apis::test_util::CreateCopyResultCallback(&error)); 258 google_apis::test_util::CreateCopyResultCallback(&error));
259 content::RunAllBlockingPoolTasksUntilIdle(); 259 content::RunAllBlockingPoolTasksUntilIdle();
260 EXPECT_EQ(FILE_ERROR_OK, error); 260 EXPECT_EQ(FILE_ERROR_OK, error);
261 261
262 // Check that the server has received an update. 262 // Check that the server has received an update.
263 EXPECT_LT(original_changestamp, 263 EXPECT_LT(original_changestamp,
264 fake_service()->about_resource().largest_change_id()); 264 fake_service()->about_resource().largest_change_id());
265 265
266 // Check that the file size is updated to that of the updated content. 266 // Check that the file size is updated to that of the updated content.
267 google_apis::GDataErrorCode gdata_error = google_apis::GDATA_OTHER_ERROR; 267 google_apis::DriveApiErrorCode gdata_error = google_apis::DRIVE_OTHER_ERROR;
268 scoped_ptr<google_apis::FileResource> server_entry; 268 scoped_ptr<google_apis::FileResource> server_entry;
269 fake_service()->GetFileResource( 269 fake_service()->GetFileResource(
270 kResourceId, 270 kResourceId,
271 google_apis::test_util::CreateCopyResultCallback(&gdata_error, 271 google_apis::test_util::CreateCopyResultCallback(&gdata_error,
272 &server_entry)); 272 &server_entry));
273 content::RunAllBlockingPoolTasksUntilIdle(); 273 content::RunAllBlockingPoolTasksUntilIdle();
274 EXPECT_EQ(google_apis::HTTP_SUCCESS, gdata_error); 274 EXPECT_EQ(google_apis::HTTP_SUCCESS, gdata_error);
275 EXPECT_EQ(static_cast<int64>(kTestFileContent.size()), 275 EXPECT_EQ(static_cast<int64>(kTestFileContent.size()),
276 server_entry->file_size()); 276 server_entry->file_size());
277 277
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 407
408 // The entry got a resource ID. 408 // The entry got a resource ID.
409 EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(kFilePath, &entry)); 409 EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(kFilePath, &entry));
410 EXPECT_FALSE(entry.resource_id().empty()); 410 EXPECT_FALSE(entry.resource_id().empty());
411 EXPECT_EQ(ResourceEntry::CLEAN, entry.metadata_edit_state()); 411 EXPECT_EQ(ResourceEntry::CLEAN, entry.metadata_edit_state());
412 412
413 // Make sure that the cache is no longer dirty. 413 // Make sure that the cache is no longer dirty.
414 EXPECT_FALSE(entry.file_specific_info().cache_state().is_dirty()); 414 EXPECT_FALSE(entry.file_specific_info().cache_state().is_dirty());
415 415
416 // Make sure that we really created a file. 416 // Make sure that we really created a file.
417 google_apis::GDataErrorCode status = google_apis::GDATA_OTHER_ERROR; 417 google_apis::DriveApiErrorCode status = google_apis::DRIVE_OTHER_ERROR;
418 scoped_ptr<google_apis::FileResource> server_entry; 418 scoped_ptr<google_apis::FileResource> server_entry;
419 fake_service()->GetFileResource( 419 fake_service()->GetFileResource(
420 entry.resource_id(), 420 entry.resource_id(),
421 google_apis::test_util::CreateCopyResultCallback(&status, &server_entry)); 421 google_apis::test_util::CreateCopyResultCallback(&status, &server_entry));
422 content::RunAllBlockingPoolTasksUntilIdle(); 422 content::RunAllBlockingPoolTasksUntilIdle();
423 EXPECT_EQ(google_apis::HTTP_SUCCESS, status); 423 EXPECT_EQ(google_apis::HTTP_SUCCESS, status);
424 ASSERT_TRUE(server_entry); 424 ASSERT_TRUE(server_entry);
425 EXPECT_FALSE(server_entry->IsDirectory()); 425 EXPECT_FALSE(server_entry->IsDirectory());
426 } 426 }
427 427
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 google_apis::test_util::CreateCopyResultCallback(&error)); 533 google_apis::test_util::CreateCopyResultCallback(&error));
534 content::RunAllBlockingPoolTasksUntilIdle(); 534 content::RunAllBlockingPoolTasksUntilIdle();
535 EXPECT_EQ(FILE_ERROR_OK, error); 535 EXPECT_EQ(FILE_ERROR_OK, error);
536 536
537 // The entry got a resource ID. 537 // The entry got a resource ID.
538 EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(kPath, &entry)); 538 EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(kPath, &entry));
539 EXPECT_FALSE(entry.resource_id().empty()); 539 EXPECT_FALSE(entry.resource_id().empty());
540 EXPECT_EQ(ResourceEntry::CLEAN, entry.metadata_edit_state()); 540 EXPECT_EQ(ResourceEntry::CLEAN, entry.metadata_edit_state());
541 541
542 // Make sure that we really created a directory. 542 // Make sure that we really created a directory.
543 google_apis::GDataErrorCode status = google_apis::GDATA_OTHER_ERROR; 543 google_apis::DriveApiErrorCode status = google_apis::DRIVE_OTHER_ERROR;
544 scoped_ptr<google_apis::FileResource> server_entry; 544 scoped_ptr<google_apis::FileResource> server_entry;
545 fake_service()->GetFileResource( 545 fake_service()->GetFileResource(
546 entry.resource_id(), 546 entry.resource_id(),
547 google_apis::test_util::CreateCopyResultCallback(&status, &server_entry)); 547 google_apis::test_util::CreateCopyResultCallback(&status, &server_entry));
548 content::RunAllBlockingPoolTasksUntilIdle(); 548 content::RunAllBlockingPoolTasksUntilIdle();
549 EXPECT_EQ(google_apis::HTTP_SUCCESS, status); 549 EXPECT_EQ(google_apis::HTTP_SUCCESS, status);
550 ASSERT_TRUE(server_entry); 550 ASSERT_TRUE(server_entry);
551 EXPECT_TRUE(server_entry->IsDirectory()); 551 EXPECT_TRUE(server_entry->IsDirectory());
552 } 552 }
553 553
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 589
590 // This should result in reverting the local change. 590 // This should result in reverting the local change.
591 ResourceEntry result_entry; 591 ResourceEntry result_entry;
592 EXPECT_EQ(FILE_ERROR_OK, 592 EXPECT_EQ(FILE_ERROR_OK,
593 GetLocalResourceEntryById(src_entry.local_id(), &result_entry)); 593 GetLocalResourceEntryById(src_entry.local_id(), &result_entry));
594 EXPECT_EQ(src_entry.title(), result_entry.title()); 594 EXPECT_EQ(src_entry.title(), result_entry.title());
595 } 595 }
596 596
597 } // namespace internal 597 } // namespace internal
598 } // namespace drive 598 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698