Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: webkit/quota/mock_special_storage_policy.h

Issue 16010007: Move webkit/quota files to webkit/browser/quota or webkit/common/quota (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef WEBKIT_QUOTA_MOCK_SPECIAL_STORAGE_POLICY_H_
6 #define WEBKIT_QUOTA_MOCK_SPECIAL_STORAGE_POLICY_H_
7
8 #include <set>
9 #include <string>
10
11 #include "googleurl/src/gurl.h"
12 #include "webkit/quota/special_storage_policy.h"
13
14 namespace quota {
15
16 class MockSpecialStoragePolicy : public quota::SpecialStoragePolicy {
17 public:
18 MockSpecialStoragePolicy();
19
20 virtual bool IsStorageProtected(const GURL& origin) OVERRIDE;
21 virtual bool IsStorageUnlimited(const GURL& origin) OVERRIDE;
22 virtual bool IsStorageSessionOnly(const GURL& origin) OVERRIDE;
23 virtual bool CanQueryDiskSize(const GURL& origin) OVERRIDE;
24 virtual bool IsFileHandler(const std::string& extension_id) OVERRIDE;
25 virtual bool HasSessionOnlyOrigins() OVERRIDE;
26
27 void AddProtected(const GURL& origin) {
28 protected_.insert(origin);
29 }
30
31 void AddUnlimited(const GURL& origin) {
32 unlimited_.insert(origin);
33 }
34
35 void RemoveUnlimited(const GURL& origin) {
36 unlimited_.erase(origin);
37 }
38
39 void AddSessionOnly(const GURL& origin) {
40 session_only_.insert(origin);
41 }
42
43 void GrantQueryDiskSize(const GURL& origin) {
44 can_query_disk_size_.insert(origin);
45 }
46
47 void AddFileHandler(const std::string& id) {
48 file_handlers_.insert(id);
49 }
50
51 void SetAllUnlimited(bool all_unlimited) {
52 all_unlimited_ = all_unlimited;
53 }
54
55 void Reset() {
56 protected_.clear();
57 unlimited_.clear();
58 session_only_.clear();
59 can_query_disk_size_.clear();
60 file_handlers_.clear();
61 all_unlimited_ = false;
62 }
63
64 void NotifyGranted(const GURL& origin, int change_flags) {
65 SpecialStoragePolicy::NotifyGranted(origin, change_flags);
66 }
67
68 void NotifyRevoked(const GURL& origin, int change_flags) {
69 SpecialStoragePolicy::NotifyRevoked(origin, change_flags);
70 }
71
72 void NotifyCleared() {
73 SpecialStoragePolicy::NotifyCleared();
74 }
75
76 protected:
77 virtual ~MockSpecialStoragePolicy();
78
79 private:
80 std::set<GURL> protected_;
81 std::set<GURL> unlimited_;
82 std::set<GURL> session_only_;
83 std::set<GURL> can_query_disk_size_;
84 std::set<std::string> file_handlers_;
85
86 bool all_unlimited_;
87 };
88 } // namespace quota
89
90 #endif // WEBKIT_QUOTA_MOCK_SPECIAL_STORAGE_POLICY_H_
OLDNEW
« no previous file with comments | « webkit/quota/mock_quota_manager_unittest.cc ('k') | webkit/quota/mock_special_storage_policy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698