| OLD | NEW |
| 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_revert_performer.h" | 5 #include "chrome/browser/chromeos/drive/sync/entry_revert_performer.h" |
| 6 | 6 |
| 7 #include "base/task_runner_util.h" | 7 #include "base/task_runner_util.h" |
| 8 #include "chrome/browser/chromeos/drive/file_change.h" | 8 #include "chrome/browser/chromeos/drive/file_change.h" |
| 9 #include "chrome/browser/chromeos/drive/file_system/operation_test_base.h" | 9 #include "chrome/browser/chromeos/drive/file_system/operation_test_base.h" |
| 10 #include "chrome/browser/chromeos/drive/file_system_util.h" | 10 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 } | 116 } |
| 117 | 117 |
| 118 TEST_F(EntryRevertPerformerTest, RevertEntry_TrashedOnServer) { | 118 TEST_F(EntryRevertPerformerTest, RevertEntry_TrashedOnServer) { |
| 119 base::FilePath path( | 119 base::FilePath path( |
| 120 FILE_PATH_LITERAL("drive/root/Directory 1/SubDirectory File 1.txt")); | 120 FILE_PATH_LITERAL("drive/root/Directory 1/SubDirectory File 1.txt")); |
| 121 | 121 |
| 122 ResourceEntry entry; | 122 ResourceEntry entry; |
| 123 EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(path, &entry)); | 123 EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(path, &entry)); |
| 124 | 124 |
| 125 // Trash the entry on the server. | 125 // Trash the entry on the server. |
| 126 google_apis::GDataErrorCode gdata_error = google_apis::GDATA_OTHER_ERROR; | 126 google_apis::DriveApiErrorCode gdata_error = google_apis::DRIVE_OTHER_ERROR; |
| 127 fake_service()->TrashResource( | 127 fake_service()->TrashResource( |
| 128 entry.resource_id(), | 128 entry.resource_id(), |
| 129 google_apis::test_util::CreateCopyResultCallback(&gdata_error)); | 129 google_apis::test_util::CreateCopyResultCallback(&gdata_error)); |
| 130 content::RunAllBlockingPoolTasksUntilIdle(); | 130 content::RunAllBlockingPoolTasksUntilIdle(); |
| 131 EXPECT_EQ(google_apis::HTTP_SUCCESS, gdata_error); | 131 EXPECT_EQ(google_apis::HTTP_SUCCESS, gdata_error); |
| 132 | 132 |
| 133 // Revert local change. The entry should be removed. | 133 // Revert local change. The entry should be removed. |
| 134 FileError error = FILE_ERROR_FAILED; | 134 FileError error = FILE_ERROR_FAILED; |
| 135 performer_->RevertEntry( | 135 performer_->RevertEntry( |
| 136 entry.local_id(), | 136 entry.local_id(), |
| 137 ClientContext(USER_INITIATED), | 137 ClientContext(USER_INITIATED), |
| 138 google_apis::test_util::CreateCopyResultCallback(&error)); | 138 google_apis::test_util::CreateCopyResultCallback(&error)); |
| 139 content::RunAllBlockingPoolTasksUntilIdle(); | 139 content::RunAllBlockingPoolTasksUntilIdle(); |
| 140 EXPECT_EQ(FILE_ERROR_OK, error); | 140 EXPECT_EQ(FILE_ERROR_OK, error); |
| 141 | 141 |
| 142 // Verify the entry was deleted locally. | 142 // Verify the entry was deleted locally. |
| 143 EXPECT_EQ(FILE_ERROR_NOT_FOUND, | 143 EXPECT_EQ(FILE_ERROR_NOT_FOUND, |
| 144 GetLocalResourceEntryById(entry.local_id(), &entry)); | 144 GetLocalResourceEntryById(entry.local_id(), &entry)); |
| 145 | 145 |
| 146 EXPECT_EQ(1U, delegate()->get_changed_files().size()); | 146 EXPECT_EQ(1U, delegate()->get_changed_files().size()); |
| 147 EXPECT_TRUE(delegate()->get_changed_files().count(path)); | 147 EXPECT_TRUE(delegate()->get_changed_files().count(path)); |
| 148 } | 148 } |
| 149 | 149 |
| 150 } // namespace internal | 150 } // namespace internal |
| 151 } // namespace drive | 151 } // namespace drive |
| OLD | NEW |