| 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 "webkit/fileapi/local_file_system_operation.h" | 5 #include "webkit/fileapi/local_file_system_operation.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 LocalFileSystemOperation* NewOperation() { | 80 LocalFileSystemOperation* NewOperation() { |
| 81 LocalFileSystemOperation* operation = test_helper_.NewOperation(); | 81 LocalFileSystemOperation* operation = test_helper_.NewOperation(); |
| 82 operation->operation_context()->set_change_observers(change_observers()); | 82 operation->operation_context()->set_change_observers(change_observers()); |
| 83 return operation; | 83 return operation; |
| 84 } | 84 } |
| 85 | 85 |
| 86 int status() const { return status_; } | 86 int status() const { return status_; } |
| 87 const base::PlatformFileInfo& info() const { return info_; } | 87 const base::PlatformFileInfo& info() const { return info_; } |
| 88 const base::FilePath& path() const { return path_; } | 88 const base::FilePath& path() const { return path_; } |
| 89 const std::vector<base::FileUtilProxy::Entry>& entries() const { | 89 const std::vector<DirectoryEntry>& entries() const { |
| 90 return entries_; | 90 return entries_; |
| 91 } | 91 } |
| 92 const ShareableFileReference* shareable_file_ref() const { | 92 const ShareableFileReference* shareable_file_ref() const { |
| 93 return shareable_file_ref_; | 93 return shareable_file_ref_; |
| 94 } | 94 } |
| 95 | 95 |
| 96 protected: | 96 protected: |
| 97 // Common temp base for nondestructive uses. | 97 // Common temp base for nondestructive uses. |
| 98 base::ScopedTempDir base_; | 98 base::ScopedTempDir base_; |
| 99 | 99 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 return base::Bind(&LocalFileSystemOperationTest::DidCreateSnapshotFile, | 198 return base::Bind(&LocalFileSystemOperationTest::DidCreateSnapshotFile, |
| 199 AsWeakPtr()); | 199 AsWeakPtr()); |
| 200 } | 200 } |
| 201 | 201 |
| 202 void DidFinish(base::PlatformFileError status) { | 202 void DidFinish(base::PlatformFileError status) { |
| 203 status_ = status; | 203 status_ = status; |
| 204 } | 204 } |
| 205 | 205 |
| 206 void DidReadDirectory( | 206 void DidReadDirectory( |
| 207 base::PlatformFileError status, | 207 base::PlatformFileError status, |
| 208 const std::vector<base::FileUtilProxy::Entry>& entries, | 208 const std::vector<DirectoryEntry>& entries, |
| 209 bool /* has_more */) { | 209 bool /* has_more */) { |
| 210 entries_ = entries; | 210 entries_ = entries; |
| 211 status_ = status; | 211 status_ = status; |
| 212 } | 212 } |
| 213 | 213 |
| 214 void DidGetMetadata(base::PlatformFileError status, | 214 void DidGetMetadata(base::PlatformFileError status, |
| 215 const base::PlatformFileInfo& info, | 215 const base::PlatformFileInfo& info, |
| 216 const base::FilePath& platform_path) { | 216 const base::FilePath& platform_path) { |
| 217 info_ = info; | 217 info_ = info; |
| 218 path_ = platform_path; | 218 path_ = platform_path; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 GetUsageAndQuota(NULL, "a); | 269 GetUsageAndQuota(NULL, "a); |
| 270 quota_manager()->SetQuota(test_helper_.origin(), | 270 quota_manager()->SetQuota(test_helper_.origin(), |
| 271 test_helper_.storage_type(), | 271 test_helper_.storage_type(), |
| 272 quota + quota_delta); | 272 quota + quota_delta); |
| 273 } | 273 } |
| 274 | 274 |
| 275 // For post-operation status. | 275 // For post-operation status. |
| 276 int status_; | 276 int status_; |
| 277 base::PlatformFileInfo info_; | 277 base::PlatformFileInfo info_; |
| 278 base::FilePath path_; | 278 base::FilePath path_; |
| 279 std::vector<base::FileUtilProxy::Entry> entries_; | 279 std::vector<DirectoryEntry> entries_; |
| 280 scoped_refptr<ShareableFileReference> shareable_file_ref_; | 280 scoped_refptr<ShareableFileReference> shareable_file_ref_; |
| 281 | 281 |
| 282 private: | 282 private: |
| 283 base::MessageLoop message_loop_; | 283 base::MessageLoop message_loop_; |
| 284 scoped_refptr<QuotaManager> quota_manager_; | 284 scoped_refptr<QuotaManager> quota_manager_; |
| 285 scoped_refptr<QuotaManagerProxy> quota_manager_proxy_; | 285 scoped_refptr<QuotaManagerProxy> quota_manager_proxy_; |
| 286 | 286 |
| 287 MockFileChangeObserver change_observer_; | 287 MockFileChangeObserver change_observer_; |
| 288 ChangeObserverList change_observers_; | 288 ChangeObserverList change_observers_; |
| 289 | 289 |
| (...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1208 EXPECT_FALSE(info().is_directory); | 1208 EXPECT_FALSE(info().is_directory); |
| 1209 EXPECT_EQ(PlatformPath(file_path), path()); | 1209 EXPECT_EQ(PlatformPath(file_path), path()); |
| 1210 EXPECT_TRUE(change_observer()->HasNoChange()); | 1210 EXPECT_TRUE(change_observer()->HasNoChange()); |
| 1211 | 1211 |
| 1212 // The FileSystemOpration implementation does not create a | 1212 // The FileSystemOpration implementation does not create a |
| 1213 // shareable file reference. | 1213 // shareable file reference. |
| 1214 EXPECT_EQ(NULL, shareable_file_ref()); | 1214 EXPECT_EQ(NULL, shareable_file_ref()); |
| 1215 } | 1215 } |
| 1216 | 1216 |
| 1217 } // namespace fileapi | 1217 } // namespace fileapi |
| OLD | NEW |