OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CONTENT_PUBLIC_TEST_MOCK_SPECIAL_STORAGE_POLICY_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_MOCK_SPECIAL_STORAGE_POLICY_H_ |
6 #define CONTENT_PUBLIC_TEST_MOCK_SPECIAL_STORAGE_POLICY_H_ | 6 #define CONTENT_PUBLIC_TEST_MOCK_SPECIAL_STORAGE_POLICY_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "storage/browser/quota/special_storage_policy.h" | 11 #include "storage/browser/quota/special_storage_policy.h" |
12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
13 | 13 |
14 using storage::SpecialStoragePolicy; | 14 using storage::SpecialStoragePolicy; |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
18 class MockSpecialStoragePolicy : public storage::SpecialStoragePolicy { | 18 class MockSpecialStoragePolicy : public storage::SpecialStoragePolicy { |
19 public: | 19 public: |
20 MockSpecialStoragePolicy(); | 20 MockSpecialStoragePolicy(); |
21 | 21 |
22 bool IsStorageProtected(const GURL& origin) override; | 22 bool IsStorageProtected(const GURL& origin) override; |
23 bool IsStorageUnlimited(const GURL& origin) override; | 23 bool IsStorageUnlimited(const GURL& origin) override; |
24 bool IsStorageSessionOnly(const GURL& origin) override; | 24 bool IsStorageSessionOnly(const GURL& origin) override; |
25 bool CanQueryDiskSize(const GURL& origin) override; | 25 bool CanQueryDiskSize(const GURL& origin) override; |
26 bool IsFileHandler(const std::string& extension_id) override; | |
27 bool HasIsolatedStorage(const GURL& origin) override; | 26 bool HasIsolatedStorage(const GURL& origin) override; |
28 bool HasSessionOnlyOrigins() override; | 27 bool HasSessionOnlyOrigins() override; |
29 | 28 |
30 void AddProtected(const GURL& origin) { | 29 void AddProtected(const GURL& origin) { |
31 protected_.insert(origin); | 30 protected_.insert(origin); |
32 } | 31 } |
33 | 32 |
34 void AddUnlimited(const GURL& origin) { | 33 void AddUnlimited(const GURL& origin) { |
35 unlimited_.insert(origin); | 34 unlimited_.insert(origin); |
36 } | 35 } |
37 | 36 |
38 void RemoveUnlimited(const GURL& origin) { | 37 void RemoveUnlimited(const GURL& origin) { |
39 unlimited_.erase(origin); | 38 unlimited_.erase(origin); |
40 } | 39 } |
41 | 40 |
42 void AddSessionOnly(const GURL& origin) { | 41 void AddSessionOnly(const GURL& origin) { |
43 session_only_.insert(origin); | 42 session_only_.insert(origin); |
44 } | 43 } |
45 | 44 |
46 void GrantQueryDiskSize(const GURL& origin) { | 45 void GrantQueryDiskSize(const GURL& origin) { |
47 can_query_disk_size_.insert(origin); | 46 can_query_disk_size_.insert(origin); |
48 } | 47 } |
49 | 48 |
50 void AddFileHandler(const std::string& id) { | |
51 file_handlers_.insert(id); | |
52 } | |
53 | |
54 void AddIsolated(const GURL& origin) { | 49 void AddIsolated(const GURL& origin) { |
55 isolated_.insert(origin); | 50 isolated_.insert(origin); |
56 } | 51 } |
57 | 52 |
58 void RemoveIsolated(const GURL& origin) { | 53 void RemoveIsolated(const GURL& origin) { |
59 isolated_.erase(origin); | 54 isolated_.erase(origin); |
60 } | 55 } |
61 | 56 |
62 void SetAllUnlimited(bool all_unlimited) { | 57 void SetAllUnlimited(bool all_unlimited) { |
63 all_unlimited_ = all_unlimited; | 58 all_unlimited_ = all_unlimited; |
(...skipping 30 matching lines...) Expand all Loading... |
94 std::set<GURL> session_only_; | 89 std::set<GURL> session_only_; |
95 std::set<GURL> can_query_disk_size_; | 90 std::set<GURL> can_query_disk_size_; |
96 std::set<GURL> isolated_; | 91 std::set<GURL> isolated_; |
97 std::set<std::string> file_handlers_; | 92 std::set<std::string> file_handlers_; |
98 | 93 |
99 bool all_unlimited_; | 94 bool all_unlimited_; |
100 }; | 95 }; |
101 } // namespace content | 96 } // namespace content |
102 | 97 |
103 #endif // CONTENT_PUBLIC_TEST_MOCK_SPECIAL_STORAGE_POLICY_H_ | 98 #endif // CONTENT_PUBLIC_TEST_MOCK_SPECIAL_STORAGE_POLICY_H_ |
OLD | NEW |