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

Side by Side Diff: chrome/browser/chromeos/drive/file_system/touch_operation_unittest.cc

Issue 15728006: Implement TouchFile on drive::FileSystem. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/drive/file_system/touch_operation.h"
6
7 #include "base/files/file_path.h"
8 #include "base/time.h"
9 #include "chrome/browser/chromeos/drive/drive.pb.h"
10 #include "chrome/browser/chromeos/drive/file_errors.h"
11 #include "chrome/browser/chromeos/drive/file_system/operation_test_base.h"
12 #include "chrome/browser/chromeos/drive/resource_metadata.h"
13 #include "chrome/browser/google_apis/test_util.h"
14 #include "testing/gtest/include/gtest/gtest.h"
15
16 namespace drive {
17 namespace file_system {
18
19 typedef OperationTestBase TouchOperationTest;
20
21 TEST_F(TouchOperationTest, TouchFile) {
22 TouchOperation operation(blocking_task_runner(),
23 dummy_observer(),
24 scheduler(),
25 metadata());
26
27 const base::FilePath kTestPath(FILE_PATH_LITERAL("drive/root/File 1.txt"));
28 const base::Time::Exploded kLastAccessTime = {
29 2012, 7, 0, 19, 15, 59, 13, 123
30 };
31 const base::Time::Exploded kLastModifiedTime = {
32 2013, 7, 0, 19, 15, 59, 13, 123
33 };
34
35 FileError error = FILE_ERROR_FAILED;
36 operation.TouchFile(
37 kTestPath,
38 base::Time::FromUTCExploded(kLastAccessTime),
39 base::Time::FromUTCExploded(kLastModifiedTime),
40 google_apis::test_util::CreateCopyResultCallback(&error));
41 google_apis::test_util::RunBlockingPoolTask();
42 EXPECT_EQ(FILE_ERROR_OK, error);
43
44 ResourceEntry entry;
45 base::PostTaskAndReplyWithResult(
46 blocking_task_runner(), FROM_HERE,
47 base::Bind(&internal::ResourceMetadata::GetResourceEntryByPath,
48 base::Unretained(metadata()), kTestPath, &entry),
49 base::Bind(google_apis::test_util::CreateCopyResultCallback(&error)));
50 google_apis::test_util::RunBlockingPoolTask();
51 EXPECT_EQ(FILE_ERROR_OK, error);
52 EXPECT_EQ(base::Time::FromUTCExploded(kLastAccessTime),
53 base::Time::FromInternalValue(entry.file_info().last_accessed()));
54 EXPECT_EQ(base::Time::FromUTCExploded(kLastModifiedTime),
55 base::Time::FromInternalValue(entry.file_info().last_modified()));
56 }
57
58 } // namespace file_system
59 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/file_system/touch_operation.cc ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698