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

Unified Diff: extensions/common/permissions/mock_manifest_permission.h

Issue 2850493002: Extracted MockManifestPermission to its own file (Closed)
Patch Set: Nits Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: extensions/common/permissions/mock_manifest_permission.h
diff --git a/extensions/common/permissions/mock_manifest_permission.h b/extensions/common/permissions/mock_manifest_permission.h
new file mode 100644
index 0000000000000000000000000000000000000000..fd4b96c9d0f493704c21c6b0b0c6d735f7b0f10d
--- /dev/null
+++ b/extensions/common/permissions/mock_manifest_permission.h
@@ -0,0 +1,45 @@
+// Copyright 2017 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 EXTENSIONS_COMMON_PERMISSIONS_MOCK_MANIFEST_PERMISSION_H_
+#define EXTENSIONS_COMMON_PERMISSIONS_MOCK_MANIFEST_PERMISSION_H_
+
+#include <memory>
+#include <string>
+
+#include "base/macros.h"
+#include "extensions/common/permissions/manifest_permission.h"
+
+namespace base {
+class Value;
+}
+
+namespace extensions {
+
+// Useful for mocking ManifestPermission in tests.
+class MockManifestPermission : public ManifestPermission {
+ public:
+ explicit MockManifestPermission(const std::string& name);
+
+ std::string name() const override;
+ std::string id() const override;
+
+ PermissionIDSet GetPermissions() const override;
+
+ bool FromValue(const base::Value* value) override;
+ std::unique_ptr<base::Value> ToValue() const override;
+
+ ManifestPermission* Diff(const ManifestPermission* rhs) const override;
+ ManifestPermission* Union(const ManifestPermission* rhs) const override;
+ ManifestPermission* Intersect(const ManifestPermission* rhs) const override;
+
+ private:
+ std::string name_;
+
+ DISALLOW_COPY_AND_ASSIGN(MockManifestPermission);
+};
+
+} // namespace extensions
+
+#endif // EXTENSIONS_COMMON_PERMISSIONS_MOCK_MANIFEST_PERMISSION_H_

Powered by Google App Engine
This is Rietveld 408576698