Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / public / test / mock_special_storage_policy.cc
blobff3c6c44be160d8638d2167d96a8b2d2aae25c7e
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
3 // found in the LICENSE file.
5 #include "content/public/test/mock_special_storage_policy.h"
7 #include "base/stl_util.h"
9 namespace content {
11 MockSpecialStoragePolicy::MockSpecialStoragePolicy()
12 : all_unlimited_(false) {
15 bool MockSpecialStoragePolicy::IsStorageProtected(const GURL& origin) {
16 return ContainsKey(protected_, origin);
19 bool MockSpecialStoragePolicy::IsStorageUnlimited(const GURL& origin) {
20 if (all_unlimited_)
21 return true;
22 return ContainsKey(unlimited_, origin);
25 bool MockSpecialStoragePolicy::IsStorageSessionOnly(const GURL& origin) {
26 return ContainsKey(session_only_, origin);
29 bool MockSpecialStoragePolicy::CanQueryDiskSize(const GURL& origin) {
30 return ContainsKey(can_query_disk_size_, origin);
33 bool MockSpecialStoragePolicy::HasIsolatedStorage(const GURL& origin) {
34 return ContainsKey(isolated_, origin);
37 bool MockSpecialStoragePolicy::HasSessionOnlyOrigins() {
38 return !session_only_.empty();
41 MockSpecialStoragePolicy::~MockSpecialStoragePolicy() {}
43 } // namespace content