| 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/resource_metadata.h" | 5 #include "chrome/browser/chromeos/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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 (is_directory ? "dir" : "file") + base::IntToString(sequence_id); | 54 (is_directory ? "dir" : "file") + base::IntToString(sequence_id); |
| 55 const std::string resource_id = "resource_id:" + title; | 55 const std::string resource_id = "resource_id:" + title; |
| 56 entry.set_title(title); | 56 entry.set_title(title); |
| 57 entry.set_resource_id(resource_id); | 57 entry.set_resource_id(resource_id); |
| 58 entry.set_parent_resource_id(parent_resource_id); | 58 entry.set_parent_resource_id(parent_resource_id); |
| 59 | 59 |
| 60 PlatformFileInfoProto* file_info = entry.mutable_file_info(); | 60 PlatformFileInfoProto* file_info = entry.mutable_file_info(); |
| 61 file_info->set_is_directory(is_directory); | 61 file_info->set_is_directory(is_directory); |
| 62 | 62 |
| 63 if (!is_directory) { | 63 if (!is_directory) { |
| 64 DriveFileSpecificInfo* file_specific_info = | 64 FileSpecificInfo* file_specific_info = entry.mutable_file_specific_info(); |
| 65 entry.mutable_file_specific_info(); | |
| 66 file_info->set_size(sequence_id * 1024); | 65 file_info->set_size(sequence_id * 1024); |
| 67 file_specific_info->set_file_md5(std::string("md5:") + title); | 66 file_specific_info->set_file_md5(std::string("md5:") + title); |
| 68 } else { | 67 } else { |
| 69 DriveDirectorySpecificInfo* directory_specific_info = | 68 DirectorySpecificInfo* directory_specific_info = |
| 70 entry.mutable_directory_specific_info(); | 69 entry.mutable_directory_specific_info(); |
| 71 directory_specific_info->set_changestamp(kTestChangestamp); | 70 directory_specific_info->set_changestamp(kTestChangestamp); |
| 72 } | 71 } |
| 73 return entry; | 72 return entry; |
| 74 } | 73 } |
| 75 | 74 |
| 76 // Adds a ResourceEntry to the metadata tree. Returns true on success. | 75 // Adds a ResourceEntry to the metadata tree. Returns true on success. |
| 77 bool AddResourceEntry(ResourceMetadata* resource_metadata, | 76 bool AddResourceEntry(ResourceMetadata* resource_metadata, |
| 78 int sequence_id, | 77 int sequence_id, |
| 79 bool is_directory, | 78 bool is_directory, |
| (...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 else | 1215 else |
| 1217 ++directory_count; | 1216 ++directory_count; |
| 1218 } | 1217 } |
| 1219 | 1218 |
| 1220 EXPECT_EQ(7, file_count); | 1219 EXPECT_EQ(7, file_count); |
| 1221 EXPECT_EQ(6, directory_count); | 1220 EXPECT_EQ(6, directory_count); |
| 1222 } | 1221 } |
| 1223 | 1222 |
| 1224 } // namespace internal | 1223 } // namespace internal |
| 1225 } // namespace drive | 1224 } // namespace drive |
| OLD | NEW |