| 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/remove_performer.h" | 5 #include "chrome/browser/chromeos/drive/sync/remove_performer.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chromeos/drive/file_system/operation_test_base.h" | 7 #include "chrome/browser/chromeos/drive/file_system/operation_test_base.h" |
| 8 #include "chrome/browser/drive/fake_drive_service.h" | 8 #include "chrome/browser/drive/fake_drive_service.h" |
| 9 #include "chrome/browser/google_apis/gdata_wapi_parser.h" | 9 #include "chrome/browser/google_apis/gdata_wapi_parser.h" |
| 10 #include "chrome/browser/google_apis/test_util.h" | 10 #include "chrome/browser/google_apis/test_util.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 FILE_PATH_LITERAL("drive/root/Directory 1/SubDirectory File 1.txt")); | 22 FILE_PATH_LITERAL("drive/root/Directory 1/SubDirectory File 1.txt")); |
| 23 | 23 |
| 24 // Remove a file in root. | 24 // Remove a file in root. |
| 25 ResourceEntry entry; | 25 ResourceEntry entry; |
| 26 FileError error = FILE_ERROR_FAILED; | 26 FileError error = FILE_ERROR_FAILED; |
| 27 ASSERT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(file_in_root, &entry)); | 27 ASSERT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(file_in_root, &entry)); |
| 28 performer.Remove(entry.local_id(), | 28 performer.Remove(entry.local_id(), |
| 29 google_apis::test_util::CreateCopyResultCallback(&error)); | 29 google_apis::test_util::CreateCopyResultCallback(&error)); |
| 30 test_util::RunBlockingPoolTask(); | 30 test_util::RunBlockingPoolTask(); |
| 31 EXPECT_EQ(FILE_ERROR_OK, error); | 31 EXPECT_EQ(FILE_ERROR_OK, error); |
| 32 EXPECT_EQ(FILE_ERROR_NOT_FOUND, GetLocalResourceEntry(file_in_root, &entry)); | |
| 33 | 32 |
| 34 // Remove a file in subdirectory. | 33 // Remove a file in subdirectory. |
| 35 error = FILE_ERROR_FAILED; | 34 error = FILE_ERROR_FAILED; |
| 36 ASSERT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(file_in_subdir, &entry)); | 35 ASSERT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(file_in_subdir, &entry)); |
| 37 const std::string resource_id = entry.resource_id(); | 36 const std::string resource_id = entry.resource_id(); |
| 38 | 37 |
| 39 performer.Remove(entry.local_id(), | 38 performer.Remove(entry.local_id(), |
| 40 google_apis::test_util::CreateCopyResultCallback(&error)); | 39 google_apis::test_util::CreateCopyResultCallback(&error)); |
| 41 test_util::RunBlockingPoolTask(); | 40 test_util::RunBlockingPoolTask(); |
| 42 EXPECT_EQ(FILE_ERROR_OK, error); | 41 EXPECT_EQ(FILE_ERROR_OK, error); |
| 43 EXPECT_EQ(FILE_ERROR_NOT_FOUND, | |
| 44 GetLocalResourceEntry(file_in_subdir, &entry)); | |
| 45 | 42 |
| 46 // Verify the file is indeed removed in the server. | 43 // Verify the file is indeed removed in the server. |
| 47 google_apis::GDataErrorCode gdata_error = google_apis::GDATA_OTHER_ERROR; | 44 google_apis::GDataErrorCode gdata_error = google_apis::GDATA_OTHER_ERROR; |
| 48 scoped_ptr<google_apis::ResourceEntry> gdata_entry; | 45 scoped_ptr<google_apis::ResourceEntry> gdata_entry; |
| 49 fake_service()->GetResourceEntry( | 46 fake_service()->GetResourceEntry( |
| 50 resource_id, | 47 resource_id, |
| 51 google_apis::test_util::CreateCopyResultCallback(&gdata_error, | 48 google_apis::test_util::CreateCopyResultCallback(&gdata_error, |
| 52 &gdata_entry)); | 49 &gdata_entry)); |
| 53 test_util::RunBlockingPoolTask(); | 50 test_util::RunBlockingPoolTask(); |
| 54 ASSERT_EQ(google_apis::HTTP_SUCCESS, gdata_error); | 51 ASSERT_EQ(google_apis::HTTP_SUCCESS, gdata_error); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 google_apis::test_util::CreateCopyResultCallback(&gdata_error, | 102 google_apis::test_util::CreateCopyResultCallback(&gdata_error, |
| 106 &gdata_entry)); | 103 &gdata_entry)); |
| 107 test_util::RunBlockingPoolTask(); | 104 test_util::RunBlockingPoolTask(); |
| 108 ASSERT_EQ(google_apis::HTTP_SUCCESS, gdata_error); | 105 ASSERT_EQ(google_apis::HTTP_SUCCESS, gdata_error); |
| 109 EXPECT_FALSE(gdata_entry->deleted()); // It's not deleted. | 106 EXPECT_FALSE(gdata_entry->deleted()); // It's not deleted. |
| 110 EXPECT_FALSE(gdata_entry->GetLinkByType(google_apis::Link::LINK_PARENT)); | 107 EXPECT_FALSE(gdata_entry->GetLinkByType(google_apis::Link::LINK_PARENT)); |
| 111 } | 108 } |
| 112 | 109 |
| 113 } // namespace internal | 110 } // namespace internal |
| 114 } // namespace drive | 111 } // namespace drive |
| OLD | NEW |