OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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. |
| 4 |
| 5 #include "extensions/common/permissions/mock_manifest_permission.h" |
| 6 |
| 7 #include "base/memory/ptr_util.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 |
| 10 namespace extensions { |
| 11 |
| 12 MockManifestPermission::MockManifestPermission(const std::string& name) |
| 13 : name_(name) {} |
| 14 |
| 15 std::string MockManifestPermission::name() const { |
| 16 return name_; |
| 17 } |
| 18 |
| 19 std::string MockManifestPermission::id() const { |
| 20 return name(); |
| 21 } |
| 22 |
| 23 PermissionIDSet MockManifestPermission::GetPermissions() const { |
| 24 return PermissionIDSet(); |
| 25 } |
| 26 |
| 27 bool MockManifestPermission::FromValue(const base::Value* value) { |
| 28 return true; |
| 29 } |
| 30 |
| 31 std::unique_ptr<base::Value> MockManifestPermission::ToValue() const { |
| 32 return base::MakeUnique<base::Value>(); |
| 33 } |
| 34 |
| 35 ManifestPermission* MockManifestPermission::Diff( |
| 36 const ManifestPermission* rhs) const { |
| 37 const MockManifestPermission* other = |
| 38 static_cast<const MockManifestPermission*>(rhs); |
| 39 EXPECT_EQ(name_, other->name_); |
| 40 return nullptr; |
| 41 } |
| 42 |
| 43 ManifestPermission* MockManifestPermission::Union( |
| 44 const ManifestPermission* rhs) const { |
| 45 const MockManifestPermission* other = |
| 46 static_cast<const MockManifestPermission*>(rhs); |
| 47 EXPECT_EQ(name_, other->name_); |
| 48 return new MockManifestPermission(name_); |
| 49 } |
| 50 |
| 51 ManifestPermission* MockManifestPermission::Intersect( |
| 52 const ManifestPermission* rhs) const { |
| 53 const MockManifestPermission* other = |
| 54 static_cast<const MockManifestPermission*>(rhs); |
| 55 EXPECT_EQ(name_, other->name_); |
| 56 return new MockManifestPermission(name_); |
| 57 } |
| 58 |
| 59 } // namespace extensions |
OLD | NEW |