| 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 "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 Loading... |
| 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 |
| OLD | NEW |