OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/drive_file_system.h" | 5 #include "chrome/browser/chromeos/drive/drive_file_system.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1668 ASSERT_TRUE(src_parent_proto.get()); | 1668 ASSERT_TRUE(src_parent_proto.get()); |
1669 ASSERT_TRUE(src_parent_proto->file_info().is_directory()); | 1669 ASSERT_TRUE(src_parent_proto->file_info().is_directory()); |
1670 EXPECT_FALSE(src_parent_proto->content_url().empty()); | 1670 EXPECT_FALSE(src_parent_proto->content_url().empty()); |
1671 | 1671 |
1672 EXPECT_CALL(*mock_drive_service_, | 1672 EXPECT_CALL(*mock_drive_service_, |
1673 RenameResource(GURL(src_entry_proto->edit_url()), | 1673 RenameResource(GURL(src_entry_proto->edit_url()), |
1674 FILE_PATH_LITERAL("Test.log"), _)); | 1674 FILE_PATH_LITERAL("Test.log"), _)); |
1675 EXPECT_CALL(*mock_drive_service_, | 1675 EXPECT_CALL(*mock_drive_service_, |
1676 RemoveResourceFromDirectory( | 1676 RemoveResourceFromDirectory( |
1677 GURL(src_parent_proto->content_url()), | 1677 GURL(src_parent_proto->content_url()), |
1678 GURL(src_entry_proto->edit_url()), | |
1679 src_file_resource_id, _)); | 1678 src_file_resource_id, _)); |
1680 | 1679 |
1681 FileOperationCallback callback = | 1680 FileOperationCallback callback = |
1682 base::Bind(&CallbackHelper::FileOperationCallback, | 1681 base::Bind(&CallbackHelper::FileOperationCallback, |
1683 callback_helper_.get()); | 1682 callback_helper_.get()); |
1684 | 1683 |
1685 // Expect notification for both source and destination directories. | 1684 // Expect notification for both source and destination directories. |
1686 EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( | 1685 EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( |
1687 Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); | 1686 Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); |
1688 EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( | 1687 EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1735 EXPECT_FALSE(dest_parent_proto->content_url().empty()); | 1734 EXPECT_FALSE(dest_parent_proto->content_url().empty()); |
1736 | 1735 |
1737 EXPECT_FALSE(EntryExists(interim_file_path)); | 1736 EXPECT_FALSE(EntryExists(interim_file_path)); |
1738 | 1737 |
1739 EXPECT_CALL(*mock_drive_service_, | 1738 EXPECT_CALL(*mock_drive_service_, |
1740 RenameResource(GURL(src_entry_proto->edit_url()), | 1739 RenameResource(GURL(src_entry_proto->edit_url()), |
1741 FILE_PATH_LITERAL("Test.log"), _)); | 1740 FILE_PATH_LITERAL("Test.log"), _)); |
1742 EXPECT_CALL(*mock_drive_service_, | 1741 EXPECT_CALL(*mock_drive_service_, |
1743 RemoveResourceFromDirectory( | 1742 RemoveResourceFromDirectory( |
1744 GURL(src_parent_proto->content_url()), | 1743 GURL(src_parent_proto->content_url()), |
1745 GURL(src_entry_proto->edit_url()), | |
1746 src_file_resource_id, _)); | 1744 src_file_resource_id, _)); |
1747 EXPECT_CALL(*mock_drive_service_, | 1745 EXPECT_CALL(*mock_drive_service_, |
1748 AddResourceToDirectory( | 1746 AddResourceToDirectory( |
1749 GURL(dest_parent_proto->content_url()), | 1747 GURL(dest_parent_proto->content_url()), |
1750 GURL(src_entry_proto->edit_url()), | 1748 GURL(src_entry_proto->edit_url()), |
1751 _)); | 1749 _)); |
1752 | 1750 |
1753 FileOperationCallback callback = | 1751 FileOperationCallback callback = |
1754 base::Bind(&CallbackHelper::FileOperationCallback, | 1752 base::Bind(&CallbackHelper::FileOperationCallback, |
1755 callback_helper_.get()); | 1753 callback_helper_.get()); |
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2695 | 2693 |
2696 // Try to close the same file twice. | 2694 // Try to close the same file twice. |
2697 file_system_->CloseFile(kFileInRoot, close_file_callback); | 2695 file_system_->CloseFile(kFileInRoot, close_file_callback); |
2698 message_loop_.Run(); | 2696 message_loop_.Run(); |
2699 | 2697 |
2700 // It must fail. | 2698 // It must fail. |
2701 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); | 2699 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); |
2702 } | 2700 } |
2703 | 2701 |
2704 } // namespace drive | 2702 } // namespace drive |
OLD | NEW |