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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 struct TestFile { | 52 struct TestFile { |
53 bool isDirectory; | 53 bool isDirectory; |
54 const char* name; | 54 const char* name; |
55 int64 size; | 55 int64 size; |
56 const char* origin_url; | 56 const char* origin_url; |
57 quota::StorageType type; | 57 quota::StorageType type; |
58 }; | 58 }; |
59 | 59 |
60 protected: | 60 protected: |
61 FileSystemQuotaClient* NewQuotaClient(bool is_incognito) { | 61 FileSystemQuotaClient* NewQuotaClient(bool is_incognito) { |
62 return new FileSystemQuotaClient( | 62 return new FileSystemQuotaClient(file_system_context_.get(), is_incognito); |
63 file_system_context_, is_incognito); | |
64 } | 63 } |
65 | 64 |
66 void GetOriginUsageAsync(FileSystemQuotaClient* quota_client, | 65 void GetOriginUsageAsync(FileSystemQuotaClient* quota_client, |
67 const std::string& origin_url, | 66 const std::string& origin_url, |
68 quota::StorageType type) { | 67 quota::StorageType type) { |
69 quota_client->GetOriginUsage( | 68 quota_client->GetOriginUsage( |
70 GURL(origin_url), type, | 69 GURL(origin_url), type, |
71 base::Bind(&FileSystemQuotaClientTest::OnGetUsage, | 70 base::Bind(&FileSystemQuotaClientTest::OnGetUsage, |
72 weak_factory_.GetWeakPtr())); | 71 weak_factory_.GetWeakPtr())); |
73 } | 72 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 quota::StorageType type) { | 107 quota::StorageType type) { |
109 quota_client->GetOriginUsage( | 108 quota_client->GetOriginUsage( |
110 GURL(origin_url), type, | 109 GURL(origin_url), type, |
111 base::Bind(&FileSystemQuotaClientTest::OnGetAdditionalUsage, | 110 base::Bind(&FileSystemQuotaClientTest::OnGetAdditionalUsage, |
112 weak_factory_.GetWeakPtr())); | 111 weak_factory_.GetWeakPtr())); |
113 } | 112 } |
114 | 113 |
115 FileSystemOperationContext* CreateFileSystemOperationContext( | 114 FileSystemOperationContext* CreateFileSystemOperationContext( |
116 FileSystemType type) { | 115 FileSystemType type) { |
117 FileSystemOperationContext* context = | 116 FileSystemOperationContext* context = |
118 new FileSystemOperationContext(file_system_context_); | 117 new FileSystemOperationContext(file_system_context_.get()); |
119 context->set_allowed_bytes_growth(100000000); | 118 context->set_allowed_bytes_growth(100000000); |
120 context->set_update_observers( | 119 context->set_update_observers( |
121 *file_system_context_->GetUpdateObservers(type)); | 120 *file_system_context_->GetUpdateObservers(type)); |
122 return context; | 121 return context; |
123 } | 122 } |
124 | 123 |
125 bool CreateFileSystemDirectory(const base::FilePath& file_path, | 124 bool CreateFileSystemDirectory(const base::FilePath& file_path, |
126 const std::string& origin_url, | 125 const std::string& origin_url, |
127 quota::StorageType storage_type) { | 126 quota::StorageType storage_type) { |
128 FileSystemType type = QuotaStorageTypeToFileSystemType(storage_type); | 127 FileSystemType type = QuotaStorageTypeToFileSystemType(storage_type); |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 GetOriginUsage(quota_client.get(), | 575 GetOriginUsage(quota_client.get(), |
577 "https://bar.com/", | 576 "https://bar.com/", |
578 kPersistent)); | 577 kPersistent)); |
579 EXPECT_EQ(64 + file_paths_cost_temporary_bar_https, | 578 EXPECT_EQ(64 + file_paths_cost_temporary_bar_https, |
580 GetOriginUsage(quota_client.get(), | 579 GetOriginUsage(quota_client.get(), |
581 "https://bar.com/", | 580 "https://bar.com/", |
582 kTemporary)); | 581 kTemporary)); |
583 } | 582 } |
584 | 583 |
585 } // namespace fileapi | 584 } // namespace fileapi |
OLD | NEW |