| OLD | NEW |
| 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" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 namespace { | 33 namespace { |
| 34 | 34 |
| 35 const int kFileOperationStatusNotSet = 1; | 35 const int kFileOperationStatusNotSet = 1; |
| 36 | 36 |
| 37 class MockQuotaManager : public QuotaManager { | 37 class MockQuotaManager : public QuotaManager { |
| 38 public: | 38 public: |
| 39 MockQuotaManager(const FilePath& base_dir, | 39 MockQuotaManager(const FilePath& base_dir, |
| 40 const GURL& origin, | 40 const GURL& origin, |
| 41 StorageType type) | 41 StorageType type) |
| 42 : QuotaManager(false /* is_incognito */, base_dir, | 42 : QuotaManager(false /* is_incognito */, base_dir, |
| 43 base::MessageLoopProxy::CreateForCurrentThread(), | 43 base::MessageLoopProxy::current(), |
| 44 base::MessageLoopProxy::CreateForCurrentThread(), | 44 base::MessageLoopProxy::current(), |
| 45 NULL), | 45 NULL), |
| 46 origin_(origin), | 46 origin_(origin), |
| 47 type_(type), | 47 type_(type), |
| 48 usage_(0), | 48 usage_(0), |
| 49 quota_(QuotaFileUtil::kNoLimit), | 49 quota_(QuotaFileUtil::kNoLimit), |
| 50 accessed_(0) {} | 50 accessed_(0) {} |
| 51 | 51 |
| 52 virtual void GetUsageAndQuota( | 52 virtual void GetUsageAndQuota( |
| 53 const GURL& origin, quota::StorageType type, | 53 const GURL& origin, quota::StorageType type, |
| 54 GetUsageAndQuotaCallback* callback) { | 54 GetUsageAndQuotaCallback* callback) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 82 const StorageType type_; | 82 const StorageType type_; |
| 83 int64 usage_; | 83 int64 usage_; |
| 84 int64 quota_; | 84 int64 quota_; |
| 85 int accessed_; | 85 int accessed_; |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 class MockQuotaManagerProxy : public QuotaManagerProxy { | 88 class MockQuotaManagerProxy : public QuotaManagerProxy { |
| 89 public: | 89 public: |
| 90 explicit MockQuotaManagerProxy(QuotaManager* quota_manager) | 90 explicit MockQuotaManagerProxy(QuotaManager* quota_manager) |
| 91 : QuotaManagerProxy(quota_manager, | 91 : QuotaManagerProxy(quota_manager, |
| 92 base::MessageLoopProxy::CreateForCurrentThread()), | 92 base::MessageLoopProxy::current()), |
| 93 registered_client_(NULL) { | 93 registered_client_(NULL) { |
| 94 } | 94 } |
| 95 | 95 |
| 96 virtual ~MockQuotaManagerProxy() { | 96 virtual ~MockQuotaManagerProxy() { |
| 97 EXPECT_FALSE(registered_client_); | 97 EXPECT_FALSE(registered_client_); |
| 98 } | 98 } |
| 99 | 99 |
| 100 virtual void RegisterClient(QuotaClient* client) { | 100 virtual void RegisterClient(QuotaClient* client) { |
| 101 EXPECT_FALSE(registered_client_); | 101 EXPECT_FALSE(registered_client_); |
| 102 registered_client_ = client; | 102 registered_client_ = client; |
| (...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 | 950 |
| 951 operation()->Truncate(URLForPath(file_path), 11); | 951 operation()->Truncate(URLForPath(file_path), 11); |
| 952 MessageLoop::current()->RunAllPending(); | 952 MessageLoop::current()->RunAllPending(); |
| 953 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, status()); | 953 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, status()); |
| 954 | 954 |
| 955 EXPECT_TRUE(file_util::GetFileInfo(PlatformPath(file_path), &info)); | 955 EXPECT_TRUE(file_util::GetFileInfo(PlatformPath(file_path), &info)); |
| 956 EXPECT_EQ(10, info.size); | 956 EXPECT_EQ(10, info.size); |
| 957 } | 957 } |
| 958 | 958 |
| 959 } // namespace fileapi | 959 } // namespace fileapi |
| OLD | NEW |