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 <algorithm> | 5 #include <algorithm> |
6 #include <set> | 6 #include <set> |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 | 590 |
591 int64 ComputeCurrentUsage() { | 591 int64 ComputeCurrentUsage() { |
592 return test_helper().ComputeCurrentOriginUsage() - | 592 return test_helper().ComputeCurrentOriginUsage() - |
593 test_helper().ComputeCurrentDirectoryDatabaseUsage(); | 593 test_helper().ComputeCurrentDirectoryDatabaseUsage(); |
594 } | 594 } |
595 | 595 |
596 const FileSystemTestOriginHelper& test_helper() const { return test_helper_; } | 596 const FileSystemTestOriginHelper& test_helper() const { return test_helper_; } |
597 | 597 |
598 private: | 598 private: |
599 ScopedTempDir data_dir_; | 599 ScopedTempDir data_dir_; |
| 600 MessageLoop message_loop_; |
600 ObfuscatedFileUtil* obfuscated_file_util_; | 601 ObfuscatedFileUtil* obfuscated_file_util_; |
601 scoped_refptr<quota::QuotaManager> quota_manager_; | 602 scoped_refptr<quota::QuotaManager> quota_manager_; |
602 scoped_refptr<FileSystemContext> file_system_context_; | 603 scoped_refptr<FileSystemContext> file_system_context_; |
603 GURL origin_; | 604 GURL origin_; |
604 fileapi::FileSystemType type_; | 605 fileapi::FileSystemType type_; |
605 base::WeakPtrFactory<ObfuscatedFileUtilTest> weak_factory_; | 606 base::WeakPtrFactory<ObfuscatedFileUtilTest> weak_factory_; |
606 FileSystemTestOriginHelper test_helper_; | 607 FileSystemTestOriginHelper test_helper_; |
607 quota::QuotaStatusCode quota_status_; | 608 quota::QuotaStatusCode quota_status_; |
608 int64 usage_; | 609 int64 usage_; |
609 | 610 |
(...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2187 | 2188 |
2188 // Opening it with TRUNCATED flag, which should truncate the file size. | 2189 // Opening it with TRUNCATED flag, which should truncate the file size. |
2189 ASSERT_EQ(base::PLATFORM_FILE_OK, | 2190 ASSERT_EQ(base::PLATFORM_FILE_OK, |
2190 ofu()->CreateOrOpen( | 2191 ofu()->CreateOrOpen( |
2191 AllowUsageIncrease(-length)->context(), file, | 2192 AllowUsageIncrease(-length)->context(), file, |
2192 base::PLATFORM_FILE_OPEN_TRUNCATED | base::PLATFORM_FILE_WRITE, | 2193 base::PLATFORM_FILE_OPEN_TRUNCATED | base::PLATFORM_FILE_WRITE, |
2193 &file_handle, &created)); | 2194 &file_handle, &created)); |
2194 ASSERT_EQ(0, ComputeTotalFileSize()); | 2195 ASSERT_EQ(0, ComputeTotalFileSize()); |
2195 EXPECT_TRUE(base::ClosePlatformFile(file_handle)); | 2196 EXPECT_TRUE(base::ClosePlatformFile(file_handle)); |
2196 } | 2197 } |
OLD | NEW |