OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 namespace content { | 22 namespace content { |
23 | 23 |
24 class NativeFileUtilTest : public testing::Test { | 24 class NativeFileUtilTest : public testing::Test { |
25 public: | 25 public: |
26 NativeFileUtilTest() {} | 26 NativeFileUtilTest() {} |
27 | 27 |
28 void SetUp() override { ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); } | 28 void SetUp() override { ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); } |
29 | 29 |
30 protected: | 30 protected: |
31 base::FilePath Path() { | 31 base::FilePath Path() { return data_dir_.GetPath(); } |
32 return data_dir_.path(); | |
33 } | |
34 | 32 |
35 base::FilePath Path(const char* file_name) { | 33 base::FilePath Path(const char* file_name) { |
36 return data_dir_.path().AppendASCII(file_name); | 34 return data_dir_.GetPath().AppendASCII(file_name); |
37 } | 35 } |
38 | 36 |
39 bool FileExists(const base::FilePath& path) { | 37 bool FileExists(const base::FilePath& path) { |
40 return base::PathExists(path) && | 38 return base::PathExists(path) && |
41 !base::DirectoryExists(path); | 39 !base::DirectoryExists(path); |
42 } | 40 } |
43 | 41 |
44 int64_t GetSize(const base::FilePath& path) { | 42 int64_t GetSize(const base::FilePath& path) { |
45 base::File::Info info; | 43 base::File::Info info; |
46 base::GetFileInfo(path, &info); | 44 base::GetFileInfo(path, &info); |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 FileSystemOperation::OPTION_PRESERVE_LAST_MODIFIED, | 400 FileSystemOperation::OPTION_PRESERVE_LAST_MODIFIED, |
403 NativeFileUtil::MOVE)); | 401 NativeFileUtil::MOVE)); |
404 | 402 |
405 ASSERT_TRUE(FileExists(to_file3)); | 403 ASSERT_TRUE(FileExists(to_file3)); |
406 ASSERT_EQ(base::File::FILE_OK, | 404 ASSERT_EQ(base::File::FILE_OK, |
407 NativeFileUtil::GetFileInfo(to_file2, &file_info2)); | 405 NativeFileUtil::GetFileInfo(to_file2, &file_info2)); |
408 EXPECT_EQ(file_info1.last_modified, file_info2.last_modified); | 406 EXPECT_EQ(file_info1.last_modified, file_info2.last_modified); |
409 } | 407 } |
410 | 408 |
411 } // namespace content | 409 } // namespace content |
OLD | NEW |