| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/memory/scoped_callback_factory.h" | 7 #include "base/memory/scoped_callback_factory.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
| 10 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 int additional_callback_count() const { return additional_callback_count_; } | 239 int additional_callback_count() const { return additional_callback_count_; } |
| 240 void set_additional_callback_count(int count) { | 240 void set_additional_callback_count(int count) { |
| 241 additional_callback_count_ = count; | 241 additional_callback_count_ = count; |
| 242 } | 242 } |
| 243 | 243 |
| 244 private: | 244 private: |
| 245 void OnGetUsage(int64 usage) { | 245 void OnGetUsage(int64 usage) { |
| 246 usage_ = usage; | 246 usage_ = usage; |
| 247 } | 247 } |
| 248 | 248 |
| 249 void OnGetOrigins(const std::set<GURL>& origins) { | 249 void OnGetOrigins(const std::set<GURL>& origins, |
| 250 quota::StorageType type) { |
| 250 origins_ = origins; | 251 origins_ = origins; |
| 252 type_ = type; |
| 251 } | 253 } |
| 252 | 254 |
| 253 void OnGetAdditionalUsage(int64 usage_unused) { | 255 void OnGetAdditionalUsage(int64 usage_unused) { |
| 254 ++additional_callback_count_; | 256 ++additional_callback_count_; |
| 255 } | 257 } |
| 256 | 258 |
| 257 void OnDeleteOrigin(quota::QuotaStatusCode status) { | 259 void OnDeleteOrigin(quota::QuotaStatusCode status) { |
| 258 deletion_status_ = status; | 260 deletion_status_ = status; |
| 259 } | 261 } |
| 260 | 262 |
| 261 ScopedTempDir data_dir_; | 263 ScopedTempDir data_dir_; |
| 262 scoped_refptr<FileSystemContext> file_system_context_; | 264 scoped_refptr<FileSystemContext> file_system_context_; |
| 263 base::ScopedCallbackFactory<FileSystemQuotaClientTest> callback_factory_; | 265 base::ScopedCallbackFactory<FileSystemQuotaClientTest> callback_factory_; |
| 264 int64 usage_; | 266 int64 usage_; |
| 265 int additional_callback_count_; | 267 int additional_callback_count_; |
| 266 std::set<GURL> origins_; | 268 std::set<GURL> origins_; |
| 269 quota::StorageType type_; |
| 267 quota::QuotaStatusCode deletion_status_; | 270 quota::QuotaStatusCode deletion_status_; |
| 268 | 271 |
| 269 DISALLOW_COPY_AND_ASSIGN(FileSystemQuotaClientTest); | 272 DISALLOW_COPY_AND_ASSIGN(FileSystemQuotaClientTest); |
| 270 }; | 273 }; |
| 271 | 274 |
| 272 TEST_F(FileSystemQuotaClientTest, NoFileSystemTest) { | 275 TEST_F(FileSystemQuotaClientTest, NoFileSystemTest) { |
| 273 scoped_ptr<FileSystemQuotaClient> quota_client(NewQuotaClient(false)); | 276 scoped_ptr<FileSystemQuotaClient> quota_client(NewQuotaClient(false)); |
| 274 | 277 |
| 275 EXPECT_EQ(0, GetOriginUsage(quota_client.get(), kDummyURL1, kTemporary)); | 278 EXPECT_EQ(0, GetOriginUsage(quota_client.get(), kDummyURL1, kTemporary)); |
| 276 } | 279 } |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 GetOriginUsage(quota_client.get(), | 591 GetOriginUsage(quota_client.get(), |
| 589 "https://bar.com/", | 592 "https://bar.com/", |
| 590 kPersistent)); | 593 kPersistent)); |
| 591 EXPECT_EQ(64 + file_paths_cost_temporary_bar_https, | 594 EXPECT_EQ(64 + file_paths_cost_temporary_bar_https, |
| 592 GetOriginUsage(quota_client.get(), | 595 GetOriginUsage(quota_client.get(), |
| 593 "https://bar.com/", | 596 "https://bar.com/", |
| 594 kTemporary)); | 597 kTemporary)); |
| 595 } | 598 } |
| 596 | 599 |
| 597 } // namespace fileapi | 600 } // namespace fileapi |
| OLD | NEW |