| 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 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 // Add to dir3. | 963 // Add to dir3. |
| 964 resource_metadata_->AddEntry( | 964 resource_metadata_->AddEntry( |
| 965 file_entry_proto, | 965 file_entry_proto, |
| 966 base::Bind(&test_util::CopyResultsFromFileMoveCallback, | 966 base::Bind(&test_util::CopyResultsFromFileMoveCallback, |
| 967 &error, &drive_file_path)); | 967 &error, &drive_file_path)); |
| 968 google_apis::test_util::RunBlockingPoolTask(); | 968 google_apis::test_util::RunBlockingPoolTask(); |
| 969 EXPECT_EQ(DRIVE_FILE_OK, error); | 969 EXPECT_EQ(DRIVE_FILE_OK, error); |
| 970 EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/dir3/file100"), | 970 EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/dir3/file100"), |
| 971 drive_file_path); | 971 drive_file_path); |
| 972 | 972 |
| 973 // Adds to root when parent resource id is not specified. | |
| 974 DriveEntryProto file_entry_proto2 = CreateDriveEntryProto( | |
| 975 sequence_id++, false, ""); | |
| 976 | |
| 977 resource_metadata_->AddEntry( | |
| 978 file_entry_proto2, | |
| 979 base::Bind(&test_util::CopyResultsFromFileMoveCallback, | |
| 980 &error, &drive_file_path)); | |
| 981 google_apis::test_util::RunBlockingPoolTask(); | |
| 982 EXPECT_EQ(DRIVE_FILE_OK, error); | |
| 983 EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/file101"), drive_file_path); | |
| 984 | |
| 985 // Add a directory. | 973 // Add a directory. |
| 986 DriveEntryProto dir_entry_proto = CreateDriveEntryProto( | 974 DriveEntryProto dir_entry_proto = CreateDriveEntryProto( |
| 987 sequence_id++, true, "resource_id:dir1"); | 975 sequence_id++, true, "resource_id:dir1"); |
| 988 | 976 |
| 989 resource_metadata_->AddEntry( | 977 resource_metadata_->AddEntry( |
| 990 dir_entry_proto, | 978 dir_entry_proto, |
| 991 base::Bind(&test_util::CopyResultsFromFileMoveCallback, | 979 base::Bind(&test_util::CopyResultsFromFileMoveCallback, |
| 992 &error, &drive_file_path)); | 980 &error, &drive_file_path)); |
| 993 google_apis::test_util::RunBlockingPoolTask(); | 981 google_apis::test_util::RunBlockingPoolTask(); |
| 994 EXPECT_EQ(DRIVE_FILE_OK, error); | 982 EXPECT_EQ(DRIVE_FILE_OK, error); |
| 995 EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/dir102"), | 983 EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/dir101"), |
| 996 drive_file_path); | 984 drive_file_path); |
| 997 | 985 |
| 998 // Add to an invalid parent. | 986 // Add to an invalid parent. |
| 999 DriveEntryProto file_entry_proto3 = CreateDriveEntryProto( | 987 DriveEntryProto file_entry_proto3 = CreateDriveEntryProto( |
| 1000 sequence_id++, false, "resource_id:invalid"); | 988 sequence_id++, false, "resource_id:invalid"); |
| 1001 | 989 |
| 1002 resource_metadata_->AddEntry( | 990 resource_metadata_->AddEntry( |
| 1003 file_entry_proto3, | 991 file_entry_proto3, |
| 1004 base::Bind(&test_util::CopyResultsFromFileMoveCallback, | 992 base::Bind(&test_util::CopyResultsFromFileMoveCallback, |
| 1005 &error, &drive_file_path)); | 993 &error, &drive_file_path)); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1184 | 1172 |
| 1185 // Confirm that the sub directory contains the changestamp. | 1173 // Confirm that the sub directory contains the changestamp. |
| 1186 ASSERT_EQ(1, new_proto.drive_directory().child_directories_size()); | 1174 ASSERT_EQ(1, new_proto.drive_directory().child_directories_size()); |
| 1187 const DriveDirectoryProto& dir_proto = root_proto.child_directories(0); | 1175 const DriveDirectoryProto& dir_proto = root_proto.child_directories(0); |
| 1188 EXPECT_EQ(kNewChangestamp, | 1176 EXPECT_EQ(kNewChangestamp, |
| 1189 dir_proto.drive_entry().directory_specific_info().changestamp()); | 1177 dir_proto.drive_entry().directory_specific_info().changestamp()); |
| 1190 | 1178 |
| 1191 } | 1179 } |
| 1192 | 1180 |
| 1193 } // namespace drive | 1181 } // namespace drive |
| OLD | NEW |