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_entry_conversion.h" | 5 #include "chrome/browser/chromeos/drive/resource_entry_conversion.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/chromeos/drive/drive.pb.h" | 9 #include "chrome/browser/chromeos/drive/drive.pb.h" |
10 #include "chrome/browser/chromeos/drive/drive_test_util.h" | 10 #include "chrome/browser/chromeos/drive/drive_test_util.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 DriveEntryProto entry_proto = | 26 DriveEntryProto entry_proto = |
27 ConvertResourceEntryToDriveEntryProto(*resource_entry); | 27 ConvertResourceEntryToDriveEntryProto(*resource_entry); |
28 | 28 |
29 EXPECT_EQ("File 1.mp3", entry_proto.title()); | 29 EXPECT_EQ("File 1.mp3", entry_proto.title()); |
30 EXPECT_EQ("File 1.mp3", entry_proto.base_name()); | 30 EXPECT_EQ("File 1.mp3", entry_proto.base_name()); |
31 EXPECT_EQ("file:2_file_resource_id", entry_proto.resource_id()); | 31 EXPECT_EQ("file:2_file_resource_id", entry_proto.resource_id()); |
32 EXPECT_EQ("https://file_content_url/", entry_proto.download_url()); | 32 EXPECT_EQ("https://file_content_url/", entry_proto.download_url()); |
33 EXPECT_EQ("https://file1_link_self/file:2_file_resource_id", | 33 EXPECT_EQ("https://file1_link_self/file:2_file_resource_id", |
34 entry_proto.edit_url()); | 34 entry_proto.edit_url()); |
35 EXPECT_EQ("", entry_proto.parent_resource_id()); | 35 EXPECT_EQ("<other>", entry_proto.parent_resource_id()); |
36 | 36 |
37 EXPECT_FALSE(entry_proto.deleted()); | 37 EXPECT_FALSE(entry_proto.deleted()); |
38 EXPECT_EQ(google_apis::ENTRY_KIND_FILE, entry_proto.kind()); | 38 EXPECT_EQ(google_apis::ENTRY_KIND_FILE, entry_proto.kind()); |
39 | 39 |
40 EXPECT_FALSE(entry_proto.shared_with_me()); | 40 EXPECT_FALSE(entry_proto.shared_with_me()); |
41 | 41 |
42 base::Time expected_creation_time; | 42 base::Time expected_creation_time; |
43 base::Time expected_modified_time; | 43 base::Time expected_modified_time; |
44 | 44 |
45 { | 45 { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 DriveEntryProto entry_proto = | 110 DriveEntryProto entry_proto = |
111 ConvertResourceEntryToDriveEntryProto(*resource_entry); | 111 ConvertResourceEntryToDriveEntryProto(*resource_entry); |
112 | 112 |
113 EXPECT_EQ("Document 1", entry_proto.title()); | 113 EXPECT_EQ("Document 1", entry_proto.title()); |
114 EXPECT_EQ("Document 1.gdoc", entry_proto.base_name()); // The suffix added. | 114 EXPECT_EQ("Document 1.gdoc", entry_proto.base_name()); // The suffix added. |
115 EXPECT_EQ(".gdoc", entry_proto.file_specific_info().document_extension()); | 115 EXPECT_EQ(".gdoc", entry_proto.file_specific_info().document_extension()); |
116 EXPECT_EQ("document:5_document_resource_id", entry_proto.resource_id()); | 116 EXPECT_EQ("document:5_document_resource_id", entry_proto.resource_id()); |
117 EXPECT_EQ("https://3_document_content/", entry_proto.download_url()); | 117 EXPECT_EQ("https://3_document_content/", entry_proto.download_url()); |
118 EXPECT_EQ("https://3_document_self_link/document:5_document_resource_id", | 118 EXPECT_EQ("https://3_document_self_link/document:5_document_resource_id", |
119 entry_proto.edit_url()); | 119 entry_proto.edit_url()); |
120 EXPECT_EQ("", entry_proto.parent_resource_id()); | 120 EXPECT_EQ("<other>", entry_proto.parent_resource_id()); |
121 | 121 |
122 EXPECT_FALSE(entry_proto.deleted()); | 122 EXPECT_FALSE(entry_proto.deleted()); |
123 EXPECT_EQ(google_apis::ENTRY_KIND_DOCUMENT, entry_proto.kind()); | 123 EXPECT_EQ(google_apis::ENTRY_KIND_DOCUMENT, entry_proto.kind()); |
124 | 124 |
125 EXPECT_FALSE(entry_proto.shared_with_me()); | 125 EXPECT_FALSE(entry_proto.shared_with_me()); |
126 | 126 |
127 // 2011-12-12T23:28:52.783Z | 127 // 2011-12-12T23:28:52.783Z |
128 base::Time::Exploded exploded; | 128 base::Time::Exploded exploded; |
129 exploded.year = 2011; | 129 exploded.year = 2011; |
130 exploded.month = 12; | 130 exploded.month = 12; |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 | 276 |
277 DriveEntryProto entry_proto = | 277 DriveEntryProto entry_proto = |
278 ConvertResourceEntryToDriveEntryProto(*resource_entry); | 278 ConvertResourceEntryToDriveEntryProto(*resource_entry); |
279 | 279 |
280 EXPECT_EQ("Deleted document", entry_proto.title()); | 280 EXPECT_EQ("Deleted document", entry_proto.title()); |
281 EXPECT_EQ("Deleted document.gdoc", entry_proto.base_name()); | 281 EXPECT_EQ("Deleted document.gdoc", entry_proto.base_name()); |
282 EXPECT_EQ("document:deleted_in_root_id", entry_proto.resource_id()); | 282 EXPECT_EQ("document:deleted_in_root_id", entry_proto.resource_id()); |
283 EXPECT_EQ("https://content_url/", entry_proto.download_url()); | 283 EXPECT_EQ("https://content_url/", entry_proto.download_url()); |
284 EXPECT_EQ("https://edit_url/document%3Adeleted_in_root_id", | 284 EXPECT_EQ("https://edit_url/document%3Adeleted_in_root_id", |
285 entry_proto.edit_url()); | 285 entry_proto.edit_url()); |
286 EXPECT_EQ("", entry_proto.parent_resource_id()); | 286 EXPECT_EQ("<other>", entry_proto.parent_resource_id()); |
287 | 287 |
288 EXPECT_TRUE(entry_proto.deleted()); // The document was deleted. | 288 EXPECT_TRUE(entry_proto.deleted()); // The document was deleted. |
289 EXPECT_EQ(google_apis::ENTRY_KIND_DOCUMENT, entry_proto.kind()); | 289 EXPECT_EQ(google_apis::ENTRY_KIND_DOCUMENT, entry_proto.kind()); |
290 | 290 |
291 EXPECT_FALSE(entry_proto.shared_with_me()); | 291 EXPECT_FALSE(entry_proto.shared_with_me()); |
292 | 292 |
293 // 2012-04-10T22:50:55.797Z | 293 // 2012-04-10T22:50:55.797Z |
294 base::Time::Exploded exploded; | 294 base::Time::Exploded exploded; |
295 exploded.year = 2012; | 295 exploded.year = 2012; |
296 exploded.month = 04; | 296 exploded.month = 04; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 google_apis::ResourceEntry::ExtractAndParse(*value)); | 358 google_apis::ResourceEntry::ExtractAndParse(*value)); |
359 ASSERT_TRUE(resource_entry.get()); | 359 ASSERT_TRUE(resource_entry.get()); |
360 | 360 |
361 DriveEntryProto entry_proto = | 361 DriveEntryProto entry_proto = |
362 ConvertResourceEntryToDriveEntryProto(*resource_entry); | 362 ConvertResourceEntryToDriveEntryProto(*resource_entry); |
363 | 363 |
364 EXPECT_TRUE(entry_proto.shared_with_me()); | 364 EXPECT_TRUE(entry_proto.shared_with_me()); |
365 } | 365 } |
366 | 366 |
367 } // namespace drive | 367 } // namespace drive |
OLD | NEW |