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

Side by Side Diff: components/drive/resource_entry_conversion_unittest.cc

Issue 2095553002: Make callers of FromUTC(Local)Exploded in components/ use new time API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fukino's comments Created 4 years, 5 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
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 "components/drive/resource_entry_conversion.h" 5 #include "components/drive/resource_entry_conversion.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "components/drive/drive.pb.h" 9 #include "components/drive/drive.pb.h"
10 #include "components/drive/drive_api_util.h" 10 #include "components/drive/drive_api_util.h"
11 #include "google_apis/drive/drive_api_parser.h" 11 #include "google_apis/drive/drive_api_parser.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 namespace drive { 14 namespace drive {
15 15
16 namespace { 16 namespace {
17 17
18 base::Time GetTestTime() { 18 base::Time GetTestTime() {
19 // 2011-12-14-T00:40:47.330Z 19 // 2011-12-14-T00:40:47.330Z
20 base::Time::Exploded exploded; 20 base::Time::Exploded exploded;
21 exploded.year = 2011; 21 exploded.year = 2011;
22 exploded.month = 12; 22 exploded.month = 12;
23 exploded.day_of_month = 14; 23 exploded.day_of_month = 14;
24 exploded.day_of_week = 2; // Tuesday 24 exploded.day_of_week = 2; // Tuesday
25 exploded.hour = 0; 25 exploded.hour = 0;
26 exploded.minute = 40; 26 exploded.minute = 40;
27 exploded.second = 47; 27 exploded.second = 47;
28 exploded.millisecond = 330; 28 exploded.millisecond = 330;
29 return base::Time::FromUTCExploded(exploded); 29 base::Time out_time;
30 EXPECT_TRUE(base::Time::FromUTCExploded(exploded, &out_time));
31 return out_time;
30 } 32 }
31 33
32 } // namespace 34 } // namespace
33 35
34 TEST(ResourceEntryConversionTest, ConvertToResourceEntry_File) { 36 TEST(ResourceEntryConversionTest, ConvertToResourceEntry_File) {
35 google_apis::FileResource file_resource; 37 google_apis::FileResource file_resource;
36 file_resource.set_title("File 1.mp3"); 38 file_resource.set_title("File 1.mp3");
37 file_resource.set_file_id("resource_id"); 39 file_resource.set_file_id("resource_id");
38 file_resource.set_created_date(GetTestTime()); 40 file_resource.set_created_date(GetTestTime());
39 file_resource.set_modified_date( 41 file_resource.set_modified_date(
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 std::string parent_resource_id; 368 std::string parent_resource_id;
367 EXPECT_TRUE(ConvertFileResourceToResourceEntry( 369 EXPECT_TRUE(ConvertFileResourceToResourceEntry(
368 entry_no_fields, &entry, &parent_resource_id)); 370 entry_no_fields, &entry, &parent_resource_id));
369 EXPECT_FALSE(entry.file_specific_info().has_image_width()); 371 EXPECT_FALSE(entry.file_specific_info().has_image_width());
370 EXPECT_FALSE(entry.file_specific_info().has_image_height()); 372 EXPECT_FALSE(entry.file_specific_info().has_image_height());
371 EXPECT_FALSE(entry.file_specific_info().has_image_rotation()); 373 EXPECT_FALSE(entry.file_specific_info().has_image_rotation());
372 } 374 }
373 } 375 }
374 376
375 } // namespace drive 377 } // namespace drive
OLDNEW
« no previous file with comments | « components/drive/file_system/touch_operation_unittest.cc ('k') | components/drive/service/fake_drive_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698