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 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1181 DriveDirectoryProto* root = proto.mutable_drive_directory(); | 1181 DriveDirectoryProto* root = proto.mutable_drive_directory(); |
1182 DriveEntryProto* root_entry = root->mutable_drive_entry(); | 1182 DriveEntryProto* root_entry = root->mutable_drive_entry(); |
1183 root_entry->mutable_file_info()->set_is_directory(true); | 1183 root_entry->mutable_file_info()->set_is_directory(true); |
1184 root_entry->set_resource_id(kTestRootResourceId); | 1184 root_entry->set_resource_id(kTestRootResourceId); |
1185 root_entry->set_title("drive"); | 1185 root_entry->set_title("drive"); |
1186 // Add a sub directory. | 1186 // Add a sub directory. |
1187 DriveDirectoryProto* directory = root->add_child_directories(); | 1187 DriveDirectoryProto* directory = root->add_child_directories(); |
1188 DriveEntryProto* directory_entry = directory->mutable_drive_entry(); | 1188 DriveEntryProto* directory_entry = directory->mutable_drive_entry(); |
1189 directory_entry->mutable_file_info()->set_is_directory(true); | 1189 directory_entry->mutable_file_info()->set_is_directory(true); |
1190 directory_entry->set_resource_id(kSubDirectoryResourceId); | 1190 directory_entry->set_resource_id(kSubDirectoryResourceId); |
| 1191 directory_entry->set_parent_resource_id(kTestRootResourceId); |
1191 directory_entry->set_title("directory"); | 1192 directory_entry->set_title("directory"); |
1192 // At this point, both the root and the sub directory do not contain the | 1193 // At this point, both the root and the sub directory do not contain the |
1193 // per-directory changestamp. | 1194 // per-directory changestamp. |
1194 | 1195 |
1195 DriveResourceMetadata resource_metadata(kTestRootResourceId); | 1196 DriveResourceMetadata resource_metadata(kTestRootResourceId); |
1196 | 1197 |
1197 // Load the proto. This should propagate the largest changestamp to every | 1198 // Load the proto. This should propagate the largest changestamp to every |
1198 // directory. | 1199 // directory. |
1199 std::string serialized_proto; | 1200 std::string serialized_proto; |
1200 ASSERT_TRUE(proto.SerializeToString(&serialized_proto)); | 1201 ASSERT_TRUE(proto.SerializeToString(&serialized_proto)); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1236 | 1237 |
1237 // Confirm that the sub directory contains the changestamp. | 1238 // Confirm that the sub directory contains the changestamp. |
1238 ASSERT_EQ(1, new_proto.drive_directory().child_directories_size()); | 1239 ASSERT_EQ(1, new_proto.drive_directory().child_directories_size()); |
1239 const DriveDirectoryProto& dir_proto = root_proto.child_directories(0); | 1240 const DriveDirectoryProto& dir_proto = root_proto.child_directories(0); |
1240 EXPECT_EQ(kNewChangestamp, | 1241 EXPECT_EQ(kNewChangestamp, |
1241 dir_proto.drive_entry().directory_specific_info().changestamp()); | 1242 dir_proto.drive_entry().directory_specific_info().changestamp()); |
1242 | 1243 |
1243 } | 1244 } |
1244 | 1245 |
1245 } // namespace drive | 1246 } // namespace drive |
OLD | NEW |