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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 int additional_callback_count() const { return additional_callback_count_; } | 227 int additional_callback_count() const { return additional_callback_count_; } |
228 void set_additional_callback_count(int count) { | 228 void set_additional_callback_count(int count) { |
229 additional_callback_count_ = count; | 229 additional_callback_count_ = count; |
230 } | 230 } |
231 | 231 |
232 private: | 232 private: |
233 void OnGetUsage(int64 usage) { | 233 void OnGetUsage(int64 usage) { |
234 usage_ = usage; | 234 usage_ = usage; |
235 } | 235 } |
236 | 236 |
237 void OnGetOrigins(const std::set<GURL>& origins, | 237 void OnGetOrigins(const std::set<GURL>& origins) { |
238 quota::StorageType type) { | |
239 origins_ = origins; | 238 origins_ = origins; |
240 type_ = type; | |
241 } | 239 } |
242 | 240 |
243 void OnGetAdditionalUsage(int64 usage_unused) { | 241 void OnGetAdditionalUsage(int64 usage_unused) { |
244 ++additional_callback_count_; | 242 ++additional_callback_count_; |
245 } | 243 } |
246 | 244 |
247 void OnDeleteOrigin(quota::QuotaStatusCode status) { | 245 void OnDeleteOrigin(quota::QuotaStatusCode status) { |
248 deletion_status_ = status; | 246 deletion_status_ = status; |
249 } | 247 } |
250 | 248 |
251 base::ScopedTempDir data_dir_; | 249 base::ScopedTempDir data_dir_; |
252 base::MessageLoop message_loop_; | 250 base::MessageLoop message_loop_; |
253 scoped_refptr<FileSystemContext> file_system_context_; | 251 scoped_refptr<FileSystemContext> file_system_context_; |
254 base::WeakPtrFactory<FileSystemQuotaClientTest> weak_factory_; | 252 base::WeakPtrFactory<FileSystemQuotaClientTest> weak_factory_; |
255 int64 usage_; | 253 int64 usage_; |
256 int additional_callback_count_; | 254 int additional_callback_count_; |
257 std::set<GURL> origins_; | 255 std::set<GURL> origins_; |
258 quota::StorageType type_; | |
259 quota::QuotaStatusCode deletion_status_; | 256 quota::QuotaStatusCode deletion_status_; |
260 | 257 |
261 DISALLOW_COPY_AND_ASSIGN(FileSystemQuotaClientTest); | 258 DISALLOW_COPY_AND_ASSIGN(FileSystemQuotaClientTest); |
262 }; | 259 }; |
263 | 260 |
264 TEST_F(FileSystemQuotaClientTest, NoFileSystemTest) { | 261 TEST_F(FileSystemQuotaClientTest, NoFileSystemTest) { |
265 scoped_ptr<FileSystemQuotaClient> quota_client(NewQuotaClient(false)); | 262 scoped_ptr<FileSystemQuotaClient> quota_client(NewQuotaClient(false)); |
266 | 263 |
267 EXPECT_EQ(0, GetOriginUsage(quota_client.get(), kDummyURL1, kTemporary)); | 264 EXPECT_EQ(0, GetOriginUsage(quota_client.get(), kDummyURL1, kTemporary)); |
268 } | 265 } |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 GetOriginUsage(quota_client.get(), | 576 GetOriginUsage(quota_client.get(), |
580 "https://bar.com/", | 577 "https://bar.com/", |
581 kPersistent)); | 578 kPersistent)); |
582 EXPECT_EQ(64 + file_paths_cost_temporary_bar_https, | 579 EXPECT_EQ(64 + file_paths_cost_temporary_bar_https, |
583 GetOriginUsage(quota_client.get(), | 580 GetOriginUsage(quota_client.get(), |
584 "https://bar.com/", | 581 "https://bar.com/", |
585 kTemporary)); | 582 kTemporary)); |
586 } | 583 } |
587 | 584 |
588 } // namespace fileapi | 585 } // namespace fileapi |
OLD | NEW |