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

Side by Side Diff: components/drive/file_system/touch_operation_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: kundaji'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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/chromeos/file_system/touch_operation.h" 5 #include "components/drive/chromeos/file_system/touch_operation.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 "components/drive/chromeos/resource_metadata.h" 9 #include "components/drive/chromeos/resource_metadata.h"
10 #include "components/drive/drive.pb.h" 10 #include "components/drive/drive.pb.h"
(...skipping 14 matching lines...) Expand all
25 25
26 const base::FilePath kTestPath(FILE_PATH_LITERAL("drive/root/File 1.txt")); 26 const base::FilePath kTestPath(FILE_PATH_LITERAL("drive/root/File 1.txt"));
27 const base::Time::Exploded kLastAccessTime = { 27 const base::Time::Exploded kLastAccessTime = {
28 2012, 7, 0, 19, 15, 59, 13, 123 28 2012, 7, 0, 19, 15, 59, 13, 123
29 }; 29 };
30 const base::Time::Exploded kLastModifiedTime = { 30 const base::Time::Exploded kLastModifiedTime = {
31 2013, 7, 0, 19, 15, 59, 13, 123 31 2013, 7, 0, 19, 15, 59, 13, 123
32 }; 32 };
33 33
34 FileError error = FILE_ERROR_FAILED; 34 FileError error = FILE_ERROR_FAILED;
35 operation.TouchFile( 35 base::Time LastAccessTimeUTC;
fukino 2016/07/06 11:14:23 base::Time last_access_time_utc; to follow the sty
maksims (do not use this acc) 2016/07/06 12:00:20 Done.
36 kTestPath, 36 base::Time LastModifiedTimeUTC;
fukino 2016/07/06 11:14:23 ditto
maksims (do not use this acc) 2016/07/06 12:00:20 Done.
37 base::Time::FromUTCExploded(kLastAccessTime), 37 EXPECT_TRUE(base::Time::FromUTCExploded(kLastAccessTime, &LastAccessTimeUTC));
38 base::Time::FromUTCExploded(kLastModifiedTime), 38 EXPECT_TRUE(
39 google_apis::test_util::CreateCopyResultCallback(&error)); 39 base::Time::FromUTCExploded(kLastModifiedTime, &LastModifiedTimeUTC));
40 operation.TouchFile(kTestPath, LastAccessTimeUTC, LastModifiedTimeUTC,
41 google_apis::test_util::CreateCopyResultCallback(&error));
40 content::RunAllBlockingPoolTasksUntilIdle(); 42 content::RunAllBlockingPoolTasksUntilIdle();
41 EXPECT_EQ(FILE_ERROR_OK, error); 43 EXPECT_EQ(FILE_ERROR_OK, error);
42 44
43 ResourceEntry entry; 45 ResourceEntry entry;
44 EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(kTestPath, &entry)); 46 EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(kTestPath, &entry));
45 EXPECT_EQ(base::Time::FromUTCExploded(kLastAccessTime), 47 EXPECT_EQ(LastAccessTimeUTC,
46 base::Time::FromInternalValue(entry.file_info().last_accessed())); 48 base::Time::FromInternalValue(entry.file_info().last_accessed()));
47 EXPECT_EQ(base::Time::FromUTCExploded(kLastModifiedTime), 49 EXPECT_EQ(LastModifiedTimeUTC,
48 base::Time::FromInternalValue(entry.file_info().last_modified())); 50 base::Time::FromInternalValue(entry.file_info().last_modified()));
49 EXPECT_EQ(ResourceEntry::DIRTY, entry.metadata_edit_state()); 51 EXPECT_EQ(ResourceEntry::DIRTY, entry.metadata_edit_state());
50 52
51 EXPECT_EQ(1U, delegate()->get_changed_files().size()); 53 EXPECT_EQ(1U, delegate()->get_changed_files().size());
52 EXPECT_TRUE(delegate()->get_changed_files().count(kTestPath)); 54 EXPECT_TRUE(delegate()->get_changed_files().count(kTestPath));
53 55
54 EXPECT_EQ(1U, delegate()->updated_local_ids().size()); 56 EXPECT_EQ(1U, delegate()->updated_local_ids().size());
55 EXPECT_TRUE(delegate()->updated_local_ids().count(entry.local_id())); 57 EXPECT_TRUE(delegate()->updated_local_ids().count(entry.local_id()));
56 } 58 }
57 59
58 } // namespace file_system 60 } // namespace file_system
59 } // namespace drive 61 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698