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

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

Issue 304183005: drive: Always use last_modified stored in ResourceEntry (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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/time/time.h" 8 #include "base/time/time.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/chromeos/drive/drive.pb.h" 10 #include "chrome/browser/chromeos/drive/drive.pb.h"
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 EXPECT_EQ(entry.file_info().is_directory(), file_info.is_directory); 355 EXPECT_EQ(entry.file_info().is_directory(), file_info.is_directory);
356 EXPECT_EQ(entry.file_info().is_symbolic_link(), file_info.is_symbolic_link); 356 EXPECT_EQ(entry.file_info().is_symbolic_link(), file_info.is_symbolic_link);
357 EXPECT_EQ(base::Time::FromInternalValue(entry.file_info().creation_time()), 357 EXPECT_EQ(base::Time::FromInternalValue(entry.file_info().creation_time()),
358 file_info.creation_time); 358 file_info.creation_time);
359 EXPECT_EQ(base::Time::FromInternalValue(entry.file_info().last_modified()), 359 EXPECT_EQ(base::Time::FromInternalValue(entry.file_info().last_modified()),
360 file_info.last_modified); 360 file_info.last_modified);
361 EXPECT_EQ(base::Time::FromInternalValue(entry.file_info().last_accessed()), 361 EXPECT_EQ(base::Time::FromInternalValue(entry.file_info().last_accessed()),
362 file_info.last_accessed); 362 file_info.last_accessed);
363 } 363 }
364 364
365 TEST(ResourceEntryConversionTest, FromPlatformFileInfo) {
366 base::File::Info file_info;
367 file_info.size = 12345;
368 file_info.is_directory = true;
369 file_info.is_symbolic_link = true;
370 file_info.last_modified =
371 base::Time::UnixEpoch() + base::TimeDelta::FromDays(999);
372 file_info.last_accessed =
373 base::Time::UnixEpoch() + base::TimeDelta::FromDays(12345);
374 file_info.creation_time =
375 base::Time::UnixEpoch() + base::TimeDelta::FromDays(54321);
376
377 ResourceEntry entry;
378 SetPlatformFileInfoToResourceEntry(file_info, &entry);
379
380 EXPECT_EQ(file_info.size, entry.file_info().size());
381 EXPECT_EQ(file_info.is_directory, entry.file_info().is_directory());
382 EXPECT_EQ(file_info.is_symbolic_link, entry.file_info().is_symbolic_link());
383 EXPECT_EQ(file_info.creation_time,
384 base::Time::FromInternalValue(entry.file_info().creation_time()));
385 EXPECT_EQ(file_info.last_modified,
386 base::Time::FromInternalValue(entry.file_info().last_modified()));
387 EXPECT_EQ(file_info.last_accessed,
388 base::Time::FromInternalValue(entry.file_info().last_accessed()));
389 }
390
391 TEST(ResourceEntryConversionTest, ConvertToResourceEntry_ImageMediaMetadata) { 365 TEST(ResourceEntryConversionTest, ConvertToResourceEntry_ImageMediaMetadata) {
392 google_apis::ResourceEntry entry_all_fields; 366 google_apis::ResourceEntry entry_all_fields;
393 google_apis::ResourceEntry entry_zero_fields; 367 google_apis::ResourceEntry entry_zero_fields;
394 google_apis::ResourceEntry entry_no_fields; 368 google_apis::ResourceEntry entry_no_fields;
395 369
396 entry_all_fields.set_image_width(640); 370 entry_all_fields.set_image_width(640);
397 entry_all_fields.set_image_height(480); 371 entry_all_fields.set_image_height(480);
398 entry_all_fields.set_image_rotation(90); 372 entry_all_fields.set_image_rotation(90);
399 entry_all_fields.set_kind(google_apis::ENTRY_KIND_FILE); 373 entry_all_fields.set_kind(google_apis::ENTRY_KIND_FILE);
400 374
(...skipping 30 matching lines...) Expand all
431 std::string parent_resource_id; 405 std::string parent_resource_id;
432 EXPECT_TRUE(ConvertToResourceEntry(entry_no_fields, &entry, 406 EXPECT_TRUE(ConvertToResourceEntry(entry_no_fields, &entry,
433 &parent_resource_id)); 407 &parent_resource_id));
434 EXPECT_FALSE(entry.file_specific_info().has_image_width()); 408 EXPECT_FALSE(entry.file_specific_info().has_image_width());
435 EXPECT_FALSE(entry.file_specific_info().has_image_height()); 409 EXPECT_FALSE(entry.file_specific_info().has_image_height());
436 EXPECT_FALSE(entry.file_specific_info().has_image_rotation()); 410 EXPECT_FALSE(entry.file_specific_info().has_image_rotation());
437 } 411 }
438 } 412 }
439 413
440 } // namespace drive 414 } // 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