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

Side by Side Diff: webkit/fileapi/file_system_operation_unittest.cc

Issue 7470037: [Refactor] to rename and re-layer the file_util stack layers. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Rebased on the svn tree. Created 9 years, 3 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "webkit/fileapi/file_system_operation.h" 5 #include "webkit/fileapi/file_system_operation.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "base/scoped_temp_dir.h" 11 #include "base/scoped_temp_dir.h"
12 #include "googleurl/src/gurl.h" 12 #include "googleurl/src/gurl.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 #include "webkit/fileapi/file_system_callback_dispatcher.h" 14 #include "webkit/fileapi/file_system_callback_dispatcher.h"
15 #include "webkit/fileapi/file_system_context.h" 15 #include "webkit/fileapi/file_system_context.h"
16 #include "webkit/fileapi/file_system_file_util.h" 16 #include "webkit/fileapi/file_system_file_util.h"
17 #include "webkit/fileapi/file_system_mount_point_provider.h" 17 #include "webkit/fileapi/file_system_mount_point_provider.h"
18 #include "webkit/fileapi/file_system_operation.h" 18 #include "webkit/fileapi/file_system_operation.h"
19 #include "webkit/fileapi/file_system_quota_util.h" 19 #include "webkit/fileapi/file_system_quota_util.h"
20 #include "webkit/fileapi/file_system_test_helper.h" 20 #include "webkit/fileapi/file_system_test_helper.h"
21 #include "webkit/fileapi/file_system_util.h" 21 #include "webkit/fileapi/file_system_util.h"
22 #include "webkit/fileapi/local_file_system_file_util.h" 22 #include "webkit/fileapi/local_file_util.h"
23 #include "webkit/fileapi/quota_file_util.h" 23 #include "webkit/fileapi/quota_file_util.h"
24 #include "webkit/quota/quota_manager.h" 24 #include "webkit/quota/quota_manager.h"
25 25
26 using quota::QuotaClient; 26 using quota::QuotaClient;
27 using quota::QuotaManager; 27 using quota::QuotaManager;
28 using quota::QuotaManagerProxy; 28 using quota::QuotaManagerProxy;
29 using quota::StorageType; 29 using quota::StorageType;
30 30
31 namespace fileapi { 31 namespace fileapi {
32 32
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 } 148 }
149 149
150 } // namespace (anonymous) 150 } // namespace (anonymous)
151 151
152 // Test class for FileSystemOperation. Note that this just tests low-level 152 // Test class for FileSystemOperation. Note that this just tests low-level
153 // operations but doesn't test OpenFileSystem. 153 // operations but doesn't test OpenFileSystem.
154 class FileSystemOperationTest : public testing::Test { 154 class FileSystemOperationTest : public testing::Test {
155 public: 155 public:
156 FileSystemOperationTest() 156 FileSystemOperationTest()
157 : status_(kFileOperationStatusNotSet), 157 : status_(kFileOperationStatusNotSet),
158 local_file_util_( 158 local_file_util_(new LocalFileUtil(QuotaFileUtil::CreateDefault())) {
159 new LocalFileSystemFileUtil(QuotaFileUtil::CreateDefault())) {
160 EXPECT_TRUE(base_.CreateUniqueTempDir()); 159 EXPECT_TRUE(base_.CreateUniqueTempDir());
161 } 160 }
162 161
163 FileSystemOperation* operation(); 162 FileSystemOperation* operation();
164 163
165 void set_status(int status) { status_ = status; } 164 void set_status(int status) { status_ = status; }
166 int status() const { return status_; } 165 int status() const { return status_; }
167 void set_info(const base::PlatformFileInfo& info) { info_ = info; } 166 void set_info(const base::PlatformFileInfo& info) { info_ = info; }
168 const base::PlatformFileInfo& info() const { return info_; } 167 const base::PlatformFileInfo& info() const { return info_; }
169 void set_path(const FilePath& path) { path_ = path; } 168 void set_path(const FilePath& path) { path_ = path; }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 242
244 FileSystemTestOriginHelper test_helper_; 243 FileSystemTestOriginHelper test_helper_;
245 244
246 // For post-operation status. 245 // For post-operation status.
247 int status_; 246 int status_;
248 base::PlatformFileInfo info_; 247 base::PlatformFileInfo info_;
249 FilePath path_; 248 FilePath path_;
250 std::vector<base::FileUtilProxy::Entry> entries_; 249 std::vector<base::FileUtilProxy::Entry> entries_;
251 250
252 private: 251 private:
253 scoped_ptr<LocalFileSystemFileUtil> local_file_util_; 252 scoped_ptr<LocalFileUtil> local_file_util_;
254 scoped_refptr<QuotaManager> quota_manager_; 253 scoped_refptr<QuotaManager> quota_manager_;
255 scoped_refptr<QuotaManagerProxy> quota_manager_proxy_; 254 scoped_refptr<QuotaManagerProxy> quota_manager_proxy_;
256 DISALLOW_COPY_AND_ASSIGN(FileSystemOperationTest); 255 DISALLOW_COPY_AND_ASSIGN(FileSystemOperationTest);
257 }; 256 };
258 257
259 namespace { 258 namespace {
260 259
261 class MockDispatcher : public FileSystemCallbackDispatcher { 260 class MockDispatcher : public FileSystemCallbackDispatcher {
262 public: 261 public:
263 explicit MockDispatcher(FileSystemOperationTest* test) : test_(test) { } 262 explicit MockDispatcher(FileSystemOperationTest* test) : test_(test) { }
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 980
982 EXPECT_TRUE(file_util::GetFileInfo(platform_path, &info)); 981 EXPECT_TRUE(file_util::GetFileInfo(platform_path, &info));
983 // We compare as time_t here to lower our resolution, to avoid false 982 // We compare as time_t here to lower our resolution, to avoid false
984 // negatives caused by conversion to the local filesystem's native 983 // negatives caused by conversion to the local filesystem's native
985 // representation and back. 984 // representation and back.
986 EXPECT_EQ(new_modified_time.ToTimeT(), info.last_modified.ToTimeT()); 985 EXPECT_EQ(new_modified_time.ToTimeT(), info.last_modified.ToTimeT());
987 EXPECT_EQ(new_accessed_time.ToTimeT(), info.last_accessed.ToTimeT()); 986 EXPECT_EQ(new_accessed_time.ToTimeT(), info.last_accessed.ToTimeT());
988 } 987 }
989 988
990 } // namespace fileapi 989 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_operation_context.cc ('k') | webkit/fileapi/file_system_operation_write_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698