Revert "Merged all Chromoting Host code into remoting_core.dll (Windows)."
[chromium-blink-merge.git] / webkit / quota / mock_special_storage_policy.h
blobb4dac276e2bce23f4f5990f55180315eb0b07636
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.
5 #ifndef WEBKIT_QUOTA_MOCK_SPECIAL_STORAGE_POLICY_H_
6 #define WEBKIT_QUOTA_MOCK_SPECIAL_STORAGE_POLICY_H_
8 #include <set>
9 #include <string>
11 #include "googleurl/src/gurl.h"
12 #include "webkit/quota/special_storage_policy.h"
14 namespace quota {
16 class MockSpecialStoragePolicy : public quota::SpecialStoragePolicy {
17 public:
18 MockSpecialStoragePolicy();
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 IsInstalledApp(const GURL& origin) OVERRIDE;
24 virtual bool IsFileHandler(const std::string& extension_id) OVERRIDE;
25 virtual bool HasSessionOnlyOrigins() OVERRIDE;
27 void AddProtected(const GURL& origin) {
28 protected_.insert(origin);
31 void AddUnlimited(const GURL& origin) {
32 unlimited_.insert(origin);
35 void AddSessionOnly(const GURL& origin) {
36 session_only_.insert(origin);
39 void AddInstalledApp(const GURL& origin) {
40 // Installed implies unlimited.
41 unlimited_.insert(origin);
42 installed_.insert(origin);
45 void AddFileHandler(const std::string& id) {
46 file_handlers_.insert(id);
49 void SetAllUnlimited(bool all_unlimited) {
50 all_unlimited_ = all_unlimited;
53 void Reset() {
54 protected_.clear();
55 unlimited_.clear();
56 session_only_.clear();
57 installed_.clear();
58 file_handlers_.clear();
59 all_unlimited_ = false;
62 void NotifyChanged() {
63 SpecialStoragePolicy::NotifyObservers();
66 protected:
67 virtual ~MockSpecialStoragePolicy();
69 private:
70 std::set<GURL> protected_;
71 std::set<GURL> unlimited_;
72 std::set<GURL> session_only_;
73 std::set<GURL> installed_;
74 std::set<std::string> file_handlers_;
76 bool all_unlimited_;
78 } // namespace quota
80 #endif // WEBKIT_QUOTA_MOCK_SPECIAL_STORAGE_POLICY_H_