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_context.h" | 5 #include "webkit/fileapi/file_system_context.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 class TestSpecialStoragePolicy : public quota::SpecialStoragePolicy { | 27 class TestSpecialStoragePolicy : public quota::SpecialStoragePolicy { |
28 public: | 28 public: |
29 virtual bool IsStorageProtected(const GURL& origin) { | 29 virtual bool IsStorageProtected(const GURL& origin) { |
30 return false; | 30 return false; |
31 } | 31 } |
32 | 32 |
33 virtual bool IsStorageUnlimited(const GURL& origin) { | 33 virtual bool IsStorageUnlimited(const GURL& origin) { |
34 return origin == GURL(kTestOrigins[1]); | 34 return origin == GURL(kTestOrigins[1]); |
35 } | 35 } |
36 | 36 |
37 virtual bool IsLocalFileSystemAccessAllowed(const GURL& origin) { | 37 virtual bool IsLocalFileSystemAccessAllowed(const GURL& origin, |
| 38 const FilePath& virtual_path) { |
38 return false; | 39 return false; |
39 } | 40 } |
| 41 |
| 42 virtual void GrantLocalFileSystemAccess(const GURL& origin, |
| 43 const FilePath& virtual_path) { |
| 44 } |
40 }; | 45 }; |
41 | 46 |
42 scoped_refptr<FileSystemContext> NewFileSystemContext( | 47 scoped_refptr<FileSystemContext> NewFileSystemContext( |
43 bool allow_file_access, | 48 bool allow_file_access, |
44 bool unlimited_quota, | 49 bool unlimited_quota, |
45 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy) { | 50 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy) { |
46 return new FileSystemContext(base::MessageLoopProxy::CreateForCurrentThread(), | 51 return new FileSystemContext(base::MessageLoopProxy::CreateForCurrentThread(), |
47 base::MessageLoopProxy::CreateForCurrentThread(), | 52 base::MessageLoopProxy::CreateForCurrentThread(), |
48 special_storage_policy, | 53 special_storage_policy, |
49 FilePath(), false /* is_incognito */, | 54 FilePath(), false /* is_incognito */, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 scoped_refptr<TestSpecialStoragePolicy> policy(new TestSpecialStoragePolicy); | 88 scoped_refptr<TestSpecialStoragePolicy> policy(new TestSpecialStoragePolicy); |
84 context = NewFileSystemContext(false, false, policy); | 89 context = NewFileSystemContext(false, false, policy); |
85 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestOrigins); ++i) { | 90 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestOrigins); ++i) { |
86 SCOPED_TRACE(testing::Message() << "IsStorageUnlimited /w policy #" | 91 SCOPED_TRACE(testing::Message() << "IsStorageUnlimited /w policy #" |
87 << i << " " << kTestOrigins[i]); | 92 << i << " " << kTestOrigins[i]); |
88 GURL origin(kTestOrigins[i]); | 93 GURL origin(kTestOrigins[i]); |
89 EXPECT_EQ(policy->IsStorageUnlimited(origin), | 94 EXPECT_EQ(policy->IsStorageUnlimited(origin), |
90 context->IsStorageUnlimited(origin)); | 95 context->IsStorageUnlimited(origin)); |
91 } | 96 } |
92 } | 97 } |
OLD | NEW |