| 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 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 // Add to dir3. | 923 // Add to dir3. |
| 924 resource_metadata_->AddEntry( | 924 resource_metadata_->AddEntry( |
| 925 file_entry_proto, | 925 file_entry_proto, |
| 926 base::Bind(&test_util::CopyResultsFromFileMoveCallback, | 926 base::Bind(&test_util::CopyResultsFromFileMoveCallback, |
| 927 &error, &drive_file_path)); | 927 &error, &drive_file_path)); |
| 928 google_apis::test_util::RunBlockingPoolTask(); | 928 google_apis::test_util::RunBlockingPoolTask(); |
| 929 EXPECT_EQ(DRIVE_FILE_OK, error); | 929 EXPECT_EQ(DRIVE_FILE_OK, error); |
| 930 EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/dir3/file100"), | 930 EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/dir3/file100"), |
| 931 drive_file_path); | 931 drive_file_path); |
| 932 | 932 |
| 933 // Adds to root when parent resource id is not specified. | |
| 934 DriveEntryProto file_entry_proto2 = CreateDriveEntryProto( | |
| 935 sequence_id++, false, ""); | |
| 936 | |
| 937 resource_metadata_->AddEntry( | |
| 938 file_entry_proto2, | |
| 939 base::Bind(&test_util::CopyResultsFromFileMoveCallback, | |
| 940 &error, &drive_file_path)); | |
| 941 google_apis::test_util::RunBlockingPoolTask(); | |
| 942 EXPECT_EQ(DRIVE_FILE_OK, error); | |
| 943 EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/file101"), drive_file_path); | |
| 944 | |
| 945 // Add a directory. | 933 // Add a directory. |
| 946 DriveEntryProto dir_entry_proto = CreateDriveEntryProto( | 934 DriveEntryProto dir_entry_proto = CreateDriveEntryProto( |
| 947 sequence_id++, true, "resource_id:dir1"); | 935 sequence_id++, true, "resource_id:dir1"); |
| 948 | 936 |
| 949 resource_metadata_->AddEntry( | 937 resource_metadata_->AddEntry( |
| 950 dir_entry_proto, | 938 dir_entry_proto, |
| 951 base::Bind(&test_util::CopyResultsFromFileMoveCallback, | 939 base::Bind(&test_util::CopyResultsFromFileMoveCallback, |
| 952 &error, &drive_file_path)); | 940 &error, &drive_file_path)); |
| 953 google_apis::test_util::RunBlockingPoolTask(); | 941 google_apis::test_util::RunBlockingPoolTask(); |
| 954 EXPECT_EQ(DRIVE_FILE_OK, error); | 942 EXPECT_EQ(DRIVE_FILE_OK, error); |
| 955 EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/dir102"), | 943 EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/dir101"), |
| 956 drive_file_path); | 944 drive_file_path); |
| 957 | 945 |
| 958 // Add to an invalid parent. | 946 // Add to an invalid parent. |
| 959 DriveEntryProto file_entry_proto3 = CreateDriveEntryProto( | 947 DriveEntryProto file_entry_proto3 = CreateDriveEntryProto( |
| 960 sequence_id++, false, "resource_id:invalid"); | 948 sequence_id++, false, "resource_id:invalid"); |
| 961 | 949 |
| 962 resource_metadata_->AddEntry( | 950 resource_metadata_->AddEntry( |
| 963 file_entry_proto3, | 951 file_entry_proto3, |
| 964 base::Bind(&test_util::CopyResultsFromFileMoveCallback, | 952 base::Bind(&test_util::CopyResultsFromFileMoveCallback, |
| 965 &error, &drive_file_path)); | 953 &error, &drive_file_path)); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1127 | 1115 |
| 1128 // Confirm that the sub directory contains the changestamp. | 1116 // Confirm that the sub directory contains the changestamp. |
| 1129 ASSERT_EQ(1, new_proto.drive_directory().child_directories_size()); | 1117 ASSERT_EQ(1, new_proto.drive_directory().child_directories_size()); |
| 1130 const DriveDirectoryProto& dir_proto = root_proto.child_directories(0); | 1118 const DriveDirectoryProto& dir_proto = root_proto.child_directories(0); |
| 1131 EXPECT_EQ(kNewChangestamp, | 1119 EXPECT_EQ(kNewChangestamp, |
| 1132 dir_proto.drive_entry().directory_specific_info().changestamp()); | 1120 dir_proto.drive_entry().directory_specific_info().changestamp()); |
| 1133 | 1121 |
| 1134 } | 1122 } |
| 1135 | 1123 |
| 1136 } // namespace drive | 1124 } // namespace drive |
| OLD | NEW |