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_
11 #include "googleurl/src/gurl.h"
12 #include "webkit/quota/special_storage_policy.h"
16 class MockSpecialStoragePolicy
: public quota::SpecialStoragePolicy
{
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
;
56 session_only_
.clear();
58 file_handlers_
.clear();
59 all_unlimited_
= false;
62 void NotifyChanged() {
63 SpecialStoragePolicy::NotifyObservers();
67 virtual ~MockSpecialStoragePolicy();
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_
;
80 #endif // WEBKIT_QUOTA_MOCK_SPECIAL_STORAGE_POLICY_H_