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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/basictypes.h" | 6 #include "base/basictypes.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 bool isDirectory; | 58 bool isDirectory; |
59 const char* name; | 59 const char* name; |
60 int64 size; | 60 int64 size; |
61 const char* origin_url; | 61 const char* origin_url; |
62 quota::StorageType type; | 62 quota::StorageType type; |
63 }; | 63 }; |
64 | 64 |
65 protected: | 65 protected: |
66 FileSystemQuotaClient* NewQuotaClient(bool is_incognito) { | 66 FileSystemQuotaClient* NewQuotaClient(bool is_incognito) { |
67 return new FileSystemQuotaClient( | 67 return new FileSystemQuotaClient( |
68 file_system_context_, is_incognito); | 68 file_system_context_.get(), is_incognito); |
69 } | 69 } |
70 | 70 |
71 void GetOriginUsageAsync(FileSystemQuotaClient* quota_client, | 71 void GetOriginUsageAsync(FileSystemQuotaClient* quota_client, |
72 const std::string& origin_url, | 72 const std::string& origin_url, |
73 quota::StorageType type) { | 73 quota::StorageType type) { |
74 quota_client->GetOriginUsage( | 74 quota_client->GetOriginUsage( |
75 GURL(origin_url), type, | 75 GURL(origin_url), type, |
76 base::Bind(&FileSystemQuotaClientTest::OnGetUsage, | 76 base::Bind(&FileSystemQuotaClientTest::OnGetUsage, |
77 weak_factory_.GetWeakPtr())); | 77 weak_factory_.GetWeakPtr())); |
78 } | 78 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 quota::StorageType type) { | 113 quota::StorageType type) { |
114 quota_client->GetOriginUsage( | 114 quota_client->GetOriginUsage( |
115 GURL(origin_url), type, | 115 GURL(origin_url), type, |
116 base::Bind(&FileSystemQuotaClientTest::OnGetAdditionalUsage, | 116 base::Bind(&FileSystemQuotaClientTest::OnGetAdditionalUsage, |
117 weak_factory_.GetWeakPtr())); | 117 weak_factory_.GetWeakPtr())); |
118 } | 118 } |
119 | 119 |
120 FileSystemOperationContext* CreateFileSystemOperationContext( | 120 FileSystemOperationContext* CreateFileSystemOperationContext( |
121 FileSystemType type) { | 121 FileSystemType type) { |
122 FileSystemOperationContext* context = | 122 FileSystemOperationContext* context = |
123 new FileSystemOperationContext(file_system_context_); | 123 new FileSystemOperationContext(file_system_context_.get()); |
124 context->set_allowed_bytes_growth(100000000); | 124 context->set_allowed_bytes_growth(100000000); |
125 context->set_update_observers( | 125 context->set_update_observers( |
126 *file_system_context_->GetUpdateObservers(type)); | 126 *file_system_context_->GetUpdateObservers(type)); |
127 return context; | 127 return context; |
128 } | 128 } |
129 | 129 |
130 bool CreateFileSystemDirectory(const FilePath& file_path, | 130 bool CreateFileSystemDirectory(const FilePath& file_path, |
131 const std::string& origin_url, | 131 const std::string& origin_url, |
132 quota::StorageType storage_type) { | 132 quota::StorageType storage_type) { |
133 FileSystemType type = QuotaStorageTypeToFileSystemType(storage_type); | 133 FileSystemType type = QuotaStorageTypeToFileSystemType(storage_type); |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 GetOriginUsage(quota_client.get(), | 582 GetOriginUsage(quota_client.get(), |
583 "https://bar.com/", | 583 "https://bar.com/", |
584 kPersistent)); | 584 kPersistent)); |
585 EXPECT_EQ(64 + file_paths_cost_temporary_bar_https, | 585 EXPECT_EQ(64 + file_paths_cost_temporary_bar_https, |
586 GetOriginUsage(quota_client.get(), | 586 GetOriginUsage(quota_client.get(), |
587 "https://bar.com/", | 587 "https://bar.com/", |
588 kTemporary)); | 588 kTemporary)); |
589 } | 589 } |
590 | 590 |
591 } // namespace fileapi | 591 } // namespace fileapi |
OLD | NEW |