| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/pickle.h" | 5 #include "base/pickle.h" |
| 6 #include "base/values.h" | 6 #include "base/values.h" |
| 7 #include "extensions/common/permissions/manifest_permission.h" | 7 #include "extensions/common/permissions/manifest_permission.h" |
| 8 #include "extensions/common/permissions/manifest_permission_set.h" | 8 #include "extensions/common/permissions/manifest_permission_set.h" |
| 9 #include "ipc/ipc_message.h" | 9 #include "ipc/ipc_message.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 namespace extensions { | 12 namespace extensions { |
| 13 | 13 |
| 14 class MockManifestPermission : public ManifestPermission { | 14 class MockManifestPermission : public ManifestPermission { |
| 15 public: | 15 public: |
| 16 MockManifestPermission(const std::string& name) | 16 MockManifestPermission(const std::string& name) |
| 17 : name_(name) { | 17 : name_(name) { |
| 18 } | 18 } |
| 19 | 19 |
| 20 std::string name() const override { return name_; } | 20 std::string name() const override { return name_; } |
| 21 | 21 |
| 22 std::string id() const override { return name(); } | 22 std::string id() const override { return name(); } |
| 23 | 23 |
| 24 PermissionIDSet GetPermissions() const override { return PermissionIDSet(); } | 24 PermissionIDSet GetPermissions() const override { return PermissionIDSet(); } |
| 25 | 25 |
| 26 bool FromValue(const base::Value* value) override { return true; } | 26 bool FromValue(const base::Value* value) override { return true; } |
| 27 | 27 |
| 28 scoped_ptr<base::Value> ToValue() const override { | 28 std::unique_ptr<base::Value> ToValue() const override { |
| 29 return base::Value::CreateNullValue(); | 29 return base::Value::CreateNullValue(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 ManifestPermission* Diff(const ManifestPermission* rhs) const override { | 32 ManifestPermission* Diff(const ManifestPermission* rhs) const override { |
| 33 const MockManifestPermission* other = | 33 const MockManifestPermission* other = |
| 34 static_cast<const MockManifestPermission*>(rhs); | 34 static_cast<const MockManifestPermission*>(rhs); |
| 35 EXPECT_EQ(name_, other->name_); | 35 EXPECT_EQ(name_, other->name_); |
| 36 return NULL; | 36 return NULL; |
| 37 } | 37 } |
| 38 | 38 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 EXPECT_EQ(expected_permissions, result); | 213 EXPECT_EQ(expected_permissions, result); |
| 214 | 214 |
| 215 // |result| = |permissions1| - |permissions2| --> | 215 // |result| = |permissions1| - |permissions2| --> |
| 216 // |result| intersect |permissions2| == empty_set | 216 // |result| intersect |permissions2| == empty_set |
| 217 ManifestPermissionSet result2; | 217 ManifestPermissionSet result2; |
| 218 ManifestPermissionSet::Intersection(result, permissions2, &result2); | 218 ManifestPermissionSet::Intersection(result, permissions2, &result2); |
| 219 EXPECT_TRUE(result2.empty()); | 219 EXPECT_TRUE(result2.empty()); |
| 220 } | 220 } |
| 221 | 221 |
| 222 } // namespace extensions | 222 } // namespace extensions |
| OLD | NEW |