| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <map> | 5 #include <map> |
| 6 #include <queue> | 6 #include <queue> |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
| 15 #include "content/browser/quota/mock_quota_manager.h" | 15 #include "content/browser/quota/mock_quota_manager.h" |
| 16 #include "content/browser/quota/mock_quota_manager_proxy.h" | 16 #include "content/browser/quota/mock_quota_manager_proxy.h" |
| 17 #include "content/public/test/async_file_test_helper.h" | 17 #include "content/public/test/async_file_test_helper.h" |
| 18 #include "content/public/test/test_file_system_backend.h" | 18 #include "content/public/test/test_file_system_backend.h" |
| 19 #include "content/public/test/test_file_system_context.h" | 19 #include "content/public/test/test_file_system_context.h" |
| 20 #include "content/test/fileapi_test_file_set.h" | 20 #include "content/test/fileapi_test_file_set.h" |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 22 #include "webkit/browser/blob/file_stream_reader.h" | 22 #include "storage/browser/blob/file_stream_reader.h" |
| 23 #include "webkit/browser/fileapi/copy_or_move_file_validator.h" | 23 #include "storage/browser/fileapi/copy_or_move_file_validator.h" |
| 24 #include "webkit/browser/fileapi/copy_or_move_operation_delegate.h" | 24 #include "storage/browser/fileapi/copy_or_move_operation_delegate.h" |
| 25 #include "webkit/browser/fileapi/file_stream_writer.h" | 25 #include "storage/browser/fileapi/file_stream_writer.h" |
| 26 #include "webkit/browser/fileapi/file_system_backend.h" | 26 #include "storage/browser/fileapi/file_system_backend.h" |
| 27 #include "webkit/browser/fileapi/file_system_context.h" | 27 #include "storage/browser/fileapi/file_system_context.h" |
| 28 #include "webkit/browser/fileapi/file_system_operation.h" | 28 #include "storage/browser/fileapi/file_system_operation.h" |
| 29 #include "webkit/browser/fileapi/file_system_url.h" | 29 #include "storage/browser/fileapi/file_system_url.h" |
| 30 #include "webkit/browser/quota/quota_manager.h" | 30 #include "storage/browser/quota/quota_manager.h" |
| 31 #include "webkit/common/fileapi/file_system_util.h" | 31 #include "storage/common/fileapi/file_system_util.h" |
| 32 | 32 |
| 33 using content::AsyncFileTestHelper; | 33 using content::AsyncFileTestHelper; |
| 34 using fileapi::CopyOrMoveOperationDelegate; | 34 using storage::CopyOrMoveOperationDelegate; |
| 35 using fileapi::FileStreamWriter; | 35 using storage::FileStreamWriter; |
| 36 using fileapi::FileSystemOperation; | 36 using storage::FileSystemOperation; |
| 37 using fileapi::FileSystemURL; | 37 using storage::FileSystemURL; |
| 38 | 38 |
| 39 namespace content { | 39 namespace content { |
| 40 | 40 |
| 41 typedef fileapi::FileSystemOperation::FileEntryList FileEntryList; | 41 typedef storage::FileSystemOperation::FileEntryList FileEntryList; |
| 42 | 42 |
| 43 namespace { | 43 namespace { |
| 44 | 44 |
| 45 void ExpectOk(const GURL& origin_url, | 45 void ExpectOk(const GURL& origin_url, |
| 46 const std::string& name, | 46 const std::string& name, |
| 47 base::File::Error error) { | 47 base::File::Error error) { |
| 48 ASSERT_EQ(base::File::FILE_OK, error); | 48 ASSERT_EQ(base::File::FILE_OK, error); |
| 49 } | 49 } |
| 50 | 50 |
| 51 class TestValidatorFactory : public fileapi::CopyOrMoveFileValidatorFactory { | 51 class TestValidatorFactory : public storage::CopyOrMoveFileValidatorFactory { |
| 52 public: | 52 public: |
| 53 // A factory that creates validators that accept everything or nothing. | 53 // A factory that creates validators that accept everything or nothing. |
| 54 TestValidatorFactory() {} | 54 TestValidatorFactory() {} |
| 55 virtual ~TestValidatorFactory() {} | 55 virtual ~TestValidatorFactory() {} |
| 56 | 56 |
| 57 virtual fileapi::CopyOrMoveFileValidator* CreateCopyOrMoveFileValidator( | 57 virtual storage::CopyOrMoveFileValidator* CreateCopyOrMoveFileValidator( |
| 58 const FileSystemURL& /*src_url*/, | 58 const FileSystemURL& /*src_url*/, |
| 59 const base::FilePath& /*platform_path*/) OVERRIDE { | 59 const base::FilePath& /*platform_path*/) OVERRIDE { |
| 60 // Move arg management to TestValidator? | 60 // Move arg management to TestValidator? |
| 61 return new TestValidator(true, true, std::string("2")); | 61 return new TestValidator(true, true, std::string("2")); |
| 62 } | 62 } |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 class TestValidator : public fileapi::CopyOrMoveFileValidator { | 65 class TestValidator : public storage::CopyOrMoveFileValidator { |
| 66 public: | 66 public: |
| 67 explicit TestValidator(bool pre_copy_valid, | 67 explicit TestValidator(bool pre_copy_valid, |
| 68 bool post_copy_valid, | 68 bool post_copy_valid, |
| 69 const std::string& reject_string) | 69 const std::string& reject_string) |
| 70 : result_(pre_copy_valid ? base::File::FILE_OK : | 70 : result_(pre_copy_valid ? base::File::FILE_OK : |
| 71 base::File::FILE_ERROR_SECURITY), | 71 base::File::FILE_ERROR_SECURITY), |
| 72 write_result_(post_copy_valid ? base::File::FILE_OK : | 72 write_result_(post_copy_valid ? base::File::FILE_OK : |
| 73 base::File::FILE_ERROR_SECURITY), | 73 base::File::FILE_ERROR_SECURITY), |
| 74 reject_string_(reject_string) { | 74 reject_string_(reject_string) { |
| 75 } | 75 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 99 base::File::Error result_; | 99 base::File::Error result_; |
| 100 base::File::Error write_result_; | 100 base::File::Error write_result_; |
| 101 std::string reject_string_; | 101 std::string reject_string_; |
| 102 | 102 |
| 103 DISALLOW_COPY_AND_ASSIGN(TestValidator); | 103 DISALLOW_COPY_AND_ASSIGN(TestValidator); |
| 104 }; | 104 }; |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 // Records CopyProgressCallback invocations. | 107 // Records CopyProgressCallback invocations. |
| 108 struct ProgressRecord { | 108 struct ProgressRecord { |
| 109 fileapi::FileSystemOperation::CopyProgressType type; | 109 storage::FileSystemOperation::CopyProgressType type; |
| 110 FileSystemURL source_url; | 110 FileSystemURL source_url; |
| 111 FileSystemURL dest_url; | 111 FileSystemURL dest_url; |
| 112 int64 size; | 112 int64 size; |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 void RecordProgressCallback(std::vector<ProgressRecord>* records, | 115 void RecordProgressCallback(std::vector<ProgressRecord>* records, |
| 116 fileapi::FileSystemOperation::CopyProgressType type, | 116 storage::FileSystemOperation::CopyProgressType type, |
| 117 const FileSystemURL& source_url, | 117 const FileSystemURL& source_url, |
| 118 const FileSystemURL& dest_url, | 118 const FileSystemURL& dest_url, |
| 119 int64 size) { | 119 int64 size) { |
| 120 ProgressRecord record; | 120 ProgressRecord record; |
| 121 record.type = type; | 121 record.type = type; |
| 122 record.source_url = source_url; | 122 record.source_url = source_url; |
| 123 record.dest_url = dest_url; | 123 record.dest_url = dest_url; |
| 124 record.size = size; | 124 record.size = size; |
| 125 records->push_back(record); | 125 records->push_back(record); |
| 126 } | 126 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 private: | 158 private: |
| 159 base::Thread* thread_; | 159 base::Thread* thread_; |
| 160 DISALLOW_COPY_AND_ASSIGN(ScopedThreadStopper); | 160 DISALLOW_COPY_AND_ASSIGN(ScopedThreadStopper); |
| 161 }; | 161 }; |
| 162 | 162 |
| 163 } // namespace | 163 } // namespace |
| 164 | 164 |
| 165 class CopyOrMoveOperationTestHelper { | 165 class CopyOrMoveOperationTestHelper { |
| 166 public: | 166 public: |
| 167 CopyOrMoveOperationTestHelper(const GURL& origin, | 167 CopyOrMoveOperationTestHelper(const GURL& origin, |
| 168 fileapi::FileSystemType src_type, | 168 storage::FileSystemType src_type, |
| 169 fileapi::FileSystemType dest_type) | 169 storage::FileSystemType dest_type) |
| 170 : origin_(origin), src_type_(src_type), dest_type_(dest_type) {} | 170 : origin_(origin), src_type_(src_type), dest_type_(dest_type) {} |
| 171 | 171 |
| 172 ~CopyOrMoveOperationTestHelper() { | 172 ~CopyOrMoveOperationTestHelper() { |
| 173 file_system_context_ = NULL; | 173 file_system_context_ = NULL; |
| 174 quota_manager_proxy_->SimulateQuotaManagerDestroyed(); | 174 quota_manager_proxy_->SimulateQuotaManagerDestroyed(); |
| 175 quota_manager_ = NULL; | 175 quota_manager_ = NULL; |
| 176 quota_manager_proxy_ = NULL; | 176 quota_manager_proxy_ = NULL; |
| 177 base::RunLoop().RunUntilIdle(); | 177 base::RunLoop().RunUntilIdle(); |
| 178 } | 178 } |
| 179 | 179 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 194 base_dir, | 194 base_dir, |
| 195 base::MessageLoopProxy::current().get(), | 195 base::MessageLoopProxy::current().get(), |
| 196 base::MessageLoopProxy::current().get(), | 196 base::MessageLoopProxy::current().get(), |
| 197 NULL /* special storage policy */); | 197 NULL /* special storage policy */); |
| 198 quota_manager_proxy_ = new MockQuotaManagerProxy( | 198 quota_manager_proxy_ = new MockQuotaManagerProxy( |
| 199 quota_manager_.get(), base::MessageLoopProxy::current().get()); | 199 quota_manager_.get(), base::MessageLoopProxy::current().get()); |
| 200 file_system_context_ = | 200 file_system_context_ = |
| 201 CreateFileSystemContextForTesting(quota_manager_proxy_.get(), base_dir); | 201 CreateFileSystemContextForTesting(quota_manager_proxy_.get(), base_dir); |
| 202 | 202 |
| 203 // Prepare the origin's root directory. | 203 // Prepare the origin's root directory. |
| 204 fileapi::FileSystemBackend* backend = | 204 storage::FileSystemBackend* backend = |
| 205 file_system_context_->GetFileSystemBackend(src_type_); | 205 file_system_context_->GetFileSystemBackend(src_type_); |
| 206 backend->ResolveURL( | 206 backend->ResolveURL( |
| 207 FileSystemURL::CreateForTest(origin_, src_type_, base::FilePath()), | 207 FileSystemURL::CreateForTest(origin_, src_type_, base::FilePath()), |
| 208 fileapi::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, | 208 storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, |
| 209 base::Bind(&ExpectOk)); | 209 base::Bind(&ExpectOk)); |
| 210 backend = file_system_context_->GetFileSystemBackend(dest_type_); | 210 backend = file_system_context_->GetFileSystemBackend(dest_type_); |
| 211 if (dest_type_ == fileapi::kFileSystemTypeTest) { | 211 if (dest_type_ == storage::kFileSystemTypeTest) { |
| 212 TestFileSystemBackend* test_backend = | 212 TestFileSystemBackend* test_backend = |
| 213 static_cast<TestFileSystemBackend*>(backend); | 213 static_cast<TestFileSystemBackend*>(backend); |
| 214 scoped_ptr<fileapi::CopyOrMoveFileValidatorFactory> factory( | 214 scoped_ptr<storage::CopyOrMoveFileValidatorFactory> factory( |
| 215 new TestValidatorFactory); | 215 new TestValidatorFactory); |
| 216 test_backend->set_require_copy_or_move_validator( | 216 test_backend->set_require_copy_or_move_validator( |
| 217 require_copy_or_move_validator); | 217 require_copy_or_move_validator); |
| 218 if (init_copy_or_move_validator) | 218 if (init_copy_or_move_validator) |
| 219 test_backend->InitializeCopyOrMoveFileValidatorFactory(factory.Pass()); | 219 test_backend->InitializeCopyOrMoveFileValidatorFactory(factory.Pass()); |
| 220 } | 220 } |
| 221 backend->ResolveURL( | 221 backend->ResolveURL( |
| 222 FileSystemURL::CreateForTest(origin_, dest_type_, base::FilePath()), | 222 FileSystemURL::CreateForTest(origin_, dest_type_, base::FilePath()), |
| 223 fileapi::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, | 223 storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, |
| 224 base::Bind(&ExpectOk)); | 224 base::Bind(&ExpectOk)); |
| 225 base::RunLoop().RunUntilIdle(); | 225 base::RunLoop().RunUntilIdle(); |
| 226 | 226 |
| 227 // Grant relatively big quota initially. | 227 // Grant relatively big quota initially. |
| 228 quota_manager_->SetQuota( | 228 quota_manager_->SetQuota( |
| 229 origin_, | 229 origin_, |
| 230 fileapi::FileSystemTypeToQuotaStorageType(src_type_), | 230 storage::FileSystemTypeToQuotaStorageType(src_type_), |
| 231 1024 * 1024); | 231 1024 * 1024); |
| 232 quota_manager_->SetQuota( | 232 quota_manager_->SetQuota( |
| 233 origin_, | 233 origin_, |
| 234 fileapi::FileSystemTypeToQuotaStorageType(dest_type_), | 234 storage::FileSystemTypeToQuotaStorageType(dest_type_), |
| 235 1024 * 1024); | 235 1024 * 1024); |
| 236 } | 236 } |
| 237 | 237 |
| 238 int64 GetSourceUsage() { | 238 int64 GetSourceUsage() { |
| 239 int64 usage = 0; | 239 int64 usage = 0; |
| 240 GetUsageAndQuota(src_type_, &usage, NULL); | 240 GetUsageAndQuota(src_type_, &usage, NULL); |
| 241 return usage; | 241 return usage; |
| 242 } | 242 } |
| 243 | 243 |
| 244 int64 GetDestUsage() { | 244 int64 GetDestUsage() { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 return AsyncFileTestHelper::FileExists( | 366 return AsyncFileTestHelper::FileExists( |
| 367 file_system_context_.get(), url, expected_size); | 367 file_system_context_.get(), url, expected_size); |
| 368 } | 368 } |
| 369 | 369 |
| 370 bool DirectoryExists(const FileSystemURL& url) { | 370 bool DirectoryExists(const FileSystemURL& url) { |
| 371 return AsyncFileTestHelper::DirectoryExists(file_system_context_.get(), | 371 return AsyncFileTestHelper::DirectoryExists(file_system_context_.get(), |
| 372 url); | 372 url); |
| 373 } | 373 } |
| 374 | 374 |
| 375 private: | 375 private: |
| 376 void GetUsageAndQuota(fileapi::FileSystemType type, | 376 void GetUsageAndQuota(storage::FileSystemType type, |
| 377 int64* usage, | 377 int64* usage, |
| 378 int64* quota) { | 378 int64* quota) { |
| 379 quota::QuotaStatusCode status = AsyncFileTestHelper::GetUsageAndQuota( | 379 quota::QuotaStatusCode status = AsyncFileTestHelper::GetUsageAndQuota( |
| 380 quota_manager_.get(), origin_, type, usage, quota); | 380 quota_manager_.get(), origin_, type, usage, quota); |
| 381 ASSERT_EQ(quota::kQuotaStatusOk, status); | 381 ASSERT_EQ(quota::kQuotaStatusOk, status); |
| 382 } | 382 } |
| 383 | 383 |
| 384 private: | 384 private: |
| 385 base::ScopedTempDir base_; | 385 base::ScopedTempDir base_; |
| 386 | 386 |
| 387 const GURL origin_; | 387 const GURL origin_; |
| 388 const fileapi::FileSystemType src_type_; | 388 const storage::FileSystemType src_type_; |
| 389 const fileapi::FileSystemType dest_type_; | 389 const storage::FileSystemType dest_type_; |
| 390 | 390 |
| 391 base::MessageLoopForIO message_loop_; | 391 base::MessageLoopForIO message_loop_; |
| 392 scoped_refptr<fileapi::FileSystemContext> file_system_context_; | 392 scoped_refptr<storage::FileSystemContext> file_system_context_; |
| 393 scoped_refptr<MockQuotaManagerProxy> quota_manager_proxy_; | 393 scoped_refptr<MockQuotaManagerProxy> quota_manager_proxy_; |
| 394 scoped_refptr<MockQuotaManager> quota_manager_; | 394 scoped_refptr<MockQuotaManager> quota_manager_; |
| 395 | 395 |
| 396 DISALLOW_COPY_AND_ASSIGN(CopyOrMoveOperationTestHelper); | 396 DISALLOW_COPY_AND_ASSIGN(CopyOrMoveOperationTestHelper); |
| 397 }; | 397 }; |
| 398 | 398 |
| 399 TEST(LocalFileSystemCopyOrMoveOperationTest, CopySingleFile) { | 399 TEST(LocalFileSystemCopyOrMoveOperationTest, CopySingleFile) { |
| 400 CopyOrMoveOperationTestHelper helper(GURL("http://foo"), | 400 CopyOrMoveOperationTestHelper helper(GURL("http://foo"), |
| 401 fileapi::kFileSystemTypeTemporary, | 401 storage::kFileSystemTypeTemporary, |
| 402 fileapi::kFileSystemTypePersistent); | 402 storage::kFileSystemTypePersistent); |
| 403 helper.SetUp(); | 403 helper.SetUp(); |
| 404 | 404 |
| 405 FileSystemURL src = helper.SourceURL("a"); | 405 FileSystemURL src = helper.SourceURL("a"); |
| 406 FileSystemURL dest = helper.DestURL("b"); | 406 FileSystemURL dest = helper.DestURL("b"); |
| 407 int64 src_initial_usage = helper.GetSourceUsage(); | 407 int64 src_initial_usage = helper.GetSourceUsage(); |
| 408 int64 dest_initial_usage = helper.GetDestUsage(); | 408 int64 dest_initial_usage = helper.GetDestUsage(); |
| 409 | 409 |
| 410 // Set up a source file. | 410 // Set up a source file. |
| 411 ASSERT_EQ(base::File::FILE_OK, helper.CreateFile(src, 10)); | 411 ASSERT_EQ(base::File::FILE_OK, helper.CreateFile(src, 10)); |
| 412 int64 src_increase = helper.GetSourceUsage() - src_initial_usage; | 412 int64 src_increase = helper.GetSourceUsage() - src_initial_usage; |
| 413 | 413 |
| 414 // Copy it. | 414 // Copy it. |
| 415 ASSERT_EQ(base::File::FILE_OK, helper.Copy(src, dest)); | 415 ASSERT_EQ(base::File::FILE_OK, helper.Copy(src, dest)); |
| 416 | 416 |
| 417 // Verify. | 417 // Verify. |
| 418 ASSERT_TRUE(helper.FileExists(src, 10)); | 418 ASSERT_TRUE(helper.FileExists(src, 10)); |
| 419 ASSERT_TRUE(helper.FileExists(dest, 10)); | 419 ASSERT_TRUE(helper.FileExists(dest, 10)); |
| 420 | 420 |
| 421 int64 src_new_usage = helper.GetSourceUsage(); | 421 int64 src_new_usage = helper.GetSourceUsage(); |
| 422 ASSERT_EQ(src_initial_usage + src_increase, src_new_usage); | 422 ASSERT_EQ(src_initial_usage + src_increase, src_new_usage); |
| 423 | 423 |
| 424 int64 dest_increase = helper.GetDestUsage() - dest_initial_usage; | 424 int64 dest_increase = helper.GetDestUsage() - dest_initial_usage; |
| 425 ASSERT_EQ(src_increase, dest_increase); | 425 ASSERT_EQ(src_increase, dest_increase); |
| 426 } | 426 } |
| 427 | 427 |
| 428 TEST(LocalFileSystemCopyOrMoveOperationTest, MoveSingleFile) { | 428 TEST(LocalFileSystemCopyOrMoveOperationTest, MoveSingleFile) { |
| 429 CopyOrMoveOperationTestHelper helper(GURL("http://foo"), | 429 CopyOrMoveOperationTestHelper helper(GURL("http://foo"), |
| 430 fileapi::kFileSystemTypeTemporary, | 430 storage::kFileSystemTypeTemporary, |
| 431 fileapi::kFileSystemTypePersistent); | 431 storage::kFileSystemTypePersistent); |
| 432 helper.SetUp(); | 432 helper.SetUp(); |
| 433 | 433 |
| 434 FileSystemURL src = helper.SourceURL("a"); | 434 FileSystemURL src = helper.SourceURL("a"); |
| 435 FileSystemURL dest = helper.DestURL("b"); | 435 FileSystemURL dest = helper.DestURL("b"); |
| 436 int64 src_initial_usage = helper.GetSourceUsage(); | 436 int64 src_initial_usage = helper.GetSourceUsage(); |
| 437 int64 dest_initial_usage = helper.GetDestUsage(); | 437 int64 dest_initial_usage = helper.GetDestUsage(); |
| 438 | 438 |
| 439 // Set up a source file. | 439 // Set up a source file. |
| 440 ASSERT_EQ(base::File::FILE_OK, helper.CreateFile(src, 10)); | 440 ASSERT_EQ(base::File::FILE_OK, helper.CreateFile(src, 10)); |
| 441 int64 src_increase = helper.GetSourceUsage() - src_initial_usage; | 441 int64 src_increase = helper.GetSourceUsage() - src_initial_usage; |
| 442 | 442 |
| 443 // Move it. | 443 // Move it. |
| 444 ASSERT_EQ(base::File::FILE_OK, helper.Move(src, dest)); | 444 ASSERT_EQ(base::File::FILE_OK, helper.Move(src, dest)); |
| 445 | 445 |
| 446 // Verify. | 446 // Verify. |
| 447 ASSERT_FALSE(helper.FileExists(src, AsyncFileTestHelper::kDontCheckSize)); | 447 ASSERT_FALSE(helper.FileExists(src, AsyncFileTestHelper::kDontCheckSize)); |
| 448 ASSERT_TRUE(helper.FileExists(dest, 10)); | 448 ASSERT_TRUE(helper.FileExists(dest, 10)); |
| 449 | 449 |
| 450 int64 src_new_usage = helper.GetSourceUsage(); | 450 int64 src_new_usage = helper.GetSourceUsage(); |
| 451 ASSERT_EQ(src_initial_usage, src_new_usage); | 451 ASSERT_EQ(src_initial_usage, src_new_usage); |
| 452 | 452 |
| 453 int64 dest_increase = helper.GetDestUsage() - dest_initial_usage; | 453 int64 dest_increase = helper.GetDestUsage() - dest_initial_usage; |
| 454 ASSERT_EQ(src_increase, dest_increase); | 454 ASSERT_EQ(src_increase, dest_increase); |
| 455 } | 455 } |
| 456 | 456 |
| 457 TEST(LocalFileSystemCopyOrMoveOperationTest, CopySingleDirectory) { | 457 TEST(LocalFileSystemCopyOrMoveOperationTest, CopySingleDirectory) { |
| 458 CopyOrMoveOperationTestHelper helper(GURL("http://foo"), | 458 CopyOrMoveOperationTestHelper helper(GURL("http://foo"), |
| 459 fileapi::kFileSystemTypeTemporary, | 459 storage::kFileSystemTypeTemporary, |
| 460 fileapi::kFileSystemTypePersistent); | 460 storage::kFileSystemTypePersistent); |
| 461 helper.SetUp(); | 461 helper.SetUp(); |
| 462 | 462 |
| 463 FileSystemURL src = helper.SourceURL("a"); | 463 FileSystemURL src = helper.SourceURL("a"); |
| 464 FileSystemURL dest = helper.DestURL("b"); | 464 FileSystemURL dest = helper.DestURL("b"); |
| 465 int64 src_initial_usage = helper.GetSourceUsage(); | 465 int64 src_initial_usage = helper.GetSourceUsage(); |
| 466 int64 dest_initial_usage = helper.GetDestUsage(); | 466 int64 dest_initial_usage = helper.GetDestUsage(); |
| 467 | 467 |
| 468 // Set up a source directory. | 468 // Set up a source directory. |
| 469 ASSERT_EQ(base::File::FILE_OK, helper.CreateDirectory(src)); | 469 ASSERT_EQ(base::File::FILE_OK, helper.CreateDirectory(src)); |
| 470 int64 src_increase = helper.GetSourceUsage() - src_initial_usage; | 470 int64 src_increase = helper.GetSourceUsage() - src_initial_usage; |
| 471 | 471 |
| 472 // Copy it. | 472 // Copy it. |
| 473 ASSERT_EQ(base::File::FILE_OK, helper.Copy(src, dest)); | 473 ASSERT_EQ(base::File::FILE_OK, helper.Copy(src, dest)); |
| 474 | 474 |
| 475 // Verify. | 475 // Verify. |
| 476 ASSERT_TRUE(helper.DirectoryExists(src)); | 476 ASSERT_TRUE(helper.DirectoryExists(src)); |
| 477 ASSERT_TRUE(helper.DirectoryExists(dest)); | 477 ASSERT_TRUE(helper.DirectoryExists(dest)); |
| 478 | 478 |
| 479 int64 src_new_usage = helper.GetSourceUsage(); | 479 int64 src_new_usage = helper.GetSourceUsage(); |
| 480 ASSERT_EQ(src_initial_usage + src_increase, src_new_usage); | 480 ASSERT_EQ(src_initial_usage + src_increase, src_new_usage); |
| 481 | 481 |
| 482 int64 dest_increase = helper.GetDestUsage() - dest_initial_usage; | 482 int64 dest_increase = helper.GetDestUsage() - dest_initial_usage; |
| 483 ASSERT_EQ(src_increase, dest_increase); | 483 ASSERT_EQ(src_increase, dest_increase); |
| 484 } | 484 } |
| 485 | 485 |
| 486 TEST(LocalFileSystemCopyOrMoveOperationTest, MoveSingleDirectory) { | 486 TEST(LocalFileSystemCopyOrMoveOperationTest, MoveSingleDirectory) { |
| 487 CopyOrMoveOperationTestHelper helper(GURL("http://foo"), | 487 CopyOrMoveOperationTestHelper helper(GURL("http://foo"), |
| 488 fileapi::kFileSystemTypeTemporary, | 488 storage::kFileSystemTypeTemporary, |
| 489 fileapi::kFileSystemTypePersistent); | 489 storage::kFileSystemTypePersistent); |
| 490 helper.SetUp(); | 490 helper.SetUp(); |
| 491 | 491 |
| 492 FileSystemURL src = helper.SourceURL("a"); | 492 FileSystemURL src = helper.SourceURL("a"); |
| 493 FileSystemURL dest = helper.DestURL("b"); | 493 FileSystemURL dest = helper.DestURL("b"); |
| 494 int64 src_initial_usage = helper.GetSourceUsage(); | 494 int64 src_initial_usage = helper.GetSourceUsage(); |
| 495 int64 dest_initial_usage = helper.GetDestUsage(); | 495 int64 dest_initial_usage = helper.GetDestUsage(); |
| 496 | 496 |
| 497 // Set up a source directory. | 497 // Set up a source directory. |
| 498 ASSERT_EQ(base::File::FILE_OK, helper.CreateDirectory(src)); | 498 ASSERT_EQ(base::File::FILE_OK, helper.CreateDirectory(src)); |
| 499 int64 src_increase = helper.GetSourceUsage() - src_initial_usage; | 499 int64 src_increase = helper.GetSourceUsage() - src_initial_usage; |
| 500 | 500 |
| 501 // Move it. | 501 // Move it. |
| 502 ASSERT_EQ(base::File::FILE_OK, helper.Move(src, dest)); | 502 ASSERT_EQ(base::File::FILE_OK, helper.Move(src, dest)); |
| 503 | 503 |
| 504 // Verify. | 504 // Verify. |
| 505 ASSERT_FALSE(helper.DirectoryExists(src)); | 505 ASSERT_FALSE(helper.DirectoryExists(src)); |
| 506 ASSERT_TRUE(helper.DirectoryExists(dest)); | 506 ASSERT_TRUE(helper.DirectoryExists(dest)); |
| 507 | 507 |
| 508 int64 src_new_usage = helper.GetSourceUsage(); | 508 int64 src_new_usage = helper.GetSourceUsage(); |
| 509 ASSERT_EQ(src_initial_usage, src_new_usage); | 509 ASSERT_EQ(src_initial_usage, src_new_usage); |
| 510 | 510 |
| 511 int64 dest_increase = helper.GetDestUsage() - dest_initial_usage; | 511 int64 dest_increase = helper.GetDestUsage() - dest_initial_usage; |
| 512 ASSERT_EQ(src_increase, dest_increase); | 512 ASSERT_EQ(src_increase, dest_increase); |
| 513 } | 513 } |
| 514 | 514 |
| 515 TEST(LocalFileSystemCopyOrMoveOperationTest, CopyDirectory) { | 515 TEST(LocalFileSystemCopyOrMoveOperationTest, CopyDirectory) { |
| 516 CopyOrMoveOperationTestHelper helper(GURL("http://foo"), | 516 CopyOrMoveOperationTestHelper helper(GURL("http://foo"), |
| 517 fileapi::kFileSystemTypeTemporary, | 517 storage::kFileSystemTypeTemporary, |
| 518 fileapi::kFileSystemTypePersistent); | 518 storage::kFileSystemTypePersistent); |
| 519 helper.SetUp(); | 519 helper.SetUp(); |
| 520 | 520 |
| 521 FileSystemURL src = helper.SourceURL("a"); | 521 FileSystemURL src = helper.SourceURL("a"); |
| 522 FileSystemURL dest = helper.DestURL("b"); | 522 FileSystemURL dest = helper.DestURL("b"); |
| 523 int64 src_initial_usage = helper.GetSourceUsage(); | 523 int64 src_initial_usage = helper.GetSourceUsage(); |
| 524 int64 dest_initial_usage = helper.GetDestUsage(); | 524 int64 dest_initial_usage = helper.GetDestUsage(); |
| 525 | 525 |
| 526 // Set up a source directory. | 526 // Set up a source directory. |
| 527 ASSERT_EQ(base::File::FILE_OK, helper.CreateDirectory(src)); | 527 ASSERT_EQ(base::File::FILE_OK, helper.CreateDirectory(src)); |
| 528 ASSERT_EQ(base::File::FILE_OK, | 528 ASSERT_EQ(base::File::FILE_OK, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 547 | 547 |
| 548 int64 src_new_usage = helper.GetSourceUsage(); | 548 int64 src_new_usage = helper.GetSourceUsage(); |
| 549 ASSERT_EQ(src_initial_usage + src_increase, src_new_usage); | 549 ASSERT_EQ(src_initial_usage + src_increase, src_new_usage); |
| 550 | 550 |
| 551 int64 dest_increase = helper.GetDestUsage() - dest_initial_usage; | 551 int64 dest_increase = helper.GetDestUsage() - dest_initial_usage; |
| 552 ASSERT_EQ(src_increase, dest_increase); | 552 ASSERT_EQ(src_increase, dest_increase); |
| 553 } | 553 } |
| 554 | 554 |
| 555 TEST(LocalFileSystemCopyOrMoveOperationTest, MoveDirectory) { | 555 TEST(LocalFileSystemCopyOrMoveOperationTest, MoveDirectory) { |
| 556 CopyOrMoveOperationTestHelper helper(GURL("http://foo"), | 556 CopyOrMoveOperationTestHelper helper(GURL("http://foo"), |
| 557 fileapi::kFileSystemTypeTemporary, | 557 storage::kFileSystemTypeTemporary, |
| 558 fileapi::kFileSystemTypePersistent); | 558 storage::kFileSystemTypePersistent); |
| 559 helper.SetUp(); | 559 helper.SetUp(); |
| 560 | 560 |
| 561 FileSystemURL src = helper.SourceURL("a"); | 561 FileSystemURL src = helper.SourceURL("a"); |
| 562 FileSystemURL dest = helper.DestURL("b"); | 562 FileSystemURL dest = helper.DestURL("b"); |
| 563 int64 src_initial_usage = helper.GetSourceUsage(); | 563 int64 src_initial_usage = helper.GetSourceUsage(); |
| 564 int64 dest_initial_usage = helper.GetDestUsage(); | 564 int64 dest_initial_usage = helper.GetDestUsage(); |
| 565 | 565 |
| 566 // Set up a source directory. | 566 // Set up a source directory. |
| 567 ASSERT_EQ(base::File::FILE_OK, helper.CreateDirectory(src)); | 567 ASSERT_EQ(base::File::FILE_OK, helper.CreateDirectory(src)); |
| 568 ASSERT_EQ(base::File::FILE_OK, | 568 ASSERT_EQ(base::File::FILE_OK, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 585 int64 src_new_usage = helper.GetSourceUsage(); | 585 int64 src_new_usage = helper.GetSourceUsage(); |
| 586 ASSERT_EQ(src_initial_usage, src_new_usage); | 586 ASSERT_EQ(src_initial_usage, src_new_usage); |
| 587 | 587 |
| 588 int64 dest_increase = helper.GetDestUsage() - dest_initial_usage; | 588 int64 dest_increase = helper.GetDestUsage() - dest_initial_usage; |
| 589 ASSERT_EQ(src_increase, dest_increase); | 589 ASSERT_EQ(src_increase, dest_increase); |
| 590 } | 590 } |
| 591 | 591 |
| 592 TEST(LocalFileSystemCopyOrMoveOperationTest, | 592 TEST(LocalFileSystemCopyOrMoveOperationTest, |
| 593 MoveDirectoryFailPostWriteValidation) { | 593 MoveDirectoryFailPostWriteValidation) { |
| 594 CopyOrMoveOperationTestHelper helper(GURL("http://foo"), | 594 CopyOrMoveOperationTestHelper helper(GURL("http://foo"), |
| 595 fileapi::kFileSystemTypeTemporary, | 595 storage::kFileSystemTypeTemporary, |
| 596 fileapi::kFileSystemTypeTest); | 596 storage::kFileSystemTypeTest); |
| 597 helper.SetUp(); | 597 helper.SetUp(); |
| 598 | 598 |
| 599 FileSystemURL src = helper.SourceURL("a"); | 599 FileSystemURL src = helper.SourceURL("a"); |
| 600 FileSystemURL dest = helper.DestURL("b"); | 600 FileSystemURL dest = helper.DestURL("b"); |
| 601 | 601 |
| 602 // Set up a source directory. | 602 // Set up a source directory. |
| 603 ASSERT_EQ(base::File::FILE_OK, helper.CreateDirectory(src)); | 603 ASSERT_EQ(base::File::FILE_OK, helper.CreateDirectory(src)); |
| 604 ASSERT_EQ(base::File::FILE_OK, | 604 ASSERT_EQ(base::File::FILE_OK, |
| 605 helper.SetUpTestCaseFiles(src, | 605 helper.SetUpTestCaseFiles(src, |
| 606 kRegularFileSystemTestCases, | 606 kRegularFileSystemTestCases, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 618 {false, FILE_PATH_LITERAL("file 3"), 0}, | 618 {false, FILE_PATH_LITERAL("file 3"), 0}, |
| 619 }; | 619 }; |
| 620 | 620 |
| 621 helper.VerifyTestCaseFiles(dest, | 621 helper.VerifyTestCaseFiles(dest, |
| 622 kMoveDirResultCases, | 622 kMoveDirResultCases, |
| 623 arraysize(kMoveDirResultCases)); | 623 arraysize(kMoveDirResultCases)); |
| 624 } | 624 } |
| 625 | 625 |
| 626 TEST(LocalFileSystemCopyOrMoveOperationTest, CopySingleFileNoValidator) { | 626 TEST(LocalFileSystemCopyOrMoveOperationTest, CopySingleFileNoValidator) { |
| 627 CopyOrMoveOperationTestHelper helper(GURL("http://foo"), | 627 CopyOrMoveOperationTestHelper helper(GURL("http://foo"), |
| 628 fileapi::kFileSystemTypeTemporary, | 628 storage::kFileSystemTypeTemporary, |
| 629 fileapi::kFileSystemTypeTest); | 629 storage::kFileSystemTypeTest); |
| 630 helper.SetUpNoValidator(); | 630 helper.SetUpNoValidator(); |
| 631 | 631 |
| 632 FileSystemURL src = helper.SourceURL("a"); | 632 FileSystemURL src = helper.SourceURL("a"); |
| 633 FileSystemURL dest = helper.DestURL("b"); | 633 FileSystemURL dest = helper.DestURL("b"); |
| 634 | 634 |
| 635 // Set up a source file. | 635 // Set up a source file. |
| 636 ASSERT_EQ(base::File::FILE_OK, helper.CreateFile(src, 10)); | 636 ASSERT_EQ(base::File::FILE_OK, helper.CreateFile(src, 10)); |
| 637 | 637 |
| 638 // The copy attempt should fail with a security error -- getting | 638 // The copy attempt should fail with a security error -- getting |
| 639 // the factory returns a security error, and the copy operation must | 639 // the factory returns a security error, and the copy operation must |
| 640 // respect that. | 640 // respect that. |
| 641 ASSERT_EQ(base::File::FILE_ERROR_SECURITY, helper.Copy(src, dest)); | 641 ASSERT_EQ(base::File::FILE_ERROR_SECURITY, helper.Copy(src, dest)); |
| 642 } | 642 } |
| 643 | 643 |
| 644 TEST(LocalFileSystemCopyOrMoveOperationTest, ProgressCallback) { | 644 TEST(LocalFileSystemCopyOrMoveOperationTest, ProgressCallback) { |
| 645 CopyOrMoveOperationTestHelper helper(GURL("http://foo"), | 645 CopyOrMoveOperationTestHelper helper(GURL("http://foo"), |
| 646 fileapi::kFileSystemTypeTemporary, | 646 storage::kFileSystemTypeTemporary, |
| 647 fileapi::kFileSystemTypePersistent); | 647 storage::kFileSystemTypePersistent); |
| 648 helper.SetUp(); | 648 helper.SetUp(); |
| 649 | 649 |
| 650 FileSystemURL src = helper.SourceURL("a"); | 650 FileSystemURL src = helper.SourceURL("a"); |
| 651 FileSystemURL dest = helper.DestURL("b"); | 651 FileSystemURL dest = helper.DestURL("b"); |
| 652 | 652 |
| 653 // Set up a source directory. | 653 // Set up a source directory. |
| 654 ASSERT_EQ(base::File::FILE_OK, helper.CreateDirectory(src)); | 654 ASSERT_EQ(base::File::FILE_OK, helper.CreateDirectory(src)); |
| 655 ASSERT_EQ(base::File::FILE_OK, | 655 ASSERT_EQ(base::File::FILE_OK, |
| 656 helper.SetUpTestCaseFiles(src, | 656 helper.SetUpTestCaseFiles(src, |
| 657 kRegularFileSystemTestCases, | 657 kRegularFileSystemTestCases, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 | 723 |
| 724 base::MessageLoopForIO message_loop; | 724 base::MessageLoopForIO message_loop; |
| 725 base::Thread file_thread("file_thread"); | 725 base::Thread file_thread("file_thread"); |
| 726 ASSERT_TRUE(file_thread.Start()); | 726 ASSERT_TRUE(file_thread.Start()); |
| 727 ScopedThreadStopper thread_stopper(&file_thread); | 727 ScopedThreadStopper thread_stopper(&file_thread); |
| 728 ASSERT_TRUE(thread_stopper.is_valid()); | 728 ASSERT_TRUE(thread_stopper.is_valid()); |
| 729 | 729 |
| 730 scoped_refptr<base::MessageLoopProxy> task_runner = | 730 scoped_refptr<base::MessageLoopProxy> task_runner = |
| 731 file_thread.message_loop_proxy(); | 731 file_thread.message_loop_proxy(); |
| 732 | 732 |
| 733 scoped_ptr<webkit_blob::FileStreamReader> reader( | 733 scoped_ptr<storage::FileStreamReader> reader( |
| 734 webkit_blob::FileStreamReader::CreateForLocalFile( | 734 storage::FileStreamReader::CreateForLocalFile( |
| 735 task_runner.get(), source_path, 0, base::Time())); | 735 task_runner.get(), source_path, 0, base::Time())); |
| 736 | 736 |
| 737 scoped_ptr<FileStreamWriter> writer(FileStreamWriter::CreateForLocalFile( | 737 scoped_ptr<FileStreamWriter> writer(FileStreamWriter::CreateForLocalFile( |
| 738 task_runner.get(), dest_path, 0, FileStreamWriter::CREATE_NEW_FILE)); | 738 task_runner.get(), dest_path, 0, FileStreamWriter::CREATE_NEW_FILE)); |
| 739 | 739 |
| 740 std::vector<int64> progress; | 740 std::vector<int64> progress; |
| 741 CopyOrMoveOperationDelegate::StreamCopyHelper helper( | 741 CopyOrMoveOperationDelegate::StreamCopyHelper helper( |
| 742 reader.Pass(), writer.Pass(), | 742 reader.Pass(), writer.Pass(), |
| 743 false, // don't need flush | 743 false, // don't need flush |
| 744 10, // buffer size | 744 10, // buffer size |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 | 779 |
| 780 base::MessageLoopForIO message_loop; | 780 base::MessageLoopForIO message_loop; |
| 781 base::Thread file_thread("file_thread"); | 781 base::Thread file_thread("file_thread"); |
| 782 ASSERT_TRUE(file_thread.Start()); | 782 ASSERT_TRUE(file_thread.Start()); |
| 783 ScopedThreadStopper thread_stopper(&file_thread); | 783 ScopedThreadStopper thread_stopper(&file_thread); |
| 784 ASSERT_TRUE(thread_stopper.is_valid()); | 784 ASSERT_TRUE(thread_stopper.is_valid()); |
| 785 | 785 |
| 786 scoped_refptr<base::MessageLoopProxy> task_runner = | 786 scoped_refptr<base::MessageLoopProxy> task_runner = |
| 787 file_thread.message_loop_proxy(); | 787 file_thread.message_loop_proxy(); |
| 788 | 788 |
| 789 scoped_ptr<webkit_blob::FileStreamReader> reader( | 789 scoped_ptr<storage::FileStreamReader> reader( |
| 790 webkit_blob::FileStreamReader::CreateForLocalFile( | 790 storage::FileStreamReader::CreateForLocalFile( |
| 791 task_runner.get(), source_path, 0, base::Time())); | 791 task_runner.get(), source_path, 0, base::Time())); |
| 792 | 792 |
| 793 scoped_ptr<FileStreamWriter> writer(FileStreamWriter::CreateForLocalFile( | 793 scoped_ptr<FileStreamWriter> writer(FileStreamWriter::CreateForLocalFile( |
| 794 task_runner.get(), dest_path, 0, FileStreamWriter::CREATE_NEW_FILE)); | 794 task_runner.get(), dest_path, 0, FileStreamWriter::CREATE_NEW_FILE)); |
| 795 | 795 |
| 796 std::vector<int64> progress; | 796 std::vector<int64> progress; |
| 797 CopyOrMoveOperationDelegate::StreamCopyHelper helper( | 797 CopyOrMoveOperationDelegate::StreamCopyHelper helper( |
| 798 reader.Pass(), writer.Pass(), | 798 reader.Pass(), writer.Pass(), |
| 799 true, // need flush | 799 true, // need flush |
| 800 10, // buffer size | 800 10, // buffer size |
| (...skipping 29 matching lines...) Expand all Loading... |
| 830 | 830 |
| 831 base::MessageLoopForIO message_loop; | 831 base::MessageLoopForIO message_loop; |
| 832 base::Thread file_thread("file_thread"); | 832 base::Thread file_thread("file_thread"); |
| 833 ASSERT_TRUE(file_thread.Start()); | 833 ASSERT_TRUE(file_thread.Start()); |
| 834 ScopedThreadStopper thread_stopper(&file_thread); | 834 ScopedThreadStopper thread_stopper(&file_thread); |
| 835 ASSERT_TRUE(thread_stopper.is_valid()); | 835 ASSERT_TRUE(thread_stopper.is_valid()); |
| 836 | 836 |
| 837 scoped_refptr<base::MessageLoopProxy> task_runner = | 837 scoped_refptr<base::MessageLoopProxy> task_runner = |
| 838 file_thread.message_loop_proxy(); | 838 file_thread.message_loop_proxy(); |
| 839 | 839 |
| 840 scoped_ptr<webkit_blob::FileStreamReader> reader( | 840 scoped_ptr<storage::FileStreamReader> reader( |
| 841 webkit_blob::FileStreamReader::CreateForLocalFile( | 841 storage::FileStreamReader::CreateForLocalFile( |
| 842 task_runner.get(), source_path, 0, base::Time())); | 842 task_runner.get(), source_path, 0, base::Time())); |
| 843 | 843 |
| 844 scoped_ptr<FileStreamWriter> writer(FileStreamWriter::CreateForLocalFile( | 844 scoped_ptr<FileStreamWriter> writer(FileStreamWriter::CreateForLocalFile( |
| 845 task_runner.get(), dest_path, 0, FileStreamWriter::CREATE_NEW_FILE)); | 845 task_runner.get(), dest_path, 0, FileStreamWriter::CREATE_NEW_FILE)); |
| 846 | 846 |
| 847 std::vector<int64> progress; | 847 std::vector<int64> progress; |
| 848 CopyOrMoveOperationDelegate::StreamCopyHelper helper( | 848 CopyOrMoveOperationDelegate::StreamCopyHelper helper( |
| 849 reader.Pass(), writer.Pass(), | 849 reader.Pass(), writer.Pass(), |
| 850 false, // need_flush | 850 false, // need_flush |
| 851 10, // buffer size | 851 10, // buffer size |
| 852 base::Bind(&RecordFileProgressCallback, base::Unretained(&progress)), | 852 base::Bind(&RecordFileProgressCallback, base::Unretained(&progress)), |
| 853 base::TimeDelta()); // For testing, we need all the progress. | 853 base::TimeDelta()); // For testing, we need all the progress. |
| 854 | 854 |
| 855 // Call Cancel() later. | 855 // Call Cancel() later. |
| 856 base::MessageLoopProxy::current()->PostTask( | 856 base::MessageLoopProxy::current()->PostTask( |
| 857 FROM_HERE, | 857 FROM_HERE, |
| 858 base::Bind(&CopyOrMoveOperationDelegate::StreamCopyHelper::Cancel, | 858 base::Bind(&CopyOrMoveOperationDelegate::StreamCopyHelper::Cancel, |
| 859 base::Unretained(&helper))); | 859 base::Unretained(&helper))); |
| 860 | 860 |
| 861 base::File::Error error = base::File::FILE_ERROR_FAILED; | 861 base::File::Error error = base::File::FILE_ERROR_FAILED; |
| 862 base::RunLoop run_loop; | 862 base::RunLoop run_loop; |
| 863 helper.Run(base::Bind(&AssignAndQuit, &run_loop, &error)); | 863 helper.Run(base::Bind(&AssignAndQuit, &run_loop, &error)); |
| 864 run_loop.Run(); | 864 run_loop.Run(); |
| 865 | 865 |
| 866 EXPECT_EQ(base::File::FILE_ERROR_ABORT, error); | 866 EXPECT_EQ(base::File::FILE_ERROR_ABORT, error); |
| 867 } | 867 } |
| 868 | 868 |
| 869 } // namespace content | 869 } // namespace content |
| OLD | NEW |