summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/mock_extension_special_storage_policy.h
blob: edc142e724686a95bd792600f1c71d008df01436 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_EXTENSIONS_MOCK_EXTENSION_SPECIAL_STORAGE_POLICY_H_
#define CHROME_BROWSER_EXTENSIONS_MOCK_EXTENSION_SPECIAL_STORAGE_POLICY_H_

#include <set>
#include <string>

#include "base/macros.h"
#include "chrome/browser/extensions/extension_special_storage_policy.h"
#include "url/gurl.h"

// This class is the same as MockSpecialStoragePolicy (in
// content/public/test/mock_special_storage_policy.h), but it inherits
// ExtensionSpecialStoragePolicy instead of storage::SpecialStoragePolicy.
class MockExtensionSpecialStoragePolicy : public ExtensionSpecialStoragePolicy {
 public:
  MockExtensionSpecialStoragePolicy();

  // storage::SpecialStoragePolicy:
  bool IsStorageProtected(const GURL& origin) override;
  bool IsStorageUnlimited(const GURL& origin) override;
  bool IsStorageSessionOnly(const GURL& origin) override;
  bool CanQueryDiskSize(const GURL& origin) override;
  bool HasSessionOnlyOrigins() override;

  void AddProtected(const GURL& origin) {
    protected_.insert(origin);
  }

 private:
  ~MockExtensionSpecialStoragePolicy() override;

  std::set<GURL> protected_;

  DISALLOW_COPY_AND_ASSIGN(MockExtensionSpecialStoragePolicy);
};

#endif  // CHROME_BROWSER_EXTENSIONS_MOCK_EXTENSION_SPECIAL_STORAGE_POLICY_H_