| Index: chrome/browser/chromeos/drive/file_system/touch_operation_unittest.cc
|
| diff --git a/chrome/browser/chromeos/drive/file_system/touch_operation_unittest.cc b/chrome/browser/chromeos/drive/file_system/touch_operation_unittest.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..4e0f71de17da29da7a6c42b329bde8072068cbc8
|
| --- /dev/null
|
| +++ b/chrome/browser/chromeos/drive/file_system/touch_operation_unittest.cc
|
| @@ -0,0 +1,59 @@
|
| +// Copyright 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "chrome/browser/chromeos/drive/file_system/touch_operation.h"
|
| +
|
| +#include "base/files/file_path.h"
|
| +#include "base/time.h"
|
| +#include "chrome/browser/chromeos/drive/drive.pb.h"
|
| +#include "chrome/browser/chromeos/drive/file_errors.h"
|
| +#include "chrome/browser/chromeos/drive/file_system/operation_test_base.h"
|
| +#include "chrome/browser/chromeos/drive/resource_metadata.h"
|
| +#include "chrome/browser/google_apis/test_util.h"
|
| +#include "testing/gtest/include/gtest/gtest.h"
|
| +
|
| +namespace drive {
|
| +namespace file_system {
|
| +
|
| +typedef OperationTestBase TouchOperationTest;
|
| +
|
| +TEST_F(TouchOperationTest, TouchFile) {
|
| + TouchOperation operation(blocking_task_runner(),
|
| + dummy_observer(),
|
| + scheduler(),
|
| + metadata());
|
| +
|
| + const base::FilePath kTestPath(FILE_PATH_LITERAL("drive/root/File 1.txt"));
|
| + const base::Time::Exploded kLastAccessTime = {
|
| + 2012, 7, 0, 19, 15, 59, 13, 123
|
| + };
|
| + const base::Time::Exploded kLastModifiedTime = {
|
| + 2013, 7, 0, 19, 15, 59, 13, 123
|
| + };
|
| +
|
| + FileError error = FILE_ERROR_FAILED;
|
| + operation.TouchFile(
|
| + kTestPath,
|
| + base::Time::FromUTCExploded(kLastAccessTime),
|
| + base::Time::FromUTCExploded(kLastModifiedTime),
|
| + google_apis::test_util::CreateCopyResultCallback(&error));
|
| + google_apis::test_util::RunBlockingPoolTask();
|
| + EXPECT_EQ(FILE_ERROR_OK, error);
|
| +
|
| + ResourceEntry entry;
|
| + base::PostTaskAndReplyWithResult(
|
| + blocking_task_runner(), FROM_HERE,
|
| + base::Bind(&internal::ResourceMetadata::GetResourceEntryByPath,
|
| + base::Unretained(metadata()), kTestPath, &entry),
|
| + base::Bind(google_apis::test_util::CreateCopyResultCallback(&error)));
|
| + google_apis::test_util::RunBlockingPoolTask();
|
| + EXPECT_EQ(FILE_ERROR_OK, error);
|
| + EXPECT_EQ(base::Time::FromUTCExploded(kLastAccessTime),
|
| + base::Time::FromInternalValue(entry.file_info().last_accessed()));
|
| + EXPECT_EQ(base::Time::FromUTCExploded(kLastModifiedTime),
|
| + base::Time::FromInternalValue(entry.file_info().last_modified()));
|
| +}
|
| +
|
| +} // namespace file_system
|
| +} // namespace drive
|
|
|