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 "base/files/file_util_proxy.h" | 5 #include "base/files/file_util_proxy.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "base/message_loop/message_loop.h" | |
12 #include "base/threading/thread.h" | 11 #include "base/threading/thread.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
14 | 13 |
15 namespace base { | 14 namespace base { |
16 | 15 |
17 class FileUtilProxyTest : public testing::Test { | 16 class FileUtilProxyTest : public testing::Test { |
18 public: | 17 public: |
19 FileUtilProxyTest() | 18 FileUtilProxyTest() |
20 : file_thread_("FileUtilProxyTestFileThread"), | 19 : file_thread_("FileUtilProxyTestFileThread"), |
21 error_(File::FILE_OK), | 20 error_(File::FILE_OK), |
(...skipping 11 matching lines...) Expand all Loading... |
33 | 32 |
34 void DidGetFileInfo(File::Error error, | 33 void DidGetFileInfo(File::Error error, |
35 const File::Info& file_info) { | 34 const File::Info& file_info) { |
36 error_ = error; | 35 error_ = error; |
37 file_info_ = file_info; | 36 file_info_ = file_info; |
38 MessageLoop::current()->QuitWhenIdle(); | 37 MessageLoop::current()->QuitWhenIdle(); |
39 } | 38 } |
40 | 39 |
41 protected: | 40 protected: |
42 TaskRunner* file_task_runner() const { | 41 TaskRunner* file_task_runner() const { |
43 return file_thread_.message_loop_proxy().get(); | 42 return file_thread_.task_runner().get(); |
44 } | 43 } |
45 const FilePath& test_dir_path() const { return dir_.path(); } | 44 const FilePath& test_dir_path() const { return dir_.path(); } |
46 const FilePath test_path() const { return dir_.path().AppendASCII("test"); } | 45 const FilePath test_path() const { return dir_.path().AppendASCII("test"); } |
47 | 46 |
48 MessageLoopForIO message_loop_; | 47 MessageLoopForIO message_loop_; |
49 Thread file_thread_; | 48 Thread file_thread_; |
50 | 49 |
51 ScopedTempDir dir_; | 50 ScopedTempDir dir_; |
52 File::Error error_; | 51 File::Error error_; |
53 FilePath path_; | 52 FilePath path_; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 121 |
123 // The returned values may only have the seconds precision, so we cast | 122 // The returned values may only have the seconds precision, so we cast |
124 // the double values to int here. | 123 // the double values to int here. |
125 EXPECT_EQ(static_cast<int>(last_modified_time.ToDoubleT()), | 124 EXPECT_EQ(static_cast<int>(last_modified_time.ToDoubleT()), |
126 static_cast<int>(info.last_modified.ToDoubleT())); | 125 static_cast<int>(info.last_modified.ToDoubleT())); |
127 EXPECT_EQ(static_cast<int>(last_accessed_time.ToDoubleT()), | 126 EXPECT_EQ(static_cast<int>(last_accessed_time.ToDoubleT()), |
128 static_cast<int>(info.last_accessed.ToDoubleT())); | 127 static_cast<int>(info.last_accessed.ToDoubleT())); |
129 } | 128 } |
130 | 129 |
131 } // namespace base | 130 } // namespace base |
OLD | NEW |