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_resource_metadata.h" | 5 #include "chrome/browser/chromeos/drive/drive_resource_metadata.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 // Add to dir3. | 849 // Add to dir3. |
850 resource_metadata_->AddEntry( | 850 resource_metadata_->AddEntry( |
851 file_entry_proto, | 851 file_entry_proto, |
852 base::Bind(&test_util::CopyResultsFromFileMoveCallback, | 852 base::Bind(&test_util::CopyResultsFromFileMoveCallback, |
853 &error, &drive_file_path)); | 853 &error, &drive_file_path)); |
854 google_apis::test_util::RunBlockingPoolTask(); | 854 google_apis::test_util::RunBlockingPoolTask(); |
855 EXPECT_EQ(DRIVE_FILE_OK, error); | 855 EXPECT_EQ(DRIVE_FILE_OK, error); |
856 EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/dir3/file100"), | 856 EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/dir3/file100"), |
857 drive_file_path); | 857 drive_file_path); |
858 | 858 |
859 // Adds to root when parent resource id is not specified. | |
860 DriveEntryProto file_entry_proto2 = CreateDriveEntryProto( | |
861 sequence_id++, false, ""); | |
862 | |
863 resource_metadata_->AddEntry( | |
864 file_entry_proto2, | |
865 base::Bind(&test_util::CopyResultsFromFileMoveCallback, | |
866 &error, &drive_file_path)); | |
867 google_apis::test_util::RunBlockingPoolTask(); | |
868 EXPECT_EQ(DRIVE_FILE_OK, error); | |
869 EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/file101"), drive_file_path); | |
870 | |
871 // Add a directory. | 859 // Add a directory. |
872 DriveEntryProto dir_entry_proto = CreateDriveEntryProto( | 860 DriveEntryProto dir_entry_proto = CreateDriveEntryProto( |
873 sequence_id++, true, "resource_id:dir1"); | 861 sequence_id++, true, "resource_id:dir1"); |
874 | 862 |
875 resource_metadata_->AddEntry( | 863 resource_metadata_->AddEntry( |
876 dir_entry_proto, | 864 dir_entry_proto, |
877 base::Bind(&test_util::CopyResultsFromFileMoveCallback, | 865 base::Bind(&test_util::CopyResultsFromFileMoveCallback, |
878 &error, &drive_file_path)); | 866 &error, &drive_file_path)); |
879 google_apis::test_util::RunBlockingPoolTask(); | 867 google_apis::test_util::RunBlockingPoolTask(); |
880 EXPECT_EQ(DRIVE_FILE_OK, error); | 868 EXPECT_EQ(DRIVE_FILE_OK, error); |
881 EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/dir102"), | 869 EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/dir101"), |
882 drive_file_path); | 870 drive_file_path); |
883 | 871 |
884 // Add to an invalid parent. | 872 // Add to an invalid parent. |
885 DriveEntryProto file_entry_proto3 = CreateDriveEntryProto( | 873 DriveEntryProto file_entry_proto3 = CreateDriveEntryProto( |
886 sequence_id++, false, "resource_id:invalid"); | 874 sequence_id++, false, "resource_id:invalid"); |
887 | 875 |
888 resource_metadata_->AddEntry( | 876 resource_metadata_->AddEntry( |
889 file_entry_proto3, | 877 file_entry_proto3, |
890 base::Bind(&test_util::CopyResultsFromFileMoveCallback, | 878 base::Bind(&test_util::CopyResultsFromFileMoveCallback, |
891 &error, &drive_file_path)); | 879 &error, &drive_file_path)); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 | 1056 |
1069 // Confirm that the sub directory contains the changestamp. | 1057 // Confirm that the sub directory contains the changestamp. |
1070 ASSERT_EQ(1, new_proto.drive_directory().child_directories_size()); | 1058 ASSERT_EQ(1, new_proto.drive_directory().child_directories_size()); |
1071 const DriveDirectoryProto& dir_proto = root_proto.child_directories(0); | 1059 const DriveDirectoryProto& dir_proto = root_proto.child_directories(0); |
1072 EXPECT_EQ(kChangestamp, | 1060 EXPECT_EQ(kChangestamp, |
1073 dir_proto.drive_entry().directory_specific_info().changestamp()); | 1061 dir_proto.drive_entry().directory_specific_info().changestamp()); |
1074 | 1062 |
1075 } | 1063 } |
1076 | 1064 |
1077 } // namespace drive | 1065 } // namespace drive |
OLD | NEW |