Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1011)

Side by Side Diff: chrome/browser/chromeos/drive/resource_entry_conversion_unittest.cc

Issue 13456002: drive: Fills no-parent entiries in "/drive/other". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add a comment in ConvertResourceEntryToDriveEntryProto(). Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/drive/resource_entry_conversion.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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());
hidehiko 2013/04/03 07:55:40 nit: using util::kDriveOtherDirSpecialResourceId m
Haruki Sato 2013/04/04 06:16:06 Done. Thanks.
36 36
37 EXPECT_FALSE(entry_proto.deleted()); 37 EXPECT_FALSE(entry_proto.deleted());
38 EXPECT_FALSE(entry_proto.shared_with_me()); 38 EXPECT_FALSE(entry_proto.shared_with_me());
39 39
40 base::Time expected_creation_time; 40 base::Time expected_creation_time;
41 base::Time expected_modified_time; 41 base::Time expected_modified_time;
42 42
43 { 43 {
44 // 2011-12-14T00:40:47.330Z 44 // 2011-12-14T00:40:47.330Z
45 base::Time::Exploded exploded; 45 base::Time::Exploded exploded;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 DriveEntryProto entry_proto = 108 DriveEntryProto entry_proto =
109 ConvertResourceEntryToDriveEntryProto(*resource_entry); 109 ConvertResourceEntryToDriveEntryProto(*resource_entry);
110 110
111 EXPECT_EQ("Document 1", entry_proto.title()); 111 EXPECT_EQ("Document 1", entry_proto.title());
112 EXPECT_EQ("Document 1.gdoc", entry_proto.base_name()); // The suffix added. 112 EXPECT_EQ("Document 1.gdoc", entry_proto.base_name()); // The suffix added.
113 EXPECT_EQ(".gdoc", entry_proto.file_specific_info().document_extension()); 113 EXPECT_EQ(".gdoc", entry_proto.file_specific_info().document_extension());
114 EXPECT_EQ("document:5_document_resource_id", entry_proto.resource_id()); 114 EXPECT_EQ("document:5_document_resource_id", entry_proto.resource_id());
115 EXPECT_EQ("https://3_document_content/", entry_proto.download_url()); 115 EXPECT_EQ("https://3_document_content/", entry_proto.download_url());
116 EXPECT_EQ("https://3_document_self_link/document:5_document_resource_id", 116 EXPECT_EQ("https://3_document_self_link/document:5_document_resource_id",
117 entry_proto.edit_url()); 117 entry_proto.edit_url());
118 EXPECT_EQ("", entry_proto.parent_resource_id()); 118 EXPECT_EQ("<other>", entry_proto.parent_resource_id());
119 119
120 EXPECT_FALSE(entry_proto.deleted()); 120 EXPECT_FALSE(entry_proto.deleted());
121 EXPECT_FALSE(entry_proto.shared_with_me()); 121 EXPECT_FALSE(entry_proto.shared_with_me());
122 122
123 // 2011-12-12T23:28:52.783Z 123 // 2011-12-12T23:28:52.783Z
124 base::Time::Exploded exploded; 124 base::Time::Exploded exploded;
125 exploded.year = 2011; 125 exploded.year = 2011;
126 exploded.month = 12; 126 exploded.month = 12;
127 exploded.day_of_month = 12; 127 exploded.day_of_month = 12;
128 exploded.day_of_week = 1; // Monday 128 exploded.day_of_week = 1; // Monday
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 270
271 DriveEntryProto entry_proto = 271 DriveEntryProto entry_proto =
272 ConvertResourceEntryToDriveEntryProto(*resource_entry); 272 ConvertResourceEntryToDriveEntryProto(*resource_entry);
273 273
274 EXPECT_EQ("Deleted document", entry_proto.title()); 274 EXPECT_EQ("Deleted document", entry_proto.title());
275 EXPECT_EQ("Deleted document.gdoc", entry_proto.base_name()); 275 EXPECT_EQ("Deleted document.gdoc", entry_proto.base_name());
276 EXPECT_EQ("document:deleted_in_root_id", entry_proto.resource_id()); 276 EXPECT_EQ("document:deleted_in_root_id", entry_proto.resource_id());
277 EXPECT_EQ("https://content_url/", entry_proto.download_url()); 277 EXPECT_EQ("https://content_url/", entry_proto.download_url());
278 EXPECT_EQ("https://edit_url/document%3Adeleted_in_root_id", 278 EXPECT_EQ("https://edit_url/document%3Adeleted_in_root_id",
279 entry_proto.edit_url()); 279 entry_proto.edit_url());
280 EXPECT_EQ("", entry_proto.parent_resource_id()); 280 EXPECT_EQ("<other>", entry_proto.parent_resource_id());
281 281
282 EXPECT_TRUE(entry_proto.deleted()); // The document was deleted. 282 EXPECT_TRUE(entry_proto.deleted()); // The document was deleted.
283 EXPECT_FALSE(entry_proto.shared_with_me()); 283 EXPECT_FALSE(entry_proto.shared_with_me());
284 284
285 // 2012-04-10T22:50:55.797Z 285 // 2012-04-10T22:50:55.797Z
286 base::Time::Exploded exploded; 286 base::Time::Exploded exploded;
287 exploded.year = 2012; 287 exploded.year = 2012;
288 exploded.month = 04; 288 exploded.month = 04;
289 exploded.day_of_month = 10; 289 exploded.day_of_month = 10;
290 exploded.day_of_week = 2; // Tuesday 290 exploded.day_of_week = 2; // Tuesday
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 google_apis::ResourceEntry::ExtractAndParse(*value)); 350 google_apis::ResourceEntry::ExtractAndParse(*value));
351 ASSERT_TRUE(resource_entry.get()); 351 ASSERT_TRUE(resource_entry.get());
352 352
353 DriveEntryProto entry_proto = 353 DriveEntryProto entry_proto =
354 ConvertResourceEntryToDriveEntryProto(*resource_entry); 354 ConvertResourceEntryToDriveEntryProto(*resource_entry);
355 355
356 EXPECT_TRUE(entry_proto.shared_with_me()); 356 EXPECT_TRUE(entry_proto.shared_with_me());
357 } 357 }
358 358
359 } // namespace drive 359 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/resource_entry_conversion.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698